﻿/* ==========================================================================
   CONFUSA.top - Ranking Redesign (Light Theme 2.0 System)
   ========================================================================== */

* {
  box-sizing: border-box;
}

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif !important;
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0 !important;
  padding-top: 60px;
  background-image: 
    linear-gradient(180deg, rgba(248, 250, 252, 0.85) 0%, rgba(226, 232, 240, 0.95) 100%),
    url("/images/confusa-blue.png") !important;
  background-repeat: no-repeat !important;
  background-position: center center !important;
  background-size: cover !important;
  background-attachment: fixed !important;
  overflow-x: hidden;
}

/* Ocultar usuário legado do cabeçalho */
html body #logged-user {
  display: none !important;
}

/* Top bar e Bottom bar modernos */
html body #top-bar {
  background: rgba(15, 23, 42, 0.85) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

html body #bottom-bar {
  background: rgba(15, 23, 42, 0.95) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  margin-top: auto !important;
}

/* ==========================================================================
   Navegação do Ranking (Header Sub-bar)
   ========================================================================== */

.ranking-nav-wrapper {
  width: 100%;
  max-width: 1300px;
  margin: 1.5rem auto 0 auto;
  padding: 0 1rem;
}

.ranking-nav-container {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.03);
}

.ranking-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ranking-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.ranking-title-group {
  display: flex;
  flex-direction: column;
}

.ranking-main-title {
  font-family: 'Outfit', sans-serif !important;
  font-size: 1.4rem !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  margin: 0 !important;
  line-height: 1.2;
}

.ranking-subtitle {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
}

.ranking-menu-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ranking-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 10px;
  color: #475569 !important;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid transparent;
}

.ranking-nav-link .nav-icon {
  font-size: 1.15rem;
  color: #64748b;
  transition: color 0.2s ease;
}

.ranking-nav-link:hover {
  background: rgba(2, 132, 199, 0.08);
  color: #0284c7 !important;
  border-color: rgba(2, 132, 199, 0.2);
}

.ranking-nav-link:hover .nav-icon {
  color: #0284c7;
}

.ranking-nav-link.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
  border-color: #0284c7;
}

.ranking-nav-link.active .nav-icon {
  color: #ffffff !important;
}

.ranking-nav-link.disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

/* Compatibilidade com menu legado se existir */
#menu-bar {
  display: none !important;
}

/* ==========================================================================
   Contêiner e Cards Principais
   ========================================================================== */

#ranking-container,
.ranking-container,
.propostas-container {
  width: 100%;
  max-width: 1300px;
  margin: 1.25rem auto 2.5rem auto;
  padding: 0 1rem;
  flex: 1;
  box-sizing: border-box;
}

#ranking,
.ranking-card,
.propostas-card {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  border-radius: 18px !important;
  padding: 2rem !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04) !important;
  margin: 0 !important;
  width: 100% !important;
  box-sizing: border-box;
}

/* Títulos do Card */
.ranking-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding-bottom: 1rem;
}

.ranking-card-title,
#ranking h2 {
  font-family: 'Outfit', sans-serif !important;
  font-size: 1.6rem !important;
  font-weight: 600 !important;
  color: #1e293b !important;
  margin: 0 !important;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ranking-card-date,
#ranking h3 {
  font-size: 0.9rem !important;
  color: #64748b !important;
  font-weight: 500 !important;
  margin: 4px 0 0 0 !important;
}

hr {
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  margin: 1.25rem 0;
}

/* ==========================================================================
   Filtros de Federação (Segmented Control)
   ========================================================================== */

#federation-select,
.federation-filters {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 1.25rem 0;
  padding: 6px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

#federation-select span {
  display: none;
}

#federation-select a,
.fed-filter-btn {
  padding: 8px 18px;
  border-radius: 10px;
  color: #475569 !important;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#federation-select a:hover,
.fed-filter-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  color: #0284c7 !important;
}

#federation-select a.active,
.fed-filter-btn.active {
  background: #ffffff !important;
  color: #0284c7 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

/* ==========================================================================
   Tabelas Modernas
   ========================================================================== */

.tbl_user_data,
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #ffffff;
}

table,
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 0;
  background: transparent;
}

table thead th,
.table thead th {
  background: #f8fafc;
  color: #475569;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  text-align: center;
  white-space: nowrap;
}

table tbody td,
.table tbody td {
  padding: 12px 14px;
  color: #1e293b;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  vertical-align: middle;
  text-align: center;
  transition: background 0.15s ease;
}

