/* Portuguese Language School brand */
:root {
  --brand-green: #046A38;
  --brand-red: #DA291C;
  --footer-green: #006400;
  --text-dark: #333;
  --text-muted: #6c757d;
  --bg-light: #f8f9fa;
  --dropdown-bg: #e8f5e9;
  --dropdown-border: rgba(4, 106, 56, 0.2);
  --dropdown-focus-border: var(--brand-green);
}

body {
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-dark);
  background-color: #fff;
  padding-top: 56px;
}

/* Navbar */
.navbar-logo-icon {
  flex-shrink: 0;
  color: var(--brand-green);
  font-size: 1.5rem;
}

.nav-link-brand {
  color: var(--text-dark) !important;
  font-weight: 600;
}

.nav-link-brand:hover,
.nav-link-brand:focus {
  color: var(--brand-green) !important;
}

.navbar-flag-img {
  display: block;
  object-fit: contain;
}

.flag-dropdown-img {
  flex-shrink: 0;
  object-fit: contain;
}

.navbar .dropdown-menu .dropdown-item:focus {
  background-color: var(--bg-light);
}

/* Headings */
.brand-heading {
  color: var(--brand-green);
  font-weight: 700;
}

.section-heading {
  font-size: 1.75rem;
  font-weight: 700;
  background-color: var(--brand-green);
  color: #fff;
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
}

/* Home hero: language + settings (visible on smaller viewports) */
.home-lang-settings {
  min-height: 3rem;
}
.home-lang-settings__btn {
  color: var(--brand-green) !important;
  font-size: 1.5rem;
}
.home-lang-settings__btn:hover,
.home-lang-settings__btn:focus {
  color: var(--text-dark) !important;
}
.home-lang-settings__flag {
  display: block;
  width: 32px;
  height: 24px;
  object-fit: contain;
}

/* Buttons and links */
.btn-brand {
  background-color: var(--brand-green);
  border-color: var(--brand-green);
  color: #fff;
  font-weight: 600;
}

.btn-brand:hover {
  background-color: #035a2e;
  border-color: #035a2e;
  color: #fff;
}

/* Game card Play buttons: light tint of icon colour, dark text */
.btn-game-play {
  font-weight: 600;
  border: 1px solid transparent;
}

.btn-game-play--blue {
  background-color: #d6eaf8;
  border-color: #aed6f1;
  color: #1a5276;
}
.btn-game-play--blue:hover {
  background-color: #aed6f1;
  border-color: #85c1e9;
  color: #1a5276;
}

.btn-game-play--purple {
  background-color: #e8daef;
  border-color: #d7bde2;
  color: #5b2c6f;
}
.btn-game-play--purple:hover {
  background-color: #d7bde2;
  border-color: #c39bd3;
  color: #5b2c6f;
}

.btn-game-play--orange {
  background-color: #fdebd0;
  border-color: #fad7a0;
  color: #924d0a;
}
.btn-game-play--orange:hover {
  background-color: #fad7a0;
  border-color: #f8c471;
  color: #924d0a;
}

.btn-game-play--teal {
  background-color: #d1f2eb;
  border-color: #a3e4d7;
  color: #0e6655;
}
.btn-game-play--teal:hover {
  background-color: #a3e4d7;
  border-color: #76d7c4;
  color: #0e6655;
}

.btn-game-play--coral {
  background-color: #fadbd8;
  border-color: #f5b7b1;
  color: #922b21;
}
.btn-game-play--coral:hover {
  background-color: #f5b7b1;
  border-color: #ec7063;
  color: #922b21;
}

.btn-game-play--amber {
  background-color: #fcf3cf;
  border-color: #f9e79f;
  color: #7d6608;
}
.btn-game-play--amber:hover {
  background-color: #f9e79f;
  border-color: #f7dc6f;
  color: #7d6608;
}

/* Game verb + translation label: same look as play buttons */
.game-verb-label {
  display: inline-block;
  background-color: #d6eaf8;
  border: 1px solid #aed6f1;
  color: #1a5276;
  padding: 0.25em 0.5em;
  border-radius: 6px;
  font-weight: 600;
}
.game-verb-label .text-muted {
  color: inherit !important;
}

