@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --color-primario: #1565C0;
    --color-secundario: #1976D2;
    --color-acento: #42A5F5;
    --color-fondo: #F0F4F8;
    --color-sidebar: #0D47A1;
    --color-texto-claro: #FFFFFF;
    --color-card: #FFFFFF;
    --color-btn-hover: #0D47A1;
    --shadow-card: 0 2px 12px rgba(21, 101, 192, 0.10);
    --shadow-sidebar: 4px 0 16px rgba(13, 71, 161, 0.15);
    --border-radius: 12px;
    --transition: all 0.2s ease;
}

* { box-sizing: border-box; }

html, body {
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--color-fondo);
    color: #2C3E50;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

a, .btn-link { color: var(--color-primario); }

/* ===== LAYOUT PRINCIPAL ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 260px;
    min-height: 100vh;
    background: linear-gradient(180deg, var(--color-sidebar) 0%, #1565C0 100%);
    box-shadow: var(--shadow-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.sidebar-brand h5 {
    color: var(--color-texto-claro);
    font-weight: 700;
    margin: 0;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-brand span { color: var(--color-acento); }
.sidebar-nav { flex: 1; padding: 16px 0; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,0.12);
    color: var(--color-texto-claro);
    border-left-color: var(--color-acento);
}

.sidebar-nav a i { font-size: 1.2rem; min-width: 24px; text-align: center; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.15); }

/* ===== TOPBAR ===== */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

.topbar {
    background: var(--color-card);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.btn-toggle {
    background: none;
    border: none;
    color: var(--color-primario);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: var(--transition);
}
.btn-toggle:hover { background: var(--color-fondo); }

.user-info { text-align: right; }
.user-info .user-name { font-weight: 600; font-size: 0.9rem; color: #2C3E50; }
.user-info .user-cargo { font-size: 0.75rem; color: #6B7280; }

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primario), var(--color-acento));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
}

/* ===== PAGE CONTENT ===== */
.page-content { padding: 28px; flex: 1; }
.page-header { margin-bottom: 28px; }
.page-title { font-size: 1.6rem; font-weight: 700; color: var(--color-primario); margin: 0 0 4px 0; }
.page-subtitle { color: #6B7280; font-size: 0.9rem; margin: 0; }

/* ===== CARDS ===== */
.card { background: var(--color-card); border-radius: var(--border-radius); box-shadow: var(--shadow-card); border: none; }
.card-header-custom {
    background: linear-gradient(135deg, var(--color-primario), var(--color-secundario));
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: 16px 20px;
    font-weight: 600;
}

/* ===== MÓDULOS CARDS (Dashboard) ===== */
.modulos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.modulo-card {
    background: var(--color-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-card);
    padding: 28px 24px;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.modulo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(21, 101, 192, 0.18);
    border-color: var(--color-acento);
    text-decoration: none;
    color: inherit;
}

.modulo-card .modulo-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--color-primario), var(--color-acento));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.6rem;
}