table tbody tr:last-child td,
.table tbody tr:last-child td {
  border-bottom: none;
}

table thead th.headings,
.table thead th.headings,
th.headings {
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease, color 0.2s ease;
}

table thead th.headings:hover,
.table thead th.headings:hover,
th.headings:hover {
  background: rgba(2, 132, 199, 0.08) !important;
  color: #0284c7 !important;
}

th span.material-symbols-outlined.hidden,
span.material-symbols-outlined.hidden,
.hidden {
  display: none !important;
}

th span.material-symbols-outlined {
  font-size: 1.25rem !important;
  vertical-align: middle !important;
  line-height: 1;
}

th span.material-symbols-outlined.ascending {
  color: #0284c7 !important;
}

th span.material-symbols-outlined.descending {
  color: #0284c7 !important;
}

.highlighted {
  background-color: rgba(2, 132, 199, 0.08) !important;
  color: #0284c7 !important;
}

[data-href] {
  cursor: pointer;
}

/* Posição / Ranking Badge */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  background: #f1f5f9;
  color: #64748b;
}

.rank-badge.top-1 {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.2);
}

.rank-badge.top-2 {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: #334155;
}

.rank-badge.top-3 {
  background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
  color: #9a3412;
}

/* Bandeiras e Time */
.bandeira {
  height: 22px;
  width: 32px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  vertical-align: middle;
  margin-right: 8px;
}

.team-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.team-link {
  color: #0f172a !important;
  font-weight: 600;
  text-decoration: none !important;
  transition: color 0.2s ease;
}

.team-link:hover {
  color: #0284c7 !important;
}

.points-cell {
  font-weight: 700;
  color: #0284c7;
  font-size: 0.95rem;
}

/* Linhas inativas */
tr.cinza td,
tr.cinza a {
  color: #94a3b8 !important;
}

tr.cinza .bandeira {
  opacity: 0.6;
  filter: grayscale(40%);
}

.badge-status {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

span.ativo {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-left: 8px;
}

span.inativo {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-left: 8px;
}

/* ==========================================================================
   Blocos de Estatísticas (Stats Cards & Counters)
   ========================================================================== */

#info-jogos,
.ranking-stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: stretch;
  margin: 1.25rem 0;
}

.infoblock,
.masterblock {
  flex: 1 1 140px;
  max-width: 220px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
  text-decoration: none !important;
  color: #1e293b !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  height: auto;
  float: none;
  font-size: 1.2rem;
  font-weight: 700;
}

.infoblock:hover,
.masterblock:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 8px 20px rgba(2, 132, 199, 0.12);
}

.infoblock span.material-symbols-outlined,
.masterblock span.material-symbols-outlined {
  font-size: 1.6rem;
  color: #0284c7;
}

.infoblock .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.vitoria,
span.vitoria {
  color: #10b981 !important;
}

.empate,
span.empate {
  color: #f59e0b !important;
}

.derrota,
span.derrota {
  color: #ef4444 !important;
}

/* ==========================================================================
   Barra de Pesquisa (Search Box)
   ========================================================================== */

#direita,
.search-container {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 6px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  transition: all 0.25s ease;
  float: right;
  margin-bottom: 1rem;
}

#direita:focus-within,
.search-container:focus-within {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

#caixa_pesquisa {
  border: none !important;
  background: transparent !important;
  outline: none !important;
  font-family: 'Montserrat', sans-serif !important;
  font-size: 0.9rem !important;
  color: #1e293b !important;
  width: 220px !important;
  height: auto !important;
}

#direita span.material-symbols-outlined {
  color: #64748b;
  font-size: 1.25rem;
}

/* ==========================================================================
   Grade de Seleções (selecoes.php)
   ========================================================================== */

.selecoes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
  padding: 1rem 0;
  width: 100%;
}

.selecao-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-decoration: none !important;
  color: #1e293b !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.selecao-card:hover {
  transform: translateY(-5px);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 10px 24px rgba(2, 132, 199, 0.15);
}

.selecao-card img {
  width: 90px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.25s ease;
}

.selecao-card:hover img {
  transform: scale(1.05);
}

.selecao-card span {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e293b;
  text-align: center;
  line-height: 1.2;
}

/* ==========================================================================
   Página de Regras (regras.php)
   ========================================================================== */

.rules-container {
  max-width: 950px;
  margin: 0 auto;
  text-align: left;
  line-height: 1.7;
}

