:root {
    --bg-main: #0F172A;
    --bg-sidebar: #111827;
    --bg-card: #1F2937;
    --text-primary: #E5E7EB;
    --text-muted: rgba(229, 231, 235, 0.5);
    --color-blue: #1E5ED6;
    --color-green: #22C55E;
    --color-yellow: #FACC15;
    --color-red: #EF4444;
    --color-pink: #F472B6;
    --color-pink-soft: rgba(244, 114, 182, 0.1);
    --color-blue-soft: rgba(30, 94, 214, 0.1);
    --border-color: rgba(255, 255, 255, 0.05);
    --bg-comprovante: #ffffff;
}

.mobile-only, .ranking-pos-mobile, .substituto-label { display: none !important; }

/* Estilos de Diferenciação */
.etapa-feminina-row td:first-child {
    border-left: 4px solid var(--color-pink) !important;
}

.etapa-masculina-row td:first-child {
    border-left: 4px solid var(--color-blue) !important;
}

.text-feminina {
    color: var(--color-pink) !important;
}

.text-masculina {
    color: var(--color-blue) !important;
}

.badge-feminina {
    background-color: var(--color-pink-soft) !important;
    color: var(--color-pink) !important;
}

.btn-whatsapp-table {
    background-color: #25D366 !important;
    color: white !important;
    padding: 6px !important;
    border-radius: 6px !important;
    border: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-whatsapp-table:hover {
    transform: scale(1.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background-color: var(--bg-sidebar);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.sidebar-header {
    padding: 24px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header i {
    color: var(--color-blue);
    background: rgba(30, 94, 214, 0.1);
    padding: 6px;
    border-radius: 8px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(229, 231, 235, 0.6);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 14px;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(30, 94, 214, 0.15) 0%, transparent 100%);
    color: var(--color-blue);
    border-left: 4px solid var(--color-blue);
    font-weight: 700;
}

/* Main Content */
.main-wrapper {
    margin-left: 240px;
    width: calc(100% - 240px);
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 64px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.content-area {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Grid Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: linear-gradient(145deg, #1e293b, #111827);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    border-color: rgba(30, 94, 214, 0.3);
}

.stat-title {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
}

.stat-icon {
    color: var(--color-blue);
    opacity: 0.8;
}

/* Containers */
.card-container {
    background-color: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-header {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.card-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 16px 24px;
    font-size: 12px;
    text-transform: uppercase;
    color: rgba(229, 231, 235, 0.4);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Boi Selection UX */
.score-option {
    flex: 1;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
}

.score-option.small {
    padding: 8px 4px;
    font-size: 12px;
}

.score-option:hover {
    border-color: var(--color-blue);
    background: rgba(30, 94, 214, 0.05);
}

.score-option.active {
    background: var(--color-blue);
    border-color: var(--color-blue);
    color: white;
    box-shadow: 0 4px 12px rgba(30, 94, 214, 0.2);
}

.score-option.active span {
    color: white;
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.active-badge, .badge-active {
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--color-green);
}

.inactive-badge, .badge-inactive {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--color-red);
}

.badge-yellow {
    background-color: rgba(250, 204, 21, 0.1);
    color: var(--color-yellow);
}

.color-green { color: var(--color-green) !important; }
.color-red { color: var(--color-red) !important; }
.color-yellow { color: var(--color-yellow) !important; }
.color-blue { color: var(--color-blue) !important; }

/* Grid de Números com Expansão */
.grid-numeros-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.grid-numeros {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-height: 120px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.grid-numeros.expandido {
  max-height: none;
}

.btn-ver-mais {
  background: rgba(30, 94, 214, 0.1);
  color: var(--color-blue);
  border: 1px solid rgba(30, 94, 214, 0.2);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Lista de Vaqueiros Compacta */
.lista-vaqueiros-compacta {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-primary);
}

/* Bloco da Etapa Compacto */
.bloco-etapa-info {
  font-size: 14px;
  line-height: 1.3;
  font-weight: bold;
}

/* Popup Comprovante */
.modal-conteudo {
  background: #fff;
  padding: 20px;
  border: 2px solid #000;
  width: 350px;
  text-align: center;
  border-radius: 8px;
  color: #000;
}

.linha {
  margin-bottom: 6px;
  font-size: 14px;
}

.titulo-comprovante {
  font-weight: bold;
  margin-bottom: 10px;
}

.botoes {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
}

.comprovante-header {
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 15px;
  text-align: center;
}

.comprovante-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.comprovante-item {
  display: flex;
  justify-content: space-between;
}

.comprovante-item span:first-child {
  font-weight: bold;
}

/* Buttons Refinement */
.btn, .btn-primary {
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    box-shadow: 0 4px 12px rgba(30, 94, 214, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30, 94, 214, 0.3);
    filter: brightness(1.1);
}

/* Forms & Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background-color: var(--bg-card);
    padding: 32px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    width: 600px;
    max-width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.form-group.full {
    grid-column: span 2;
}

label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

input, select {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--color-blue);
}

.search-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    opacity: 0.75;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding-left: 42px;
}

input.codigo-vaqueiro {
  user-select: text !important;
  pointer-events: auto !important;
}

.photo-upload {
    width: 100px;
    height: 100px;
    border: 2px dashed var(--border-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    overflow: hidden;
    margin-bottom: 24px;
}

.photo-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

/* Avatar Density */
.avatar, .avatar-img, .avatar-img-dash, .etapa-logo-mobile {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #475569;
    margin-right: 12px;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-img-dash {
    width: 28px;
    height: 28px;
}

.vaqueiro-photo, .vaqueiro-photo-list {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

/* Grid Senhas - Density Adjustments */
.grid-senhas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
    padding: 24px;
}

.senha-item {
    aspect-ratio: 1;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.senha-item:hover {
    border-color: var(--color-blue);
    background: rgba(30, 94, 214, 0.05);
}

.senha-item.reservado {
    background-color: rgba(250, 204, 21, 0.1);
    border-color: var(--color-yellow);
    color: var(--color-yellow);
}

.senha-item.pago {
    background-color: rgba(34, 197, 94, 0.1);
    border-color: var(--color-green);
    color: var(--color-green);
}

.senha-numero {
    font-size: 16px;
    font-weight: 700;
}

.senha-status {
    font-size: 9px;
    text-transform: uppercase;
    font-weight: 600;
    opacity: 0.8;
}

/* Legenda */
.legenda {
    display: flex;
    gap: 20px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.legenda-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.legenda-cor {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* Modal styles updates */
.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* ========================================================
   MOBILE FIRST & APP-LIKE EXPERIENCE (DARK THEME)
   ======================================================== */

.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 64px;
    background-color: var(--bg-sidebar);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.bottom-nav-item.active {
    color: var(--color-blue);
}

.bottom-nav-item i {
    width: 20px;
    height: 20px;
}


/* Desktop specific tweaks can go here if needed, but mobile is now handled in mobile.css */
@media (min-width: 769px) {
  body {
    display: flex !important;
    overflow-x: hidden;
  }

  .sidebar {
    width: 250px !important;
    flex: 0 0 250px !important;
    position: sticky !important;
    top: 0;
    height: 100vh !important;
    border-right: 1px solid var(--border-color);
  }

  .main-wrapper {
    flex: 1 !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    width: auto !important;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-main);
  }

  .topbar {
    width: 100% !important;
    position: sticky;
    top: 0;
    background-color: var(--bg-sidebar);
    padding: 0 24px !important;
  }

  .content-area {
    padding: 24px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    margin: 0 !important;
  }

  .container, .card-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 24px 0 !important;
  }
}

/* Common Ranking List Styles */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ranking-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s;
    cursor: pointer;
}

.rank-number {
    font-size: 20px;
    font-weight: 800;
    width: 40px;
    text-align: center;
    color: var(--text-muted);
}

.vaqueiro-photo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.vaqueiro-info {
    flex: 1;
}

.vaqueiro-name {
    font-size: 16px;
    font-weight: 700;
}

.vaqueiro-details {
    font-size: 12px;
    color: var(--text-muted);
}

.vaqueiro-points {
    text-align: right;
}

.points-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--color-blue);
}

.points-label {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
}

/* Category Ranking Filter Buttons (Universal) */
.ranking-dashboard-header {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.ranking-dashboard-header {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.btn-ranking-filter {
    flex: 1;
    height: 44px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-ranking-filter:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border-color: rgba(255, 255, 255, 0.1);
}

/* Masculino Active */
#btn-dash-ranking-masc.active, 
#btn-vaqueiro-filter-masc.active, 
#btn-etapa-filter-masc.active {
    background: linear-gradient(135deg, #1E5ED6, #0D47A1);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(30, 94, 214, 0.3);
}

/* Feminino Active */
#btn-dash-ranking-fem.active, 
#btn-vaqueiro-filter-fem.active, 
#btn-etapa-filter-fem.active {
    background: linear-gradient(135deg, #F472B6, #DB2777);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(244, 114, 182, 0.3);
}

.btn-ranking-filter.active i {
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.5));
}

.fin-select-ref {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 16px;
    color: var(--text-primary);
    height: 48px;
    min-width: 200px;
    cursor: pointer;
    transition: all 0.2s;
}

.fin-select-ref:focus {
    outline: none;
    border-color: var(--color-blue);
    background: rgba(255, 255, 255, 0.05);
}

/* End of file */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Animations */
@keyframes slideInDown {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.animate-slide-down {
    animation: slideInDown 0.3s ease;
}