.modulo-card .modulo-title { font-weight: 700; font-size: 1rem; color: #1A202C; margin: 0; }
.modulo-card .modulo-desc { font-size: 0.82rem; color: #6B7280; margin: 0; line-height: 1.4; }

/* ===== BIENVENIDA ===== */
.bienvenida-card {
    background: linear-gradient(135deg, var(--color-primario) 0%, var(--color-acento) 100%);
    border-radius: var(--border-radius);
    color: white;
    padding: 28px 32px;
    margin-bottom: 28px;
}
.bienvenida-card h2 { font-weight: 700; margin: 0 0 4px 0; }
.bienvenida-card p { opacity: 0.85; margin: 0; font-size: 0.95rem; }

/* ===== LOGIN PAGE ===== */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #0D47A1 0%, #1565C0 40%, #1976D2 70%, #42A5F5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(13, 71, 161, 0.3);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
}

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--color-primario), var(--color-acento));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    margin: 0 auto 16px auto;
}
.login-logo h4 { color: var(--color-primario); font-weight: 700; margin: 0 0 4px 0; font-size: 1.3rem; }
.login-logo p { color: #6B7280; font-size: 0.85rem; margin: 0; }
.login-title { font-size: 1.5rem; font-weight: 700; color: #1A202C; margin-bottom: 6px; }
.login-subtitle { color: #6B7280; font-size: 0.9rem; margin-bottom: 28px; }

/* ===== FORM CONTROLS ===== */
.form-label-custom { font-weight: 600; font-size: 0.85rem; color: #374151; margin-bottom: 6px; display: block; }
.form-control-custom {
    border: 1.5px solid #E5E7EB;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.95rem;
    transition: var(--transition);
    width: 100%;
    outline: none;
    font-family: inherit;
}
.form-control-custom:focus { border-color: var(--color-primario); box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12); }
.input-icon-wrapper { position: relative; }
.input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #9CA3AF; font-size: 1.1rem; pointer-events: none; }
.input-icon-wrapper .form-control-custom { padding-left: 42px; }

/* ===== BOTONES ===== */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--color-primario), var(--color-secundario));
    color: white;
    border: none;
    border-radius: 10px;
    padding: 13px 24px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    font-family: inherit;
}
.btn-primary-custom:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--color-btn-hover), var(--color-primario));
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(21, 101, 192, 0.3);
}
.btn-primary-custom:disabled { opacity: 0.7; cursor: not-allowed; }

