/* ============================================================
   NominaPro - Sistema de Diseño Principal
   Variables CSS + Dark/Light Mode + Tipografía + Base
   ============================================================ */

/* --- Font Face: Inter (Local) --- */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/inter/inter-regular.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/inter/inter-medium.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/inter/inter-semibold.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/inter/inter-bold.woff2') format('woff2');
}

/* ============================================================
   CSS Custom Properties — Light Mode (Default)
/* ============================================================
   CSS Custom Properties — Light Mode (Default)
   Syncroll by jf Brand System:
   Primary: #001F3F (Deep Navy)
   Secondary: #008080 (Teal)
   Accent: #29ABE2 (Cyan)
   ============================================================ */
:root {
    /* --- Syncroll: Colores de Marca Oficiales --- */
    --brand-primary:   #001F3F; /* Deep Navy */
    --brand-secondary: #008080; /* Teal */
    --brand-accent:    #29ABE2; /* Cyan */

    /* --- Escala Primaria (Navy & Cyan) --- */
    --primary-50:  #f0f7ff;
    --primary-100: #e0effe;
    --primary-200: #bae0fd;
    --primary-300: #7cc8fb;
    --primary-400: #38bdf8;
    --primary-500: #0284c7;
    --primary-600: #008080; /* Teal secundario de acción */
    --primary-700: #006666;
    --primary-800: #003352;
    --primary-900: #001F3F; /* Navy principal */
    --primary-950: #001224;

    /* --- Colores de Acento (Teal & Cyan) --- */
    --accent-400: #38bdf8;
    --accent-500: #29ABE2;
    --accent-600: #008080;

    /* --- Colores Semánticos --- */
    --success-light: #e6f7f7;
    --success: #008080;
    --success-dark: #005959;
    --warning-light: #fef3c7;
    --warning: #f59e0b;
    --warning-dark: #b45309;
    --danger-light: #fee2e2;
    --danger: #ef4444;
    --danger-dark: #b91c1c;
    --info-light: #e0f2fe;
    --info: #29ABE2;
    --info-dark: #0284c7;

    /* --- Superficies (Light Mode) --- */
    --bg-body:       #f8fafc;
    --bg-surface:    #ffffff;
    --bg-surface-2:  #f1f5f9;
    --bg-surface-3:  #e2e8f0;
    --bg-hover:      #f0f9ff;
    --bg-active:     #e0f2fe;
    --bg-sidebar:    #001F3F; /* Deep Navy */
    --bg-sidebar-hover: #003366;

    /* --- Textos (Light) --- */
    --text-primary:    #001F3F;
    --text-secondary:  #475569;
    --text-muted:      #94a3b8;
    --text-inverse:    #ffffff;
    --text-sidebar:    #bae0fd;
    --text-sidebar-active: #ffffff;

    /* --- Bordes --- */
    --border-light:    #e2e8f0;
    --border-default:  #cbd5e1;
    --border-focus:    #29ABE2;

    /* --- Sombras --- */
    --shadow-sm:  0 1px 2px 0 rgba(0, 31, 63, 0.05);
    --shadow-md:  0 4px 6px -1px rgba(0, 31, 63, 0.07), 0 2px 4px -2px rgba(0, 31, 63, 0.05);
    --shadow-lg:  0 10px 15px -3px rgba(0, 31, 63, 0.08), 0 4px 6px -4px rgba(0, 31, 63, 0.04);
    --shadow-xl:  0 20px 25px -5px rgba(0, 31, 63, 0.1), 0 8px 10px -6px rgba(0, 31, 63, 0.06);
    --shadow-glow: 0 0 25px rgba(41, 171, 226, 0.22);

    /* --- Bordes Redondeados --- */
    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  14px;
    --radius-xl:  20px;
    --radius-full: 9999px;

    /* --- Tipografía --- */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    --text-xs:   0.75rem;
    --text-sm:   0.8125rem;
    --text-base: 0.9375rem;
    --text-lg:   1.125rem;
    --text-xl:   1.25rem;
    --text-2xl:  1.5rem;
    --text-3xl:  1.875rem;
    --text-4xl:  2.25rem;

    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    /* --- Espaciado --- */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* --- Sidebar --- */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;

    /* --- Transiciones --- */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Dark Mode (Syncroll: #121212 background)
   ============================================================ */
[data-theme="dark"] {
    --bg-body:       #121212; /* Fondo oficial de la propuesta de marca */
    --bg-surface:    #1c1c1e;
    --bg-surface-2:  #242426;
    --bg-surface-3:  #323236;
    --bg-hover:      #242426;
    --bg-active:     #323236;
    --bg-sidebar:    #0c141d;
    --bg-sidebar-hover: #142436;

    --text-primary:    #f8fafc;
    --text-secondary:  #94a3b8;
    --text-muted:      #64748b;
    --text-sidebar:    #bae0fd;

    --border-light:    #2a2a2e;
    --border-default:  #38383e;

    --shadow-sm:  0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md:  0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg:  0 10px 15px -3px rgba(0, 0, 0, 0.7), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
    --shadow-xl:  0 20px 25px -5px rgba(0, 0, 0, 0.8), 0 8px 10px -6px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 30px rgba(41, 171, 226, 0.25);

    /* --- Colores Semánticos en Modo Oscuro (Claridad y Alto Contraste) --- */
    --success-light: rgba(52, 211, 153, 0.15);
    --success:       #34d399; /* Verde claro luminoso (alta visibilidad en fondo oscuro) */
    --success-dark:  #34d399; /* Verde claro para montos ganados, badges y textos */

    --warning-light: rgba(251, 191, 36, 0.15);
    --warning:       #fbbf24;
    --warning-dark:  #fbbf24;

    --danger-light:  rgba(248, 113, 113, 0.15);
    --danger:        #f87171;
    --danger-dark:   #fca5a5;

    --info-light:    rgba(56, 189, 248, 0.15);
    --info:          #38bdf8;
    --info-dark:     #7dd3fc;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-base), color var(--transition-base);
}

a {
    color: var(--primary-500);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--primary-700);
}

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

/* ============================================================
   Login Page
   ============================================================ */
/* ============================================================
   Login Page (Syncroll by jf)
   ============================================================ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: linear-gradient(135deg, #001224 0%, #001F3F 45%, #004d66 80%, #008080 100%);
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(41, 171, 226, 0.22) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 128, 128, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(41, 171, 226, 0.15) 0%, transparent 50%);
    animation: auraPulse 8s ease-in-out infinite alternate;
}

@keyframes auraPulse {
    0%   { opacity: 0.6; transform: scale(1); }
    100% { opacity: 1;   transform: scale(1.05); }
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-xl);
    padding: var(--space-8) var(--space-10);
    box-shadow: var(--shadow-xl), 0 0 60px rgba(41, 171, 226, 0.2);
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

[data-theme="dark"] .auth-card {
    background: rgba(26, 26, 30, 0.95);
    border-color: rgba(41, 171, 226, 0.25);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-logo {
    text-align: center;
    margin-bottom: var(--space-5);
}

.auth-logo-img {
    width: 225px;
    max-width: 82%;
    height: auto;
    object-fit: contain;
    margin: 0 auto var(--space-3);
    display: block;
    filter: drop-shadow(0 4px 16px rgba(0, 31, 63, 0.12));
    transition: transform var(--transition-base), filter var(--transition-base);
}

[data-theme="dark"] .auth-logo-img {
    filter: drop-shadow(0 6px 24px rgba(41, 171, 226, 0.35));
}

/* --- Alternancia automática de logos según Modo Claro / Oscuro --- */
.logo-light-only {
    display: block !important;
}
.logo-dark-only {
    display: none !important;
}

[data-theme="dark"] .logo-light-only {
    display: none !important;
}
[data-theme="dark"] .logo-dark-only {
    display: block !important;
}

.auth-logo h1 {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    margin-bottom: 2px;
}

.auth-logo .auth-by {
    font-size: 0.82rem;
    font-weight: 600;
    color: #008080;
    text-transform: lowercase;
}

.auth-logo p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ============================================================
   Layout Principal (App)
   ============================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-base), width var(--transition-base);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: var(--space-4) var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.sidebar-header .brand-logo-img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: var(--radius-md);
    background: transparent;
    padding: 0;
    filter: drop-shadow(0 2px 8px rgba(41, 171, 226, 0.35));
    flex-shrink: 0;
}

