
/* ==========================================================
   DASHBOARD LAYOUT
========================================================== */

.dashboard-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    align-items: start;
    min-height: calc(100vh - 42px);
    background: var(--color-bg);
}

.dashboard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px 12px;
    font-family: var(--font-sans);
    position: sticky;
    top: 14px;
    align-self: start;
    max-height: none;
    border-right: 1px solid rgba(47, 124, 255, .18);
    overflow: hidden;
    box-sizing: border-box;
}

.dashboard-main {
    padding: 16px;
    overflow-y: auto;
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 26;
    border: 1px solid rgba(47, 124, 255, .48);
    border-radius: var(--radius-lg);
    background: #0B1527;
    color: #DCE7FF;
    font-size: var(--text-xl);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .34), inset 0 1px 0 rgba(255, 255, 255, .08);
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
    border-color: var(--color-primary);
    background: #10213B;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .42), 0 0 0 3px rgba(47, 124, 255, .14);
}

.sidebar-toggle:active {
    transform: scale(.95);
}

.sidebar-drawer {
    display: block;
    min-height: 0;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 18;
    background: rgba(1, 4, 10, .72);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}

body.sidebar-open {
    overflow: hidden;
}

/* ==========================================================
   SIDEBAR CARDS
========================================================== */

.brand-header {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 2px 8px;
    margin-top: -4px;
}

.responsive-brand {
    display: none;
}

.brand-header .brand-title {
    margin: 0;
    color: var(--color-primary);
    font-family: var(--font-sans);
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: .9;
    display: flex;
    align-items: baseline;
    gap: 2px;
    flex-wrap: nowrap;
    white-space: nowrap;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(47, 124, 255, .18);
}

.brand-mark {
    display: inline;
    flex: 0 0 auto;
    font-size: var(--text-2xl);
    line-height: .9;
    margin-right: 2px;
    color: var(--color-primary);
    text-shadow: 0 0 22px rgba(47, 124, 255, .28);
}

.brand-name {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: baseline;
    font-size: inherit;
    letter-spacing: -1.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.brand-domain {
    display: inline;
    color: #FFFFFF;
    font-size: inherit;
    letter-spacing: -1.5px;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255, 255, 255, .12);
}

.brand-version {
    width: fit-content;
    padding: 0 0 0 32px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #8A93A6;
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: .7px;
    text-transform: none;
    position: relative;
    margin-top: 4px;
}

.brand-version::after {
    content: none;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    margin-left: 300px;
    padding: 8px 16px 12px;
    color: #748094;
    font-family: var(--font-sans);
}

.site-footer-signature {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    color: #748094;
    font-size: var(--text-xs);
    text-align: center;
}

.site-footer-signature i {
    color: var(--color-primary);
}

.site-footer-meta {
    display: none;
}

/* El footer global no debe desplazar el sidebar al final de la página. */
@media (min-width: 961px) {
    .dashboard-sidebar {
        position: fixed;
        top: 14px;
        left: 0;
        z-index: 10;
        width: 300px;
        max-height: calc(100vh - 28px);
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: none;
    }

    .dashboard-sidebar::-webkit-scrollbar {
        display: none;
    }

    .dashboard-main {
        grid-column: 2;
    }
}

@media (min-width: 961px) and (max-width: 1280px) {
    .dashboard-sidebar {
        width: 288px;
    }
}

/* ==========================================================
   RESPONSIVE
========================================================== */

@media (max-width: 1280px) {
    .dashboard-layout {
        grid-template-columns: 288px minmax(0, 1fr);
    }

    .site-footer {
        margin-left: 288px;
    }
}

@media (max-width: 960px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
        min-height: calc(100vh - 104px);
    }

    .dashboard-sidebar {
        gap: 12px;
        padding: 12px;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, .05);
    }

    .dashboard-main {
        padding: 80px 12px 12px;
    }

    .sidebar-toggle {
        display: inline-flex;
        top: 9px;
        left: auto;
        right: 14px;
        transform: none;
    }

    .sidebar-toggle:active {
        transform: scale(.95);
    }

    .brand-header .brand-title {
        font-size: 30px;
    }

    .brand-mark {
        font-size: var(--text-xl);
    }

    .sidebar-drawer {
        position: fixed;
        top: 68px;
        right: 14px;
        bottom: auto;
        z-index: 20;
        width: min(88vw, 320px);
        max-height: calc(100vh - 82px);
        min-width: 0;
        max-width: none;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-12px) scale(.97);
        transform-origin: top right;
        transition: transform .24s ease, opacity .24s ease, visibility .24s ease;
        box-shadow: 0 18px 42px rgba(0, 0, 0, .42);
        overflow-y: auto;
        padding-bottom: 16px;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-drawer > .brand-header {
        display: none;
    }

    .responsive-brand {
        display: flex;
        align-items: center;
        position: fixed;
        inset: 0 0 auto;
        min-height: 60px;
        padding: 8px 70px 8px 16px;
        z-index: 26;
        background: var(--color-bg);
        box-shadow: 0 8px 22px rgba(0, 0, 0, .24);
        pointer-events: none;
    }

    .responsive-brand::after {
        content: "";
        position: absolute;
        left: 50%;
        bottom: -1px;
        width: 42%;
        height: 2px;
        border-radius: 999px;
        background: linear-gradient(90deg, transparent, rgba(47, 124, 255, .62), transparent);
        box-shadow: 0 0 12px rgba(47, 124, 255, .24);
        transform: translateX(-50%);
    }

    .responsive-brand .brand-header {
        padding: 0;
        margin: 0;
    }

    .dashboard-layout.sidebar-open .sidebar-drawer {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }

    .site-footer {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
        min-height: 104px;
        margin-left: 0;
        padding: 16px 16px 20px;
        color: var(--color-text-subtle);
        font-family: var(--font-sans);
    }

    .site-footer-meta {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 16px;
    }

    .site-footer-socials {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .site-footer-socials a {
        display: grid;
        place-items: center;
        width: 28px;
        height: 28px;
        color: var(--color-text-subtle);
        font-size: var(--text-md);
        text-decoration: none;
        transition: color .2s ease, transform .2s ease;
    }

    .site-footer-socials a:hover {
        color: var(--color-primary);
        transform: translateY(-2px);
    }

    .site-footer-copy {
        margin: 0;
        color: var(--color-text-subtle);
        font-size: var(--text-xs);
        letter-spacing: .4px;
    }

    .dashboard-layout.sidebar-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Legibilidad y compactación definitivas del sidebar de escritorio */

/* Ajuste fiel a la referencia final del sidebar */

@keyframes sidebarPromptBlink {
    50% { opacity: 0; }
}

@media (max-width: 640px) {
    .dashboard-main {
        padding: 72px 12px 12px;
    }

    .dashboard-sidebar {
        gap: 8px;
    }

    .brand-header .brand-title {
        font-size: 28px;
    }

    .brand-mark {
        font-size: var(--text-xl);
    }

    .dashboard-sidebar {
        width: min(90vw, 320px);
        min-width: 0;
    }
}

/* ==========================================================
   MENÚ MÓVIL (el diseño del menú vive en sidebar.css)
========================================================== */

@media (max-width: 960px) {
    .sidebar-drawer {
        padding: 0;
        border: 1px solid rgba(80, 116, 171, .34);
        border-radius: var(--radius-xl);
        background: #050b16;
    }
}

@media (min-width: 961px) {
    /* Unifica el marco del sidebar con los paneles principales. */
    .dashboard-sidebar {
        border-right: 0;
    }
}
