/* =====================================================
   TEMA MODERNO - DISEÑO CON SIDEBAR
   ===================================================== */

/* Importar fuente */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* Variables del tema moderno */
body.theme-modern {
    --bg-main: #e8f0f8;
    --sidebar-bg: #1e3a5f;
    --sidebar-hover: #2a4a73;
    --sidebar-active: #3d5f8a;
    --card-bg: #ffffff;
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);

    font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif !important;
    background: var(--bg-main) !important;
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
body.theme-modern .sidebar-modern {
    width: 260px;
    background: var(--sidebar-bg);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow: hidden;
}

/* Contenedor de navegacion scrolleable */
body.theme-modern .sidebar-modern .sidebar-nav {
    flex: 1;
    overflow-y: auto;
    margin-right: -8px;
    padding-right: 8px;
}

/* Scrollbar personalizado para el sidebar */
body.theme-modern .sidebar-modern .sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

body.theme-modern .sidebar-modern .sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

body.theme-modern .sidebar-modern .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

body.theme-modern .sidebar-modern .sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

body.theme-modern .sidebar-modern .logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

body.theme-modern .sidebar-modern .logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent), #f97316);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

body.theme-modern .sidebar-modern .logo-text {
    color: white;
}

body.theme-modern .sidebar-modern .logo-text h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin: 0;
    background: none;
    -webkit-text-fill-color: white;
}

body.theme-modern .sidebar-modern .logo-text span {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

body.theme-modern .sidebar-modern .nav-section {
    margin-bottom: 24px;
}

body.theme-modern .sidebar-modern .nav-label {
    color: var(--text-light);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 12px;
    margin-bottom: 12px;
}

body.theme-modern .sidebar-modern .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 10px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    position: relative;
}

body.theme-modern .sidebar-modern .nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
}

body.theme-modern .sidebar-modern .nav-item.active {
    background: var(--sidebar-active);
    color: white;
}

body.theme-modern .sidebar-modern .nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    width: 4px;
    height: 24px;
    background: var(--accent);
    border-radius: 0 4px 4px 0;
}

body.theme-modern .sidebar-modern .nav-item i,
body.theme-modern .sidebar-modern .nav-item .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

body.theme-modern .sidebar-modern .sidebar-footer {
    flex-shrink: 0;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 12px;
}

body.theme-modern .sidebar-modern .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 12px;
}

body.theme-modern .sidebar-modern .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
}

body.theme-modern .sidebar-modern .user-details h4 {
    color: white;
    font-size: 13px;
    font-weight: 600;
    margin: 0;
}

body.theme-modern .sidebar-modern .user-details span {
    color: var(--text-light);
    font-size: 11px;
}

/* Badge de notificacion en sidebar */
body.theme-modern .sidebar-modern .nav-badge {
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

/* ===== CONTENIDO PRINCIPAL ===== */
body.theme-modern .container {
    margin-left: 260px;
    flex: 1;
    padding: 32px;
    max-width: none;
    background: var(--bg-main);
}

/* Ocultar header original y tabs en tema moderno */
body.theme-modern .header {
    display: none !important;
}

body.theme-modern .tabs {
    display: none !important;
}

body.theme-modern .menu-toggle {
    display: none !important;
}

/* Header moderno dentro del contenido */
body.theme-modern .modern-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

body.theme-modern .modern-header .page-title h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

body.theme-modern .modern-header .page-title p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

body.theme-modern .modern-header .header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

body.theme-modern .search-box {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: var(--shadow);
    width: 280px;
}

body.theme-modern .search-box i {
    color: var(--text-light);
    margin-right: 12px;
}

body.theme-modern .search-box input {
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    width: 100%;
}

/* ===== STATS CARDS ===== */
body.theme-modern .stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

body.theme-modern .stat-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

body.theme-modern .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

body.theme-modern .stat-icon.blue {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

body.theme-modern .stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

body.theme-modern .stat-icon.amber {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent);
}

body.theme-modern .stat-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

body.theme-modern .stat-info h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

body.theme-modern .stat-info span {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== CONTENT SECTIONS ===== */
body.theme-modern .content-section {
    background: transparent;
    box-shadow: none;
    padding: 0;
}

body.theme-modern .content-section.active {
    display: block;
}

/* Config sections dentro del contenido */
body.theme-modern .config-section {
    background: var(--card-bg) !important;
    border-radius: 20px !important;
    box-shadow: var(--shadow) !important;
    overflow: hidden;
    margin-bottom: 24px;
}

body.theme-modern .config-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    padding: 20px 24px !important;
}

body.theme-modern .config-header h4 {
    font-size: 18px !important;
    font-weight: 600 !important;
}

body.theme-modern .config-body {
    padding: 24px !important;
}

/* ===== CARDS GRID ===== */
body.theme-modern .grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 0;
}

body.theme-modern .card {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    padding: 0;
    position: relative;
}

body.theme-modern .card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

/* Card header con gradiente */
body.theme-modern .card .card-header-modern {
    position: relative;
    height: 100px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
}

body.theme-modern .card .card-avatar-wrapper {
    position: absolute;
    bottom: -40px;
    left: 24px;
}

