/* ============================================= */
/*          VARIÁVEIS GLOBAIS E BASE             */
/* ============================================= */
:root {
  --primary-color: #0d6efd;
  --primary-hover: #0b5ed7;
  --danger-color: #dc3545;
  --favorite-color: #e74c3c;
  --bg-color: #f4f6f9;
  --card-bg-color: #ffffff;
  --header-bg-color: #ffffff;
  --text-color: #212529;
  --text-color-light: #6c757d;
  --accent-color: #0056b3;
  --border-color: #dee2e6;
  --border-color-light: #f1f3f5;
  --sidebar-bg: #1e2a3b;
  --sidebar-text: #adb5bd;
  --sidebar-text-hover: #ffffff;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --header-height: 60px;
}

html.dark {
  --primary-color: #4dabf7;
  --primary-hover: #74c0fc;
  --danger-color: #ff6b6b;
  --favorite-color: #e74c3c;
  --bg-color: #121212;
  --card-bg-color: #1e1e1e;
  --header-bg-color: #1e1e1e;
  --text-color: #e9ecef;
  --text-color-light: #b0b3b8;
  --accent-color: #4dabf7;
  --border-color: #495057;
  --border-color-light: #2c2e33;
  --sidebar-bg: #1c1f24;
  --sidebar-text: #868e96;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color .3s, color .3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  
  to {
    opacity: 1;
  }
}

/* ============================================= */
/*             CONTEÚDO PRINCIPAL                */
/* ============================================= */
.main-content {
  padding: 1.5rem;
  margin-top: 2rem;
}

.controls-container {
  margin-top: 1.5rem;
  margin-bottom: 2.5rem;
}

.season-dropdown {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 400px;
}

.season-dropdown-toggle {
  background-color: var(--card-bg-color);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color);
  cursor: pointer;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dropdown-arrow {
  transition: transform 0.3s ease;
  margin-left: auto;
}

.season-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.season-dropdown-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  background-color: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
  list-style: none;
  padding: 0.5rem;
  margin: 0;
  width: 100%;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  max-height: 300px;
  overflow-y: auto;
}

.season-dropdown.open .season-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.season-dropdown-menu li:not(:last-child) {
  border-bottom: 1.8px solid var(--border-color-light);
}

.season-dropdown-menu a {
  padding: 0.75rem 1rem;
  color: var(--text-color);
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.season-dropdown-menu a:hover {
  background-color: var(--border-color-light);
}

.season-dropdown-toggle img,
.season-dropdown-menu img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ============================================= */
/*             SEÇÃO DOS TIMES                   */
/* ============================================= */
.tournament-wrapper {
  display: none;
}

.tournament-wrapper.active {
  display: block;
  animation: fadeIn 0.5s;
}

.tournament-card {
  background-color: var(--card-bg-color);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
}

.tournament-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.tournament-header h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
}

.tournament-header .team-count {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-color-light);
  font-weight: 500;
}

.trophy-logo-container {
  position: relative;
  cursor: pointer;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.team-crest-container {
  width: 55px;
  height: 55px;
  margin: 0 auto 0.5rem auto;
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trophy-logo,
.team-crest {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.trophy-logo-container.has-error::before,
.team-crest-container.has-error::before {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  color: var(--border-color);
}

.trophy-logo-container.has-error::before {
  content: '\f091';
  /* fa-trophy */
}

.team-crest-container.has-error::before {
  content: '\f132';
  /* fa-shield-halved */
}

.team-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
}

.team-cell {
  text-align: center;
  flex-basis: 80px;
}

.team-name {
  font-weight: 500;
  font-size: 0.8rem;
  line-height: 1.3;
}

.loader {
  text-align: center;
  color: var(--text-color-light);
  font-size: 1.2rem;
  padding: 3rem;
}

/* ============================================= */
/*             GALERIA MODAL (LIGHTBOX)          */
/* ============================================= */
.gallery-modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 1100;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.gallery-modal.show {
  display: flex;
}

.gallery-modal .swiper-container.gallery-main {
  width: 100%;
  max-width: 900px;
  height: 65%;
}

.gallery-modal .swiper-slide {
  display: flex;
  justify-content: center;
  align-items: center;
}

.gallery-modal .swiper-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gallery-modal .swiper-button-next,
.gallery-modal .swiper-button-prev {
  color: #fff;
}

.gallery-modal .swiper-button-next::after,
.gallery-modal .swiper-button-prev::after {
  content: '';
  display: none;
}

.gallery-modal .swiper-button-next i,
.gallery-modal .swiper-button-prev i {
  font-size: 1.8rem;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.5));
}

.gallery-title {
  color: #fff;
  font-size: 1.1rem;
  text-align: center;
  padding: 0.5rem 1rem;
  height: 5%;
  width: 100%;
  max-width: 900px;
}

.gallery-modal .gallery-thumbs {
  height: 15%;
  max-height: 100px;
  width: 100%;
  max-width: 900px;
  margin-top: 1rem;
}

.gallery-modal .gallery-thumbs .swiper-slide {
  width: 25%;
  height: 100%;
  opacity: 0.5;
  transition: opacity 0.3s;
}

.gallery-modal .gallery-thumbs .swiper-slide-thumb-active {
  opacity: 1;
  border: 2px solid var(--accent-color);
  border-radius: 4px;
}

.gallery-modal .gallery-thumbs .swiper-slide img {
  cursor: pointer;
}

.gallery-modal-controls {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 10;
  display: flex;
  gap: 0.5rem;
}

.gallery-modal-close,
.gallery-modal-expand {
  background: transparent;
  border: none;
  cursor: pointer;
}

.gallery-modal-close i,
.gallery-modal-expand i {
  font-size: 1.8rem;
  color: #fff;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.5));
}

@media (min-width: 1024px) {

  .gallery-modal .swiper-button-next,
  .gallery-modal .swiper-button-prev {
    opacity: 0;
    transition: opacity 0.3s;
  }
  
  .gallery-modal .gallery-main:hover .swiper-button-next,
  .gallery-modal .gallery-main:hover .swiper-button-prev {
    opacity: 1;
  }
}