.rules-container p {
  color: #334155;
  font-size: 0.95rem;
  margin-bottom: 1.2rem;
}

.formula-card {
  background: rgba(2, 132, 199, 0.05);
  border: 1px solid rgba(2, 132, 199, 0.18);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
}

.formula-card .formula-main {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0284c7;
  letter-spacing: 0.05em;
  margin: 0;
}

.rules-constants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin: 1.25rem 0;
}

.rules-constant-item {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.constant-val {
  background: #0284c7;
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  padding: 4px 10px;
  border-radius: 6px;
  min-width: 42px;
  text-align: center;
}

.constant-desc {
  font-size: 0.88rem;
  color: #334155;
  font-weight: 500;
}

/* ==========================================================================
   Paginação Moderna
   ========================================================================== */

.pagination {
  display: flex !important;
  justify-content: center;
  align-items: center;
  gap: 6px;
  list-style: none !important;
  padding: 0 !important;
  margin: 1.5rem 0 !important;
}

.pagination li {
  display: inline-block;
  float: none !important;
  margin: 0;
}

.pagination a,
.pagination_link,
.pagination button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  color: #475569 !important;
  font-size: 0.85rem !important;
  font-weight: 600;
  text-decoration: none !important;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.pagination a:hover,
.pagination_link:hover,
.pagination button:hover:not(:disabled) {
  background: rgba(2, 132, 199, 0.08) !important;
  color: #0284c7 !important;
  border-color: rgba(2, 132, 199, 0.3) !important;
}

.pagination li.active a,
.pagination li.active button,
.pagination_link:disabled {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3) !important;
  cursor: default;
}

.sr-only {
  display: none !important;
}

/* ==========================================================================
   Modais & Overlays
   ========================================================================== */

.modalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 99998;
  display: none;
}

.moreInfoModal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  z-index: 99999;
  display: none;
  padding: 1.5rem;
  overflow-y: auto;
  box-sizing: border-box;
}

.modal-guts {
  margin: 0;
  width: 100%;
}

.modal-guts h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: #1e293b;
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.modal-guts h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: #475569;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.moreInfoModal .toggleButton,
button#retornar {
  display: block;
  width: 100%;
  margin-top: 1.25rem;
  padding: 10px 20px;
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.moreInfoModal .toggleButton:hover,
button#retornar:hover {
  background: #0369a1;
}

/* ==========================================================================
   Perfil da Seleção (teamstatus.php)
   ========================================================================== */

.team-header-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.team-profile-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

#bandeiraGrande {
  width: 90px;
  height: 60px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  float: none;
}

.team-profile-title {
  display: flex;
  flex-direction: column;
}

.team-profile-title h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.team-profile-title h3 {
  font-size: 0.95rem;
  color: #64748b;
  margin: 4px 0 0 0;
  display: flex;
  align-items: center;
}

/* ==========================================================================
   Alerts & Misc
   ========================================================================== */

.alert {
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  margin: 1rem 0;
}

.alert-info {
  background: rgba(2, 132, 199, 0.08);
  color: #0369a1;
  border: 1px solid rgba(2, 132, 199, 0.18);
}

.alert-success {
  background: rgba(16, 185, 129, 0.08);
  color: #065f46;
  border: 1px solid rgba(16, 185, 129, 0.18);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.08);
  color: #991b1b;
  border: 1px solid rgba(239, 68, 68, 0.18);
}

/* ==========================================================================
   Responsividade Mobile
   ========================================================================== */

@media (max-width: 768px) {
  body {
    padding-top: 50px;
  }

  .ranking-nav-container {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
  }

  .ranking-brand {
    justify-content: center;
    text-align: center;
  }

  .ranking-menu-nav {
    justify-content: center;
  }

  .ranking-nav-link {
    flex: 1 1 calc(50% - 10px);
    justify-content: center;
  }

  #ranking,
  .ranking-card,
  .propostas-card {
    padding: 1.25rem !important;
  }

  .ranking-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  #direita,
  .search-container {
    width: 100%;
    float: none;
    margin-top: 10px;
  }

  #caixa_pesquisa {
    width: 100% !important;
  }

  .infoblock,
  .masterblock {
    flex: 1 1 calc(50% - 8px);
    max-width: none;
  }

  .selecoes-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
  }

  .selecao-card img {
    width: 70px;
    height: 46px;
  }

  .team-header-profile {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .team-profile-info {
    flex-direction: column;
    text-align: center;
  }

  .team-profile-title h3 {
    justify-content: center;
  }
}