body.theme-modern .card .card-avatar {
    width: 88px;
    height: 88px;
    border-radius: 16px;
    border: 4px solid var(--card-bg);
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body.theme-modern .card .status-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

body.theme-modern .card .status-badge.active {
    background: rgba(16, 185, 129, 0.2);
    color: #059669;
}

body.theme-modern .card .status-badge.active::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

body.theme-modern .card .card-body-modern {
    padding: 52px 24px 24px;
}

body.theme-modern .card .card-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

body.theme-modern .card .card-subtitle {
    font-size: 14px;
    color: var(--primary);
    font-weight: 500;
    margin-bottom: 16px;
}

body.theme-modern .card .card-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

body.theme-modern .card .info-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

body.theme-modern .card .info-row i {
    width: 18px;
    color: var(--text-light);
}

body.theme-modern .card .card-footer-modern {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
}

body.theme-modern .card .btn-card {
    flex: 1;
    padding: 10px 16px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
}

body.theme-modern .card .btn-edit {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

body.theme-modern .card .btn-edit:hover {
    background: var(--primary);
    color: white;
}

body.theme-modern .card .btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

body.theme-modern .card .btn-delete:hover {
    background: var(--danger);
    color: white;
}

/* ===== BOTONES ===== */
body.theme-modern .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

body.theme-modern .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

body.theme-modern .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

body.theme-modern .btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

body.theme-modern .btn-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-hover));
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ===== TOGGLE SETTINGS ===== */
body.theme-modern .toggle-setting {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

/* ===== FORMULARIOS ===== */
body.theme-modern .form-group input,
body.theme-modern .form-group select,
body.theme-modern .form-group textarea {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

body.theme-modern .form-group input:focus,
body.theme-modern .form-group select:focus,
body.theme-modern .form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

body.theme-modern .form-group label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* ===== MODALES ===== */
body.theme-modern .modal-content {
    border-radius: 20px;
    box-shadow: var(--shadow-hover);
}

/* ===== BOTON TOGGLE TEMA ===== */
.theme-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    z-index: 9999;
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.5);
}

body.theme-modern .theme-toggle-btn {
    background: linear-gradient(135deg, var(--sidebar-bg), #2a4a73);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    body.theme-modern .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body.theme-modern .sidebar-modern {
        transform: translateX(-100%);
    }

    body.theme-modern .sidebar-modern.open {
        transform: translateX(0);
    }

    body.theme-modern .container {
        margin-left: 0;
        padding: 20px;
    }

    body.theme-modern .stats-row {
        grid-template-columns: 1fr;
    }

    body.theme-modern .grid {
        grid-template-columns: 1fr;
    }

    body.theme-modern .modern-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    body.theme-modern .search-box {
        width: 100%;
    }

    /* Boton para abrir sidebar en movil */
    body.theme-modern .mobile-menu-btn {
        display: flex !important;
    }
}

/* Ocultar sidebar en tema clasico */
body:not(.theme-modern) .sidebar-modern {
    display: none !important;
}

/* Ocultar sidebar cuando no esta logueado */
body.theme-modern #authContainer:not(.hidden) ~ .sidebar-modern,
body.theme-modern:has(#authContainer:not(.hidden)) .sidebar-modern {
    display: none !important;
}

body.theme-modern:has(#authContainer:not(.hidden)) .container {
    margin-left: 0;
}

body.theme-modern:has(#authContainer:not(.hidden)) .theme-toggle-btn {
    display: none;
}

body.theme-modern:has(#authContainer:not(.hidden)) .mobile-menu-btn {
    display: none !important;
}

/* Ajuste para que el container de auth se vea bien */
body.theme-modern #authContainer {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-hover);
    margin: 100px auto;
}

/* ===== MEJORAS PARA CARDS EXISTENTES ===== */
body.theme-modern .card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: none;
}

body.theme-modern .card h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

body.theme-modern .card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 6px;
}

body.theme-modern .card img.mozo-foto {
    width: 70px;
    height: 70px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.theme-modern .card img.qr-code {
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* Botones en cards */
body.theme-modern .card .btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 10px 16px;
    font-size: 13px;
}

body.theme-modern .card .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

body.theme-modern .card .btn-warning {
    background: linear-gradient(135deg, var(--accent), #d97706);
}

body.theme-modern .card .btn-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-hover));
}

/* ===== MEJORAS PARA TABLAS ===== */
body.theme-modern table {
    border-radius: 12px;
    overflow: hidden;
}

body.theme-modern thead th {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-weight: 600;
    padding: 14px 16px;
}

body.theme-modern tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

body.theme-modern tbody tr:hover {
    background: rgba(37, 99, 235, 0.04);
}

/* ===== MEJORAS PARA SELECTS ===== */
body.theme-modern select {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    background: white;
    transition: all 0.2s;
}

body.theme-modern select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

/* ===== ANIMACION DEL BOTON DE TEMA ===== */
.theme-toggle-btn {
    animation: floatBtn 3s ease-in-out infinite;
}

@keyframes floatBtn {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.theme-toggle-btn:hover {
    animation: none;
}

/* ===== TRANSICIONES SUAVES ===== */
body.theme-modern .container,
body.theme-modern .sidebar-modern,
body.theme-modern .content-section,
body.theme-modern .card {
    transition: all 0.3s ease;
}

/* Mobile menu button - OCULTO por defecto */
.mobile-menu-btn {
    display: none !important;
}

/* Solo mostrar en tema moderno Y en movil */
@media (max-width: 768px) {
    body.theme-modern .mobile-menu-btn {
        display: flex !important;
        position: fixed;
        top: 16px;
        left: 16px;
        width: 48px;
        height: 48px;
        border-radius: 12px;
        background: var(--sidebar-bg);
        color: white;
        border: none;
        cursor: pointer;
        z-index: 999;
        align-items: center;
        justify-content: center;
        font-size: 20px;
    }
}

/* Overlay para cerrar sidebar en movil */
body.theme-modern .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

body.theme-modern .sidebar-overlay.open {
    display: block;
}
