:root {
    --primary: #20372a;
    --primary-hover: #16261d;
    --accent: #f97316; /* Naranja vibrante para el botón primario */
    --accent-hover: #ea580c;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --sidebar-width: 250px;
    --danger-color: #ef4444; 
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
}

body { background-color: var(--bg-color); }

body.login-page {
    background-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 20px 60px;
    box-sizing: border-box;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar: fijo a la pantalla completa, nunca se mueve con el scroll de la página */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow: hidden;
    z-index: 50;
}

/* Logo + menú: si el contenido es más alto que la pantalla, esta parte scrollea
   internamente, pero el botón de "Cerrar sesión" (sidebar-footer) queda siempre
   anclado abajo, fuera de ese scroll. */
.sidebar-top {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge viejos */
}
.sidebar-top::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge nuevo */
}

.sidebar-logo {
    padding: 20px 20px;
    border-bottom: 5px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.sidebar-logo h2 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: white;
}

.close-mobile-btn {
    display: none;
}
#close-sidebar.close-mobile-btn {
    color: var(--accent);
}
@media (max-width: 768px) {
    .close-mobile-btn {
        display: block;
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
    }
}

@media (max-width: 480px) {
    body.login-page { padding: 12px 36px; align-items: center; }
    .login-card { padding: 24px; }
    .login-logo { max-height: 130px; margin-bottom: 12px; }
}

.sidebar-nav {
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover { background-color: rgba(255, 255, 255, 0.1); color: white; }
.nav-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border-left: 4px solid #10b981; 
}

.nav-group { display: flex; flex-direction: column; }
.nav-parent {
    width: 100%;
    background: none;
    border: none;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.nav-parent .nav-chevron {
    width: 14px;
    height: 14px;
    margin-left: auto;
    transition: transform 0.2s ease;
}
.nav-group.open .nav-parent .nav-chevron { transform: rotate(180deg); }
.nav-group.open .nav-parent { color: white; }

.nav-submenu {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0 6px 0;
}
.nav-group.open .nav-submenu { display: flex; }

.nav-subitem {
    display: block;
    padding: 9px 16px 9px 42px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    border-left: 4px solid transparent;
    transition: all 0.2s;
}
.nav-subitem:hover { background-color: rgba(255, 255, 255, 0.1); color: white; }
.nav-subitem.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border-left: 4px solid #10b981;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state svg { color: var(--accent); opacity: 0.6; margin-bottom: 8px; }
.empty-state h3 { color: var(--primary); font-size: 1.1rem; }
.empty-state p { max-width: 420px; font-size: 0.9rem; line-height: 1.5; }

.sidebar-footer { padding: 24px 16px; border-top: 1px solid rgba(255, 255, 255, 0.1); flex-shrink: 0; }

.creditos {
    font-size: 0.72rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.4;
    margin-top: 20px;
}
.creditos a { color: rgba(255, 255, 255, 0.8); text-decoration: underline; }

/* Evita que el navegador cambie el fondo de los inputs a celeste cuando
   detecta autocompletado guardado (usuario/contraseña), para que la caja
   se vea siempre igual sin importar si el navegador "recuerda" el campo. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: var(--text-main, #1f2a24) !important;
    caret-color: var(--text-main, #1f2a24);
    transition: background-color 9999s ease-in-out 0s;
}
.logout-btn {
    background-color: var(--danger-color);
    color: white !important; 
    justify-content: center; 
    border-left: none !important;
}
.logout-btn:hover { background-color: #dc2626; transform: translateY(-1px); }

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: var(--sidebar-width);
}

.top-header {
    height: 64px;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.icon-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); }
.icon-btn svg { width: 24px; height: 24px; }

/* Menú Hamburguesa Naranja y más grande */
#menu-toggle {
    color: var(--accent);
}
#menu-toggle svg {
    width: 32px;
    height: 32px;
}

.user-profile { display: flex; align-items: center; gap: 12px; }
.avatar {
    width: 32px; height: 32px; background-color: var(--primary);
    color: white; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-weight: 600;
}

.content-area { padding: 32px; }
.view-section { display: none; animation: fadeIn 0.3s ease; }
.view-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 3px solid var(--accent);
    display: flex;
    align-items: center;
    gap: 12px;
}
.page-title svg {
    width: 26px;
    height: 26px;
    color: var(--accent);
    flex-shrink: 0;
}

