/* assets/css/style.css - Tema Blanco y Rojo con Optimización Celular y Disposición PC Limpia */

:root {
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-border: rgba(226, 232, 240, 0.9);
    --bg-sidebar: #ffffff;
    
    --primary: #dc2626;         /* Rojo Institucional */
    --primary-hover: #b91c1c;   /* Rojo Carmesí Oscuro */
    --accent: #ef4444;          /* Rojo Vivo */
    --secondary: #10b981;       /* Verde Éxito */
    --danger: #991b1b;
    --warning: #f59e0b;
    
    --text-main: #0f172a;       /* Texto Principal Oscuro Legible */
    --text-muted: #475569;      /* Texto Secundario Gris */
    --text-dim: #94a3b8;
    --text-light: #ffffff;

    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 10px 25px -5px rgba(220, 38, 38, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

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

body {
    background-color: var(--bg-body);
    background-image: 
        radial-gradient(at 0% 0%, rgba(220, 38, 38, 0.06) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(239, 68, 68, 0.04) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Layout App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Wrapper Principal en PC (a la derecha de la barra lateral de 260px) */
.main-wrapper {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Top Header Bar Principal (Cabecera Superior con Nombre de Usuario) */
.top-header-bar {
    position: sticky;
    top: 0;
    z-index: 90;
    background: #ffffff;
    border-bottom: 2px solid #fee2e2;
    padding: 0.85rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.top-header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-user-greeting {
    font-size: 0.95rem;
    color: var(--text-main);
}
.top-user-name {
    font-weight: 800;
    color: var(--primary);
}

.top-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-menu-btn {
    display: none;
    background: #fee2e2;
    color: var(--primary);
    border: none;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    cursor: pointer;
}

/* Sidebar Drawer */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

#sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 150;
}
#sidebar-overlay.active {
    display: block;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #fee2e2;
    background: #fff;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo-img {
    height: 44px;
    width: auto;
    object-fit: contain;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
    line-height: 1.1;
}

.sidebar-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
}

.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
}

.sidebar-nav {
    padding: 1.25rem 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
}

.nav-item:hover {
    background: #fef2f2;
    color: var(--primary);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.nav-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #fee2e2;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #fafafa;
}

.user-role-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

.badge-admin { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.badge-organizador { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-delegado { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }

/* Área Principal de Contenido */
.main-content {
    flex: 1;
    padding: 1.75rem 2rem;
    max-width: 100%;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.85rem;
    border-bottom: 2px solid #fee2e2;
}

.page-title {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 0.2rem;
}

/* Tarjetas */
.card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 2px solid #f1f5f9;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.88rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}
.btn-primary:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #b91c1c, #991b1b);
}

.btn-accent {
    background: #ffffff;
    color: var(--primary);
    border: 2px solid var(--primary);
    font-weight: 800;
}
.btn-accent:hover {
    background: var(--primary);
    color: #ffffff;
}

.btn-danger {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}
.btn-danger:hover {
    background: #fca5a5;
    color: #7f1d1d;
}

.btn-sm {
    padding: 0.45rem 0.8rem;
    font-size: 0.8rem;
}

/* Formularios */
.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.4rem;
}

.form-control, .form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

/* Grillas */
.grid {
    display: grid;
    gap: 1.5rem;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Tablas */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 0.75rem;
}

.table {
    width: 100% !important;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

.table th {
    background: #fef2f2 !important;
    padding: 0.85rem 0.9rem;
    font-weight: 800;
    color: var(--primary) !important;
    border-bottom: 2px solid #fee2e2 !important;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

.table td {
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
}

.table tr:hover {
    background: #fff5f5 !important;
}

/* DataTables Custom Styling */
.dataTables_wrapper {
    font-size: 0.88rem;
    color: var(--text-main);
}
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    padding: 0.4rem 0.75rem;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius-sm);
    outline: none;
    margin-left: 0.4rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--primary) !important;
    color: #ffffff !important;
    border: 1px solid var(--primary-hover) !important;
    border-radius: 6px;
    font-weight: 700;
}

/* Login Page Styling */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background-color: #f8fafc;
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(220, 38, 38, 0.12) 0%, transparent 60%);
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border: 1px solid #fee2e2;
    border-radius: var(--radius);
    padding: 2.25rem;
    box-shadow: 0 20px 40px rgba(220, 38, 38, 0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-logo-img {
    height: 85px;
    width: auto;
    object-fit: contain;
    margin-bottom: 0.75rem;
}

.alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-danger { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* 📱 ADAPTABILIDAD 100% EXCLUSIVA PARA CELULAR (Mobile-First Optimization <= 768px) */
@media (max-width: 768px) {
    .main-wrapper {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close-btn {
        display: block;
    }

    .top-header-bar {
        padding: 0.65rem 1rem;
    }
    .top-user-greeting {
        font-size: 0.85rem;
    }
    .top-header-actions .btn span {
        display: none;
    }

    .main-content {
        padding: 1rem 0.75rem;
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 1.25rem;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card {
        padding: 1.1rem;
        margin-bottom: 1rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .form-control, .form-select, .btn {
        min-height: 44px;
        font-size: 0.95rem;
    }

    /* Adaptación de DataTables en Móvil */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        float: none;
        text-align: left;
        margin-bottom: 0.75rem;
    }
    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        margin-left: 0;
        margin-top: 0.3rem;
    }
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: center;
        margin-top: 1rem;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.2rem;
    }

    /* Modales full width en móvil */
    #modal_edit_equipo .card,
    #modal_edit_jugador .card {
        width: 92% !important;
        margin: 1rem auto;
        padding: 1.25rem;
    }
}
