﻿/* ═══════════════════════════════════════════
   CA&PE — MENÚ PRINCIPAL — VERSIÓN DEFINITIVA
═══════════════════════════════════════════ */
:root {
    --navy: #0A1B4B;
    --navy-dark: #071232;
    --navy-mid: #1a3a8f;
    --red: #D40000;
    --sidebar-w: 240px;
    --sidebar-w-collapsed: 64px;
    --topbar-h: 56px;
    --transition: .3s cubic-bezier(.4,0,.2,1);
}

/* ── Reset global ──────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#app {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ── Shell ─────────────────────────────── */
.app-shell {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* ── Sidebar ───────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
    border-right: 1px solid rgba(255,255,255,.07);
    display: flex;
    flex-direction: column;
    transition: width var(--transition);
    z-index: 100;
    overflow: hidden;
}

    .sidebar.collapsed {
        width: var(--sidebar-w-collapsed);
    }

/* ── App body — CLAVE: position fixed ─── */
.app-body {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    transition: left var(--transition);
    overflow: hidden;
    background: #f1f5f9;
}

    .app-body.expanded {
        left: var(--sidebar-w-collapsed);
    }

/* ── Topbar ────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    width: 100%;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    z-index: 50;
}

/* ── Main content ──────────────────────── */
.main-content {
    flex: 1;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f1f5f9;
}

/* ── Logo ──────────────────────────────── */
.sidebar-logo {
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    align-items: baseline;
    gap: 1px;
    white-space: nowrap;
}

.logo-ca, .logo-pe {
    color: #fff;
    font-family: 'Arial Black', sans-serif;
    font-weight: 900;
    font-size: 22px;
}

.logo-amp {
    color: var(--red);
    font-weight: 900;
    font-size: 22px;
}

.logo-sac {
    color: rgba(255,255,255,.4);
    font-size: 10px;
    font-weight: 600;
    margin-left: 4px;
}

.logo-mini {
    color: var(--red);
    font-family: 'Arial Black', sans-serif;
    font-weight: 900;
    font-size: 16px;
    white-space: nowrap;
}

.toggle-btn {
    background: rgba(255,255,255,.08);
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    font-weight: 700;
    transition: background .2s;
    flex-shrink: 0;
    line-height: 1;
}

    .toggle-btn:hover {
        background: rgba(255,255,255,.15);
    }

/* ── Nav ───────────────────────────────── */
.nav-section-label {
    padding: 12px 20px 4px;
    font-size: 10px;
    color: rgba(255,255,255,.35);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    white-space: nowrap;
}

.nav-items {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    border: none;
    border-left: 3px solid transparent;
    background: transparent;
    color: rgba(255,255,255,.6);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    font-weight: 400;
    transition: all .18s;
    border-radius: 0 8px 8px 0;
    margin-bottom: 2px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
}

.nav-item:hover {
    background: rgba(255,255,255,.07);
    color: #fff;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(212,0,0,.18) 0%, rgba(212,0,0,.05) 100%);
    border-left: 3px solid var(--red);
    color: #fff;
    font-weight: 600;
}

.nav-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.nav-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.active-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--red);
    flex-shrink: 0;
    margin-left: auto;
}

.sidebar-footer {
    padding: 12px 20px;
    font-size: 10px;
    color: rgba(255,255,255,.2);
    border-top: 1px solid rgba(255,255,255,.06);
    white-space: nowrap;
    overflow: hidden;
}

/* ── Topbar elementos ──────────────────── */
.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb-home {
    color: #94a3b8;
    font-size: 13px;
}

.breadcrumb-sep {
    color: #cbd5e1;
    font-size: 13px;
}

.breadcrumb-current {
    color: var(--navy);
    font-weight: 600;
    font-size: 13px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    text-align: right;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    display: block;
}

.user-role {
    font-size: 11px;
    color: #94a3b8;
    display: block;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy), var(--navy-mid));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fff5f5;
    color: var(--red);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    transition: background .2s;
}

    .logout-btn:hover {
        background: #fee2e2;
    }

/* ── Dashboard ─────────────────────────── */
.dashboard-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #050d2a;
}

.dashboard-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.bg-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.dashboard-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 600px;
    padding: 40px 20px;
}

.dashboard-icon {
    font-size: 72px;
    line-height: 1;
    margin-bottom: 16px;
}

.dashboard-title {
    font-family: 'Arial Black', sans-serif;
    font-weight: 900;
    font-size: 56px;
    margin: 0 0 8px;
    background: linear-gradient(135deg, #fff 40%, var(--red) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dashboard-subtitle {
    color: rgba(255,255,255,.7);
    font-size: 16px;
    margin: 0 0 8px;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 600;
}

.dashboard-desc {
    color: rgba(255,255,255,.4);
    font-size: 14px;
    margin: 0 0 36px;
    line-height: 1.6;
}

.dashboard-cards {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.dash-card {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px;
    padding: 14px 22px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background .2s, transform .2s;
    backdrop-filter: blur(8px);
}

    .dash-card:hover {
        background: rgba(255,255,255,.14);
        transform: translateY(-2px);
    }

/* ── Responsive ────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-w-collapsed);
    }

        .sidebar .logo-text,
        .sidebar .nav-label,
        .sidebar .nav-section-label,
        .sidebar .sidebar-footer {
            display: none;
        }

        .sidebar .nav-item {
            justify-content: center;
            padding: 12px 0;
        }

    .app-body {
        left: var(--sidebar-w-collapsed) !important;
    }

    .topbar {
        padding: 0 16px;
    }

    .user-info {
        display: none;
    }
}