/* Dashboard Cards Mejoradas */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 24px; }
.stat-card-full { grid-column: 1 / -1; margin-top: 24px; }
.stat-card {
    background-color: var(--card-bg); padding: 24px;
    border-radius: 12px; border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.stat-header { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-header h3 { font-size: 0.95rem; color: var(--primary); font-weight: 700; margin-top: 4px; }

/* Estilos de iconos para tarjetas */
.stat-icon {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 20px; height: 20px; }
.bg-blue { background-color: #eff6ff; color: #3b82f6; }
.bg-green { background-color: #f0fdf4; color: #10b981; }
.bg-purple { background-color: #faf5ff; color: #a855f7; }
.bg-orange { background-color: #fff7ed; color: var(--accent); }

.stat-value { font-size: 2.2rem; font-weight: 600; color: var(--text-main); margin-top: 12px; }
.config-placeholder { background-color: var(--card-bg); padding: 40px; border-radius: 12px; border: 1px solid var(--border-color); text-align: center; color: var(--text-muted); font-size: 1.1rem; }

/* Tarjeta gráfica: anillo de progreso (Tasa de Cobro General) */
.stat-ring-card { padding: 24px; }
.stat-ring-body { display: flex; align-items: center; gap: 32px; margin-top: 12px; flex-wrap: wrap; }
.stat-ring-wrap { position: relative; width: 130px; height: 130px; flex-shrink: 0; }
.stat-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.stat-ring-bg { fill: none; stroke: var(--bg-color); stroke-width: 10; }
.stat-ring-fill { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.stat-ring-value { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 700; color: var(--text-main); }
.stat-ring-caption { color: var(--text-muted); font-size: 0.95rem; max-width: 420px; }

/* Gráfico de barras: Jugadores por Categoría y Profesores por Especialidad */
.chart-card { padding: 24px; margin-top: 24px; container-type: inline-size; }
.chart-header { margin-bottom: 20px; }
.bar-chart { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: flex; align-items: center; gap: 14px; }
.bar-label { width: 90px; flex-shrink: 0; font-size: 0.875rem; color: var(--text-muted); font-weight: 500; }
.bar-label::before { content: "•"; color: var(--accent); font-weight: 700; margin-right: 6px; }
.bar-track-wrap { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.bar-track { flex: 1; height: 14px; background-color: var(--bg-color); border-radius: 9999px; overflow: hidden; }
.bar-fill { height: 100%; background-color: var(--accent); border-radius: 9999px; transition: width 0.4s ease; }
.bar-value { width: 28px; flex-shrink: 0; text-align: right; font-weight: 600; color: var(--text-main); }

/* Se apila cuando la TARJETA (no la ventana) queda angosta: la etiqueta arriba
   (puede envolver en 2 líneas) y la barra + el valor juntos abajo, a todo el ancho.
   Mismo formato para ambos gráficos, sin importar el tamaño de ventana del navegador. */
@container (max-width: 560px) {
    .bar-row { flex-direction: column; align-items: stretch; gap: 6px; }
    .bar-label { width: 100%; font-size: 0.85rem; white-space: normal; }
    .bar-track-wrap { width: 100%; }
}

/* Botones y Tabla */
.flex-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }

/* Botón Naranja (Añadir Jugador) */
.btn-accent {
    background-color: var(--accent); color: white; border: none;
    padding: 10px 18px; border-radius: 6px; font-weight: 500;
    cursor: pointer; transition: background 0.2s, transform 0.1s;
    box-shadow: 0 2px 4px rgba(249, 115, 22, 0.2);
}
.btn-accent:hover { background-color: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 6px rgba(249, 115, 22, 0.3); }

.table-container { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; overflow-x: auto; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); }
.saas-table { width: 100%; border-collapse: collapse; text-align: left; }
.saas-table th, .saas-table td { padding: 16px 24px; border-bottom: 1px solid var(--border-color); white-space: nowrap; vertical-align: middle; }
.saas-table th { background-color: var(--accent); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: white; }
.saas-table tr:last-child td { border-bottom: none; }
.fw-500 { font-weight: 500; }
.badge { display: inline-block; padding: 4px 8px; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; }
.badge.active { background-color: #def7ec; color: #03543f; }
.badge.inactive { background-color: #f3f4f6; color: #6b7280; }
.badge.cargo { background-color: #fde8e8; color: #9b1c1c; }

.form-group p.view-value {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    min-height: 1.2em;
}

.action-buttons { display: flex; gap: 16px; align-items: center; }
.action-btn { background: none; border: none; cursor: pointer; color: #9ca3af; transition: color 0.2s, transform 0.1s; display: flex; align-items: center; justify-content: center; }
.action-btn svg { width: 20px; height: 20px; }
.action-btn:hover { transform: scale(1.1); }
.btn-view:hover { color: #3b82f6; }   
.btn-edit:hover { color: #10b981; }   
.btn-delete:hover { color: var(--danger-color); } 

/* =========================================
   MODAL STYLES (DISEÑO SAAS)
   ========================================= */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(17, 24, 39, 0.6); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: all 0.3s ease; z-index: 1000;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-content {
    background-color: var(--card-bg); width: 90%; max-width: 600px;
    border-radius: 16px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    transform: translateY(-20px) scale(0.95); transition: all 0.3s ease;
    max-height: 90dvh;
    overflow-y: auto;
    overflow-x: hidden;
}
.modal-overlay.active .modal-content { transform: translateY(0) scale(1); }

.modal-header {
    padding: 24px; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h2 { font-size: 1.25rem; font-weight: 600; color: var(--text-main); }
.close-modal-icon {
    background: none; border: none; font-size: 1.5rem; color: var(--text-muted);
    cursor: pointer; transition: color 0.2s; line-height: 1;
}
.close-modal-icon:hover { color: var(--text-main); }

.modal-body { padding: 24px; }

/* Estructura del Formulario */
.form-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
.form-group.full-width { grid-column: span 2; }
.form-group label {
    display: block; font-size: 0.875rem; font-weight: 500;
    color: var(--text-main); margin-bottom: 8px;
}
.text-danger { color: var(--danger-color); }

.form-control {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border-color);
    border-radius: 8px; font-size: 0.95rem; color: var(--text-main);
    transition: all 0.2s; outline: none; background-color: #fff;
}
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.modal-footer {
    margin-top: 32px; display: flex; justify-content: flex-end; gap: 12px;
}
.btn-text { background: none; border: none; color: var(--text-muted); font-weight: 500; padding: 10px 16px; cursor: pointer; transition: color 0.2s; }
.btn-text:hover { color: var(--text-main); }

/* Estado de Cuenta: resumen, acciones rápidas y pestañitas del modal */
.cuenta-resumen { display: flex; gap: 12px; margin-bottom: 20px; }
.cuenta-resumen-item {
    flex: 1; background-color: var(--bg-color); border-radius: 10px; padding: 12px 14px;
    display: flex; flex-direction: column; gap: 4px;
}
.cuenta-resumen-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.cuenta-resumen-valor { font-size: 1.15rem; font-weight: 700; color: var(--text-main); }

.cuenta-acciones { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.btn-accion-cuenta {
    flex: 1; min-width: 150px; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border-color); background: #fff;
    font-size: 0.85rem; font-weight: 600; color: var(--text-main); cursor: pointer; transition: all 0.2s;
}
.btn-accion-cuenta svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-accion-cuenta:hover { background-color: var(--bg-color); }
.btn-accion-cuenta.cargo { background-color: var(--danger-color); border-color: var(--danger-color); color: white; }
.btn-accion-cuenta.cargo:hover { background-color: #dc2626; border-color: #dc2626; }
.btn-accion-cuenta.pago { background-color: #10b981; border-color: #10b981; color: white; }
.btn-accion-cuenta.pago:hover { background-color: #059669; border-color: #059669; }

.cuenta-form-rapido {
    background-color: var(--bg-color); border-radius: 10px; padding: 16px; margin-bottom: 20px;
}

.cuenta-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-color); margin-bottom: 16px; }
.cuenta-tab-btn {
    background: none; border: none; padding: 10px 16px; font-size: 0.9rem; font-weight: 600;
    color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: all 0.2s;
}
.cuenta-tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.cuenta-tab-content { display: none; }
.cuenta-tab-content.active { display: block; overflow-x: auto; }
.cuenta-historial-table { box-shadow: none; border: 1px solid var(--border-color); border-radius: 10px; }
.cuenta-historial-table th, .cuenta-historial-table td { padding: 10px 14px; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .content-area { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-group.full-width { grid-column: span 1; }

    /* Tarjetas de resumen (Total Jugadores, Deuda, etc.): 2 columnas y más
       compactas en vez de una sola columna larga que obliga a mucho scroll. */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card { padding: 14px; border-radius: 10px; }
    .stat-header h3 { font-size: 0.78rem; margin-top: 0; line-height: 1.25; }
    .stat-icon { width: 30px; height: 30px; border-radius: 8px; }
    .stat-icon svg { width: 16px; height: 16px; }
    .stat-value { font-size: 1.5rem; margin-top: 8px; }
    .stat-card-full { margin-top: 12px; }
    .stat-ring-body { justify-content: center; text-align: center; gap: 16px; }
    .stat-ring-caption { max-width: 100%; }
}
@media (min-width: 769px) {
    #menu-toggle { display: none; }
    .top-header { justify-content: flex-end; }
}
.toast-exito {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: #10b981;
    color: white;
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 2000;
}
.toast-exito.show {
    opacity: 1;
    transform: translateY(0);
}
.password-wrapper {
    position: relative;
}
.password-wrapper .form-control {
    padding-right: 44px;
}
.toggle-password {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}
.toggle-password svg { width: 20px; height: 20px; }
.toggle-password.active { color: var(--accent); }

.th-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.th-icon svg {
    width: 14px;
    height: 14px;
}
.logo-img {
    max-width: 95%;
    max-height: 170px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}
.login-logo {
    max-width: 100%;
    max-height: 240px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto 24px auto;
}
html, body {
    overflow-x: hidden;
}
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
}
@media (max-width: 768px) {
    .sidebar-overlay.active {
        display: block;
    }
}

.whatsapp-btn {
    display: none;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    background-color: #25D366;
    color: white;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
    width: fit-content;
}
.whatsapp-btn:hover {
    background-color: #1ebe57;
}

.filtros-jugadores {
    display: none;
    gap: 12px;
    margin-bottom: 20px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.filtros-jugadores.visible {
    display: flex;
}

@media (max-width: 480px) {
    .filtro-busqueda {
        min-width: 100%;
    }
}

.filtro-busqueda {
    position: relative;
    flex: 1;
    min-width: 220px;
}
.filtro-busqueda svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}
.filtro-busqueda input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
}
.filtro-busqueda input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}
/* Buscador con botón de limpiar */
.filtro-busqueda .icono-buscar {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}
.filtro-busqueda input {
    padding-right: 38px;
}
.limpiar-busqueda-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
}
.limpiar-busqueda-btn svg { width: 16px; height: 16px; }
.limpiar-busqueda-btn:hover { background: var(--bg-color); color: var(--danger-color); }

/* Dropdown propio (reemplaza el <select> nativo) */
.custom-select {
    position: relative;
    min-width: 160px;
}
.custom-select-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: border-color 0.15s;
}
.custom-select-trigger svg:first-child { width: 16px; height: 16px; flex-shrink: 0; }
.custom-select-trigger .chevron { width: 14px; height: 14px; margin-left: auto; transition: transform 0.2s; flex-shrink: 0; }
.custom-select.open .chevron { transform: rotate(180deg); }
.custom-select.has-value .custom-select-label { color: var(--text-main); font-weight: 500; }
.custom-select:hover .custom-select-trigger { border-color: var(--accent); }
.custom-select.open .custom-select-trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}
.custom-select-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.custom-select-options {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
}
.custom-select.open .custom-select-options { display: block; }
.custom-select-option {
    padding: 10px 14px;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-main);
    transition: background 0.15s, color 0.15s;
}
.custom-select-option:hover, .custom-select-option.active {
    background-color: rgba(249, 115, 22, 0.1);
    color: var(--accent-hover);
}
.custom-select-option.placeholder {
    color: var(--text-muted);
    font-style: italic;
    border-bottom: 1px solid var(--border-color);
}

/* Botón "Limpiar filtros" */
.btn-limpiar-filtros {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: var(--danger-color);
    border: none;
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
    width: 100%;
}
.btn-limpiar-filtros svg { width: 16px; height: 16px; }
.btn-limpiar-filtros:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    .filtro-busqueda {
        flex: 1 1 100%;
        min-width: 100%;
    }
    .custom-select {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
    }
    .btn-limpiar-filtros {
        flex: 1 1 100%;
        width: 100%;
    }
}

@media (max-width: 480px) {
    #filtro-socio .custom-select-options {
        left: auto;
        right: 0;
    }
}

.acciones-jugadores {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 24px;
}
.btn-filtro-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.btn-filtro-toggle svg { width: 18px; height: 18px; }
.btn-filtro-toggle:hover { background-color: var(--primary-hover); transform: translateY(-1px); }
.btn-filtro-toggle.active { background-color: var(--primary-hover); }

.btn-outline {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--card-bg);
    color: var(--primary);
    border: 1px solid var(--border-color);
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}
.btn-outline svg { width: 18px; height: 18px; }
.btn-outline:hover { background-color: var(--bg-color); transform: translateY(-1px); }

@media (max-width: 480px) {
    .acciones-jugadores {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .acciones-jugadores .btn-filtro-toggle,
    .acciones-jugadores .btn-accent,
    .acciones-jugadores .btn-outline {
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        padding: 10px 4px;
        font-size: 0.72rem;
        text-align: center;
        white-space: normal;
        line-height: 1.15;
    }
    .acciones-jugadores .btn-filtro-toggle svg,
    .acciones-jugadores .btn-accent svg,
    .acciones-jugadores .btn-outline svg {
        width: 16px;
        height: 16px;
    }
}

.form-group .custom-select {
    width: 100%;
    min-width: 0;
}
.form-group .custom-select-trigger {
    color: var(--text-main);
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
    margin: 28px 0 4px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}
.form-section-title:first-of-type {
    margin-top: 0;
}
.form-section-title svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
}
.form-section-title + .form-grid {
    margin-top: 14px;
}

/* El título "Cuota de Socio" vive dentro de su propio div (para poder
   ocultarlo cuando el jugador no es socio), así que cuenta como "primero"
   de su contenedor y pierde el margen superior normal. Se lo devolvemos. */
#ver-cuota-seccion .form-section-title {
    margin-top: 28px;
}

.form-hint {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-muted);
}