.btn-outline-custom {
    background: transparent;
    color: var(--color-primario);
    border: 1.5px solid var(--color-primario);
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.btn-outline-custom:hover { background: var(--color-primario); color: white; }

.btn-danger-custom {
    background: #EF4444;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.btn-danger-custom:hover { background: #DC2626; }

/* ===== ALERTAS ===== */
.alert-error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 10px;
    color: #991B1B;
    padding: 12px 16px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.alert-success {
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    border-radius: 10px;
    color: #166534;
    padding: 12px 16px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

/* ===== TABLA ===== */
.table-custom { width: 100%; border-collapse: collapse; }
.table-custom th {
    background: var(--color-fondo);
    color: var(--color-primario);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid #E5E7EB;
}
.table-custom td { padding: 14px 16px; border-bottom: 1px solid #F3F4F6; font-size: 0.9rem; color: #374151; }
.table-custom tr:hover td { background: #F8FAFF; }

/* ===== BADGES ===== */
.badge-pendiente { background: #FEF3C7; color: #92400E; }
.badge-aprobado  { background: #D1FAE5; color: #065F46; }
.badge-rechazado { background: #FEE2E2; color: #991B1B; }
.badge-cancelado { background: #F3F4F6; color: #6B7280; }
.badge-estado { padding: 4px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }

/* ===== SPINNER ===== */
.spinner-wrapper { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 200px; gap: 16px; color: var(--color-primario); }
.spinner-border-custom { width: 3rem; height: 3rem; border: 4px solid rgba(21, 101, 192, 0.2); border-top-color: var(--color-primario); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== BOLETA ===== */
.boleta-header { background: linear-gradient(135deg, var(--color-primario), var(--color-acento)); color: white; padding: 24px; border-radius: var(--border-radius) var(--border-radius) 0 0; }
.boleta-total { background: var(--color-fondo); border-radius: 10px; padding: 16px 20px; }
.boleta-total .monto-neto { font-size: 1.8rem; font-weight: 700; color: var(--color-primario); }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 48px 24px; color: #9CA3AF; }
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; }
.empty-state p { font-size: 0.95rem; }

/* ===== VALIDATION ===== */
.validation-message, .field-validation-error { color: #EF4444; font-size: 0.82rem; margin-top: 4px; display: block; }
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #EF4444; }

/* ===== BLAZOR UI ===== */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.loading-progress { position: relative; display: block; width: 8rem; height: 8rem; margin: 20vh auto 1rem auto; }
.loading-progress circle { fill: none; stroke: #e0e0e0; stroke-width: 0.6rem; transform-origin: 50% 50%; transform: rotate(-90deg); }
.loading-progress circle:last-child { stroke: var(--color-primario); stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%; transition: stroke-dasharray 0.05s ease-in-out; }
.loading-progress-text { position: absolute; text-align: center; font-weight: bold; inset: calc(20vh + 3.25rem) 0 auto 0.2rem; }
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Cargando..."); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-260px); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .page-content { padding: 16px; }
    .modulos-grid { grid-template-columns: repeat(2, 1fr); }
    .login-card { padding: 32px 24px; }
}
@media (max-width: 480px) { .modulos-grid { grid-template-columns: 1fr; } }

.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; }
@media (max-width: 768px) { .sidebar-overlay.visible { display: block; } }

/* ===== KPI CARDS ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.kpi-card {
    border-radius: var(--border-radius);
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
    color: white;
}

.kpi-card::after {
    content: '';
    position: absolute;
    right: -16px;
    top: -16px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
}

.kpi-icon { font-size: 1.4rem; opacity: 0.85; }
.kpi-valor { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.kpi-label { font-size: 0.78rem; opacity: 0.85; font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; }

.kpi-azul    { background: linear-gradient(135deg, #1565C0, #1976D2); }
.kpi-verde   { background: linear-gradient(135deg, #2E7D32, #43A047); }
.kpi-celeste { background: linear-gradient(135deg, #0277BD, #29B6F6); }
.kpi-naranja { background: linear-gradient(135deg, #E65100, #FB8C00); }
.kpi-rojo    { background: linear-gradient(135deg, #B71C1C, #E53935); }

@media (max-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .kpi-valor { font-size: 1.3rem; }
}

/* ===== BADGES DE NOTIFICACIÓN ===== */
.nav-badge {
    background: #EF4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    margin-left: auto;
    min-width: 20px;
    text-align: center;
    line-height: 1.4;
}

.card-badge {
    background: #EF4444;
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    line-height: 1.4;
}

.topbar-notif {
    position: relative;
    cursor: default;
    color: #6B7280;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
}

.topbar-notif-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #EF4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid white;
}

/* ===== SUPERVISOR - MI EQUIPO ===== */
.solicitud-equipo-card {
    background: var(--color-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-card);
    border: 2px solid transparent;
    transition: var(--transition);
    overflow: hidden;
}

.solicitud-equipo-card.expanded {
    border-color: var(--color-acento);
}

.solicitud-equipo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #F3F4F6;
    flex-wrap: wrap;
    gap: 12px;
}

.solicitud-equipo-body {
    padding: 16px 20px;
}

.solicitud-respuesta-form {
    background: #F8FAFF;
    border-top: 2px solid var(--color-acento);
    padding: 20px;
}

.detalle-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 3px;
}

.detalle-valor { font-size: 0.9rem; color: #374151; }

.justificacion-box {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
}
.justificacion-aprobada { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.justificacion-rechazada { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }

.avatar-sm {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-acento);
    flex-shrink: 0;
}

.avatar-sm-initials {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primario), var(--color-acento));
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ===== JEFE INMEDIATO EN PERFIL ===== */
.jefe-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #F0F4F8;
    border-radius: 10px;
    padding: 14px 16px;
    border-left: 4px solid var(--color-primario);
}
.jefe-card img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.jefe-avatar {
    width: 48px; height: 48px; border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primario), var(--color-acento));
    color: white; font-weight: 700; font-size: 1rem;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.jefe-nombre { font-weight: 600; color: #1A202C; font-size: 0.95rem; }
.jefe-cargo  { font-size: 0.8rem; color: #6B7280; }

/* ===== FOTO DE PERFIL ===== */
.perfil-foto {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--color-acento);
    box-shadow: 0 4px 16px rgba(21, 101, 192, 0.2);
}

.perfil-avatar-grande {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primario), var(--color-acento));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 2rem;
    margin: 0 auto;
    box-shadow: 0 4px 16px rgba(21, 101, 192, 0.2);
}

/* ===== LOGOUT BUTTON ===== */
.btn-logout {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.9);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}
.btn-logout:hover { background: rgba(255,255,255,0.2); }