/* Game tense line: always one step smaller than the content above */
.game-tense-label {
  font-size: smaller;
}

.btn-brand-outline {
  border: 2px solid var(--brand-green);
  color: var(--brand-green);
  font-weight: 600;
}

.btn-brand-outline:hover {
  background-color: var(--brand-green);
  color: #fff;
}

a:not(.footer-link):not(.nav-link):not(.dropdown-item) {
  color: var(--brand-green);
}

a:not(.footer-link):not(.nav-link):not(.dropdown-item):hover {
  color: var(--brand-red);
}

/* Cards */
.game-card,
.lesson-card {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Conjugation type dropdowns: soft light green (brand-aligned, easy on the eye) */
.lesson-select,
.quick-guide-select,
.conjugation-dropdown-btn,
#gameLessonSelect .conjugation-dropdown-btn {
  background-color: var(--dropdown-bg);
  border-color: var(--dropdown-border);
  color: var(--text-dark);
}

.lesson-select:hover,
.quick-guide-select:hover,
.conjugation-dropdown-btn:hover,
#gameLessonSelect .conjugation-dropdown-btn:hover {
  background-color: #dceddc;
  border-color: rgba(4, 106, 56, 0.3);
}

.lesson-select:focus,
.quick-guide-select:focus,
.conjugation-dropdown-btn:focus,
#gameLessonSelect .conjugation-dropdown-btn:focus {
  background-color: var(--dropdown-bg);
  border-color: var(--dropdown-focus-border);
  box-shadow: 0 0 0 0.2rem rgba(4, 106, 56, 0.15);
}

/* Custom conjugation dropdown: trigger button full width */
.conjugation-dropdown {
  width: 100%;
}