.sidebar-header .brand-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header .brand-title-wrap {
    display: flex;
    align-items: baseline;
    gap: 6px;
    line-height: 1.2;
}

.sidebar-header .brand-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.sidebar-header .brand-by {
    font-size: 0.72rem;
    font-weight: 600;
    color: #29ABE2;
    text-transform: lowercase;
}

.sidebar-header .brand-sub {
    font-size: var(--text-xs);
    color: var(--text-sidebar);
    opacity: 0.75;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) var(--space-3);
}

.nav-section {
    margin-bottom: var(--space-6);
}

.nav-section-title {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(199, 210, 254, 0.4);
    padding: 0 var(--space-3);
    margin-bottom: var(--space-2);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--text-sidebar);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
    text-decoration: none;
    position: relative;
}

.nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
}

.nav-link.active {
    background: rgba(99, 102, 241, 0.2);
    color: var(--text-sidebar-active);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary-400);
    border-radius: 0 3px 3px 0;
}

.nav-link .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    opacity: 1;
}

.sidebar-footer {
    padding: var(--space-4) var(--space-3);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-400), var(--accent-400));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--text-sm);
    color: white;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: var(--text-xs);
    color: var(--text-sidebar);
    opacity: 0.6;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-base);
}

/* --- Top Bar --- */
.topbar {
    height: 64px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-8);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-left h2 {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.menu-toggle:hover {
    background: var(--bg-hover);
}

/* --- Theme Toggle --- */
.theme-toggle {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    border-color: var(--primary-400);
    color: var(--primary-500);
    box-shadow: var(--shadow-glow);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    width: 20px;
    height: 20px;
    transition: all var(--transition-base);
}

.theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

[data-theme="dark"] .theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

[data-theme="dark"] .theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* --- Page Content --- */
.page-content {
    padding: var(--space-8);
    max-width: 1400px;
}

/* ============================================================
   Scrollbar Custom
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================================
   Overlay para sidebar móvil
   ============================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.sidebar-overlay.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
