/* ==========================================================================
   ERPGYM - Premium Dark Theme Design System
   ========================================================================== */

:root {
    --bg-main: #090d16;
    --bg-card: #111827;
    --bg-card-hover: #1f2937;
    --bg-sidebar: #0b1120;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(16, 185, 129, 0.25);
    
    --primary: #10b981;
    --primary-hover: #059669;
    --primary-glow: rgba(16, 185, 129, 0.35);
    
    --accent: #f59e0b;
    --accent-red: #ef4444;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Tema Claro (Light Theme)
   ========================================================================== */
[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-sidebar: #ffffff;
    --border-color: #e2e8f0;
    --border-glow: rgba(16, 185, 129, 0.25);
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
}

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

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

/* Scrollbar estilizado */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

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

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 0 15px var(--primary-glow);
}

.brand-text {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    flex: 1;
    padding: 1.25rem 0.85rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.menu-category {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin: 1rem 0.65rem 0.4rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.95rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.nav-link.active {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
    border-left: 3px solid var(--primary);
    font-weight: 600;
}

.sidebar-user {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.user-info .user-name {
    font-size: 0.88rem;
    font-weight: 600;
}

.user-info .user-role {
    font-size: 0.72rem;
    color: var(--primary);
    text-transform: uppercase;
    font-weight: 700;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
}

.top-navbar {
    height: var(--header-height);
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.page-title-box h1 {
    font-size: 1.35rem;
    font-weight: 700;
}

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

.content-body {
    padding: 2rem;
    flex: 1;
}

/* ==========================================================================
   Tarjetas, Contenedores y Tablas
   ========================================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.14);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Grid System */
.grid {
    display: grid;
    gap: 1.5rem;
}
.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
}
.grid-1-2 {
    grid-template-columns: 1fr 2fr;
}
.grid-2-1 {
    grid-template-columns: 2fr 1fr;
}

/* KPI Card */
.kpi-card {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.kpi-card.warning::before { background: var(--accent); }
.kpi-card.danger::before { background: var(--accent-red); }
.kpi-card.blue::before { background: var(--accent-blue); }

.kpi-info .kpi-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-info .kpi-value {
    font-size: 1.9rem;
    font-weight: 800;
    margin-top: 0.35rem;
    letter-spacing: -0.5px;
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--primary);
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: #042416;
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 15px var(--primary-glow);
    transform: translateY(-1px);
    color: #000;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
}

.btn-danger {
    background: var(--accent-red);
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.9rem 1.6rem;
    font-size: 1.05rem;
    border-radius: var(--radius-md);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Tablas */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.custom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.custom-table th {
    background: rgba(0, 0, 0, 0.25);
    padding: 0.85rem 1rem;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

.custom-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

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

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

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: #ffffff;
    font-size: 0.92rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
    background: rgba(0, 0, 0, 0.4);
}

/* Modales */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* Alertas Flash */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.92rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--primary);
    color: #6ee7b7;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--accent-red);
    color: #fca5a5;
}

/* ==========================================================================
   Módulo Check-in Pantalla Completa & Feedback
   ========================================================================== */
.checkin-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.checkin-card {
    background: linear-gradient(145deg, #111827, #0b1120);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.checkin-input-wrapper {
    position: relative;
    max-width: 480px;
    margin: 2rem auto;
}

.checkin-input {
    width: 100%;
    font-size: 1.8rem;
    text-align: center;
    letter-spacing: 4px;
    font-weight: 700;
    padding: 1.1rem;
    border-radius: var(--radius-lg);
    background: #060911;
    border: 2px solid var(--primary);
    color: #ffffff;
    box-shadow: 0 0 25px var(--primary-glow);
}

.checkin-feedback {
    display: none;
    margin-top: 2rem;
    padding: 2rem;
    border-radius: var(--radius-lg);
    animation: bounceIn 0.3s ease-out;
}

.checkin-feedback.allowed {
    display: block;
    background: rgba(16, 185, 129, 0.12);
    border: 2px solid var(--primary);
    box-shadow: 0 0 35px var(--primary-glow);
}

.checkin-feedback.denied {
    display: block;
    background: rgba(239, 68, 68, 0.12);
    border: 2px solid var(--accent-red);
    box-shadow: 0 0 35px rgba(239, 68, 68, 0.3);
}

@keyframes bounceIn {
    0% { transform: scale(0.9); opacity: 0; }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   Punto de Venta (POS) Grid & Carrito
   ========================================================================== */
.pos-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    height: calc(100vh - var(--header-height) - 4rem);
}

.pos-products {
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    padding-right: 0.5rem;
}

.pos-item-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.pos-item-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.4);
}

.pos-item-price {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0.5rem 0;
}

.pos-cart {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.pos-cart-items {
    flex: 1;
    overflow-y: auto;
    margin: 1rem 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    .pos-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .grid-2, .grid-1-2, .grid-2-1 {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Adaptaciones Específicas del Tema Claro
   ========================================================================== */
[data-theme="light"] .top-navbar {
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] .sidebar-user {
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
}

[data-theme="light"] .user-avatar {
    background: #e2e8f0;
    color: #059669;
}

[data-theme="light"] .nav-link:hover {
    color: #0f172a;
    background: #f1f5f9;
}

[data-theme="light"] .nav-link.active {
    color: #059669;
    background: rgba(16, 185, 129, 0.12);
}

[data-theme="light"] .brand-text {
    background: linear-gradient(to right, #0f172a, #059669);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="light"] .btn-secondary {
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #cbd5e1;
}

[data-theme="light"] .btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

[data-theme="light"] .custom-table th {
    background: #f8fafc;
    color: #64748b;
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] .custom-table td {
    border-bottom: 1px solid var(--border-color);
    color: #1e293b;
}

[data-theme="light"] .custom-table tr:hover td {
    background: #f8fafc;
}

[data-theme="light"] .form-control {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

[data-theme="light"] .form-control:focus {
    background: #ffffff;
    border-color: var(--primary);
}

[data-theme="light"] .modal-overlay {
    background: rgba(15, 23, 42, 0.6);
}

[data-theme="light"] .modal-content {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .checkin-card {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border: 2px solid #e2e8f0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .checkin-input {
    background: #ffffff;
    color: #0f172a;
    border-color: var(--primary);
}

[data-theme="light"] .pos-item-card {
    background: #ffffff;
    border-color: #e2e8f0;
}

[data-theme="light"] .pos-item-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .pos-cart {
    background: #ffffff;
    border-color: #e2e8f0;
}

[data-theme="light"] .kpi-icon {
    background: #f1f5f9;
}

[data-theme="light"] .login-card {
    background: rgba(255, 255, 255, 0.96);
    border-color: #e2e8f0;
    color: #0f172a;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .demo-box {
    background: #f8fafc;
    border-color: #cbd5e1;
}

[data-theme="light"] body.login-body {
    background: radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
                #f1f5f9;
}