.conjugation-dropdown .conjugation-dropdown-btn {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* One arrow only: remove Bootstrap’s dropdown-toggle caret (form-select already shows a chevron) */
.conjugation-dropdown-btn.dropdown-toggle::after {
  display: none;
}

/* Dropdown menu: non-selectable category headers (coloured rectangle + bold) */
.conjugation-dropdown-menu .conjugation-dropdown-category {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  font-weight: 700;
  color: var(--text-dark);
  pointer-events: none;
  cursor: default;
  list-style: none;
}

.conjugation-dropdown-menu .conjugation-dropdown-category .conjugation-dropdown-dot {
  flex-shrink: 0;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 2px;
}

/* Selectable options: slightly indented, smaller font than categories */
.conjugation-dropdown-menu .conjugation-dropdown-option {
  padding-left: 1.25rem;
  list-style: none;
  font-size: 0.9em;
}

.conjugation-dropdown-menu .conjugation-dropdown-option .dropdown-item {
  padding-left: 0.25rem;
}

/* Lessons: conjugation type dropdown */
.lesson-select {
  max-width: 28rem;
}

/* Lesson detail (tables for selected conjugation) */
.lesson-detail {
  transition: opacity 0.18s ease;
}

.lesson-detail-fade {
  opacity: 0;
}

.lesson-detail-title {
  font-size: 1.35rem;
  color: var(--brand-green);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.lesson-detail-intro {
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

/* Lesson tables: prev/next switcher. Group keeps arrows close to table on all devices. */
.lesson-carousel-wrap {
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
}

.lesson-tables-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 35rem;
  min-width: 0;
}

.lesson-tables-inner {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 280px;
  position: relative;
}

.lesson-table-slide {
  display: none;
  padding: 0.5rem 0;
  justify-content: center;
}

.lesson-table-slide.active {
  display: flex;
}

.lesson-carousel-wrap .table-responsive-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

@media (min-width: 576px) {
  .lesson-carousel-wrap .table-responsive-wrap {
    max-width: 28rem;
  }
}

.lesson-carousel-btn {
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: var(--brand-green);
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lesson-carousel-btn:hover {
  background-color: #035a2e;
}

.lesson-carousel-btn .carousel-control-prev-icon,
.lesson-carousel-btn .carousel-control-next-icon {
  filter: brightness(0) invert(1);
  width: 1.25rem;
  height: 1.25rem;
  background-size: 100% 100%;
}

.lesson-carousel-btn:focus-visible {
  outline: 2px solid var(--brand-green);
  outline-offset: 2px;
}

.game-card .card-title {
  color: var(--brand-green);
}

.game-card-icon-wrap {
  min-width: 4.5rem;
  border-radius: 8px 0 0 8px;
}

.game-card-icon {
  font-size: 2rem;
  color: #fff;
}

.game-card-icon--dark {
  color: #2c3e50;
}

/* Footer */
.footer {
  background-color: var(--footer-green);
  color: #f5f5f5;
}

.footer-app-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.footer-links {
  font-size: 0.95rem;
}

.footer-link {
  color: #f5f5f5 !important;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 0.25rem;
}

.footer-link:hover {
  color: #fff !important;
  text-decoration: underline;
}

.footer-offline {
  font-size: 0.9rem;
  opacity: 0.9;
}

.footer-columns {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 1400px) {
  .footer-columns {
    max-width: 1300px;
  }
}

.footer-brand-link {
  color: #fff !important;
  text-decoration: none;
}

.footer-brand-link:hover {
  color: #e8f5e9 !important;
  text-decoration: none;
}

.footer-brand-icon {
  flex-shrink: 0;
  color: #fff;
  font-size: 1.5rem;
}

.footer-brand-link:hover .footer-brand-icon {
  color: #e8f5e9;
}

/* Footer contact (Portuguese school style) */
.footer-contact {
  color: #fff;
}

.footer-contact-item {
  font-size: 0.95rem;
  margin: 0;
}

.footer-contact-link {
  color: #fff !important;
  text-decoration: none;
}

.footer-contact-link:hover {
  color: #e8f5e9 !important;
  text-decoration: underline;
}

.footer-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.8);
  color: #fff !important;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.footer-social-link:hover {
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff !important;
  border-color: #fff;
}

.footer-author {
  padding: 10px 12px;!important;
  border-left: 3px solid #0d6efd;!important;
  background: rgba(13,110,253,0.05);!important;
  border-radius: 6px;!important;
}

.footer-author__label {
  font-size: 11px;!important;
  text-transform: uppercase;!important;
  letter-spacing: 0.08em;!important;
  opacity: 0.7;!important;
}

.footer-author__name {
  font-weight: 600;!important;
  font-size: 15px;!important;
}

/* Lesson tables */
.conjugation-table {
  font-size: 0.95rem;
}

.conjugation-table th {
  background-color: var(--bg-light);
  color: var(--brand-green);
  font-weight: 600;
}

.conjugation-pt {
  white-space: nowrap;
}

.conjugation-disambiguator {
  white-space: normal;
}

.tts-speak-btn {
  vertical-align: middle;
  line-height: 1;
}

.tts-speak-btn:hover {
  color: var(--brand-green) !important;
}

/* Game area */
#gameArea .card {
  max-width: 600px;
  margin: 0 auto;
}

.game-feedback.correct {
  color: var(--brand-green);
  font-weight: 600;
}

.game-feedback.wrong {
  color: var(--brand-red);
  font-weight: 600;
}

/* Highlight correct answer when user got it wrong */
.game-option-correct {
  border: 2px solid var(--brand-green) !important;
  background-color: rgba(4, 106, 56, 0.08) !important;
  color: var(--brand-green);
}

/* Highlight incorrect answer that the user selected */
.game-option-wrong {
  border: 2px solid var(--brand-red) !important;
  background-color: rgba(218, 41, 28, 0.12) !important;
  color: var(--brand-red);
}

.streak-display {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Darker text for game options so they are easier to read */
#mcOptions .btn,
#fbOptions .btn,
#wiOptions .btn,
#lsOptions .btn {
  color: #212529;
}

#mcOptions .btn:hover,
#fbOptions .btn:hover,
#wiOptions .btn:hover,
#lsOptions .btn:hover {
  color: #fff;
}

/* Keep correct/wrong highlight colors and full opacity when buttons are disabled */
#mcOptions .btn.game-option-correct,
#fbOptions .btn.game-option-correct,
#wiOptions .btn.game-option-correct,
#lsOptions .btn.game-option-correct {
  color: var(--brand-green) !important;
  opacity: 1;
}

#mcOptions .btn.game-option-wrong,
#fbOptions .btn.game-option-wrong,
#wiOptions .btn.game-option-wrong,
#lsOptions .btn.game-option-wrong {
  color: var(--brand-red) !important;
  opacity: 1;
}

#matchLeft .list-group-item,
#matchRight .list-group-item {
  color: #212529;
}

.match-left-item.matched {
  opacity: 0.5;
  pointer-events: none;
}

.match-right-item.matched {
  opacity: 1;
  text-decoration: none;
  pointer-events: none;
}

/* Confetti container: full viewport overlay, no pointer events */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti-particle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  pointer-events: none;
}

/* Responsive: touch targets */
@media (max-width: 991.98px) {
  .navbar-collapse .nav-link,
  .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  #langDropdownBtn {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Quick Guide section */
.quick-guide-select {
  max-width: 28rem;
}

/* Lesson search input */
.lesson-search-input {
  max-width: 28rem;
  background-color: var(--dropdown-bg);
  border-color: var(--dropdown-border);
  color: var(--text-dark);
  display: block;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.lesson-search-input::placeholder {
  color: var(--text-muted);
}

.lesson-search-input:hover {
  background-color: var(--dropdown-bg);
  border-color: var(--dropdown-border);
}

.lesson-search-input:focus {
  background-color: var(--dropdown-bg);
  border-color: var(--dropdown-focus-border);
  color: var(--text-dark);
  box-shadow: 0 0 0 0.2rem rgba(4, 106, 56, 0.15);
}

.quick-guide-content {
  margin-top: 0.25rem;
}

.quick-guide-card {
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  max-width: 42rem;
}

.quick-guide-title {
  font-size: 1.25rem;
  color: var(--brand-green);
  font-weight: 700;
  margin-bottom: 1rem;
}

.quick-guide-section {
  margin-bottom: 1.25rem;
}

.quick-guide-section:last-child {
  margin-bottom: 0;
}

.quick-guide-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.35rem;
}

.quick-guide-text {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-dark);
  margin: 0;
}

/* Conjugation endings in "How to form" only: flat UI colours + italic */
.quick-guide-section--how .conjugation-ending {
  font-style: italic;
  font-weight: 600;
}
.quick-guide-section--how .ending--ar { color: #3498db; }
.quick-guide-section--how .ending--er { color: #1abc9c; }
.quick-guide-section--how .ending--ir { color: #9b59b6; }
.quick-guide-section--how .ending--suffix { color: #e67e22; }

.quick-guide-translation {
  font-size: 0.875rem;
  font-style: italic;
}

/* Center section headers, labels, selects and lesson/guide text on all screen sizes */
#lessons .section-heading,
#quizzes .section-heading,
#games .section-heading {
  text-align: center;
}
#lessons .form-label,
#quizzes .form-label,
#games .form-label {
  text-align: center;
  display: block;
}
#lessons .lesson-select,
#lessons .conjugation-dropdown,
#quizzes .quick-guide-select,
#quizzes .conjugation-dropdown,
#games .form-select,
#games .conjugation-dropdown {
  display: block;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}
#lessons .lesson-detail-title,
#lessons .lesson-detail-intro {
  text-align: center;
}
#quizzesContent > p.text-muted {
  text-align: center;
}
#quizzes .quick-guide-card {
  margin-left: auto;
  margin-right: auto;
}

/* Center main content on tablets and desktops for easier reading */
@media (min-width: 768px) {
  main.container-fluid {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-left: 0;
    padding-right: 0;
    width: 100%;
  }
  main.container-fluid > section,
  main.container-fluid > * {
    width: 100%;
    max-width: 720px;
    box-sizing: border-box;
    padding-left: var(--bs-gutter-x, 0.75rem);
    padding-right: var(--bs-gutter-x, 0.75rem);
  }
}
@media (min-width: 992px) {
  main.container-fluid > section,
  main.container-fluid > * {
    max-width: 960px;
  }
}
@media (min-width: 1200px) {
  main.container-fluid > section,
  main.container-fluid > * {
    max-width: 1140px;
  }
}

/* Conjugation table scroll on small screens */
@media (max-width: 576px) {
  .table-responsive-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .conjugation-table {
    font-size: 0.85rem;
  }
}
