﻿/* =========================================================
   ASISTENCIA - LAYOUT PRINCIPAL
========================================================= */

:root {
    --sidebar-width: 256px;
    --topbar-height: 76px;
    --gsk-primary-dark: #08172C;
    --gsk-primary: #0B1F3A;
    --gsk-primary-light: #214F88;
    --gsk-background: #F5F7FB;
    --gsk-sidebar-width: 256px;
    --gsk-sidebar-collapsed-width: 82px;
    --gsk-topbar-height: 76px;
}


/* =========================================================
   CONTENEDOR GENERAL
========================================================= */

.app-container {
    --current-sidebar-width: var(--gsk-sidebar-width);
    width: 100%;
    min-height: 100vh;
    background: var(--gsk-background);
}
    /* Cuando se contrae */

    .app-container.sidebar-collapsed {
        --current-sidebar-width: var(--gsk-sidebar-collapsed-width);
    }

    /* =========================================================
   SIDEBAR
========================================================= */

    .app-container .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: var(--current-sidebar-width);
        height: 100vh;
        margin: 0;
        padding: 0;
        background: linear-gradient( 180deg, #08172C 0%, #0B1F3A 55%, #153967 100% );
        color: white;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
        z-index: 2000;
        box-shadow: 4px 0 20px rgba(0,0,0,.10);
        transition: width .25s ease;
    }
/* =========================================================
   TITULOS TOPBAR
========================================================= */

.desktop-system-title {
    display: flex;
    flex-direction: column;
}


.mobile-system-title {
    display: none;
}
/* =========================================================
   SIDEBAR CONTRAÍDO
========================================================= */

.sidebar-collapsed .sidebar .brand-text {
    display: none !important;
}


.sidebar-collapsed .sidebar .brand {
    padding: 10px;
}

    /* Protección adicional */

    .sidebar-collapsed .sidebar .brand strong,
    .sidebar-collapsed .sidebar .brand small {
        display: none !important;
    }
.sidebar-collapsed .brand-logo-full {
    display: none;
}


.sidebar-collapsed .brand-logo-icon {
    display: block;
    width: 48px;
    height: 48px;
}
/* Centrar el guepardo */

.sidebar-collapsed .sidebar .logo {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    overflow: visible;
}


.sidebar-collapsed .sidebar nav {
    padding-left: 10px;
    padding-right: 10px;
}


    .sidebar-collapsed .sidebar nav a {
        justify-content: center;
        padding-left: 10px;
        padding-right: 10px;
        gap: 0;
    }


        .sidebar-collapsed .sidebar nav a i {
            width: auto;
            min-width: 0;
            margin: 0;
            font-size: 20px;
        }


        .sidebar-collapsed .sidebar nav a span {
            display: none;
        }


.sidebar-collapsed .sidebar .logout {
    padding-left: 10px;
    padding-right: 10px;
}


    .sidebar-collapsed .sidebar .logout button {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px;
    }


        .sidebar-collapsed .sidebar .logout button span {
            display: none;
        }

/* =========================================================
   BRAND / LOGO
========================================================= */

.app-container .sidebar .brand {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    box-sizing: border-box;
    overflow: hidden;
    border-bottom: 1px solid rgba(255,255,255,.08);
}


/* Logo general */

.brand-logo {
    display: block;
    object-fit: contain;
}


/* Logo completo - SIDEBAR ABIERTO */

.brand-logo-full {
    display: block;
    width: 215px;
    height: auto;
    max-width: 100%;
    max-height: 80px;
    object-fit: contain;
}


/* Logo pequeño oculto normalmente */

.brand-logo-icon {
    display: none;
}

        /* =========================================================
   NAVEGACIÓN
========================================================= */

        .app-container .sidebar nav {
            flex: 1;
            width: 100%;
            padding: 24px 14px;
            box-sizing: border-box;
        }


            .app-container .sidebar nav a {
                position: relative;
                width: 100%;
                min-height: 46px;
                box-sizing: border-box;
                display: flex;
                align-items: center;
                gap: 14px;
                padding: 12px 16px;
                margin: 4px 0;
                border-radius: 10px;
                color: rgba(255,255,255,.88);
                text-decoration: none;
                font-size: 15px;
                font-weight: 500;
                transition: background .2s ease, color .2s ease;
            }


                .app-container .sidebar nav a i {
                    width: 22px;
                    min-width: 22px;
                    text-align: center;
                    font-size: 19px;
                }


                .app-container .sidebar nav a:hover {
                    background: rgba(255,255,255,.08);
                    color: white;
                }


                .app-container .sidebar nav a.active {
                    background: linear-gradient( 135deg, #1F65B5, #286FC1 );
                    color: white;
                    font-weight: 600;
                    box-shadow: 0 5px 15px rgba(0,0,0,.15);
                }


                    .app-container .sidebar nav a.active::before {
                        content: "";
                        position: absolute;
                        left: 0;
                        top: 8px;
                        bottom: 8px;
                        width: 3px;
                        border-radius: 0 4px 4px 0;
                        background: white;
                    }


        /* =========================================================
   LOGOUT
========================================================= */

        .app-container .sidebar .logout {
            width: 100%;
            padding: 18px 14px 20px;
            box-sizing: border-box;
            border-top: 1px solid rgba(255,255,255,.08);
        }


            .app-container .sidebar .logout button {
                width: 100%;
                min-height: 44px;
                border: none;
                border-radius: 10px;
                background: rgba(255,255,255,.07);
                color: rgba(255,255,255,.85);
            }


                .app-container .sidebar .logout button:hover {
                    background: rgba(220,53,69,.15);
                    color: #ffb3b3;
                }


    /* =========================================================
   MAIN
========================================================= */

    .app-container > main {
        position: relative;
        margin-left: var(--current-sidebar-width);
        width: calc(100% - var(--current-sidebar-width));
        min-height: 100vh;
        box-sizing: border-box;
        background: var(--gsk-background);
        transition: margin-left .25s ease, width .25s ease;
    }


        /* =========================================================
   TOPBAR
========================================================= */
.topbar {
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    background: white;
    border-bottom: 1px solid #E2E8F0;
    box-shadow: 0 2px 12px rgba(15,23,42,.06);
    box-sizing: border-box;
}


.system-title {
    display: flex;
    flex-direction: column;
    justify-content: center;
}


    .system-title h5 {
        margin: 0;
        color: #0B1F3A;
        font-size: 20px;
        font-weight: 700;
        line-height: 1.2;
    }


    .system-title span {
        margin-top: 4px;
        color: #64748B;
        font-size: 13px;
    }
.app-container > main > .topbar {
    position: fixed;
    top: 0;
    left: var(--current-sidebar-width);
    right: 0;
    width: calc(100% - var(--current-sidebar-width));
    height: var(--gsk-topbar-height);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    background: rgba(255,255,255,.98);
    border-bottom: 1px solid var(--gsk-border);
    box-shadow: var(--gsk-shadow-sm);
    z-index: 1500;
    transition: left .25s ease, width .25s ease;
}


        /* =========================================================
   CONTENIDO
========================================================= */

        .app-container > main > .content {
            position: relative;
            width: 100%;
            min-height: 100vh;
            box-sizing: border-box;
            padding: 30px;
            padding-top: calc(var(--topbar-height) + 30px);
            background: var(--gsk-background);
            overflow-x: hidden;
        }


/* =========================================================
   MENU INFERIOR
========================================================= */

.bottom-nav {
    display: none;
}

/* =========================================================
   TITULO TOPBAR
========================================================= */

.desktop-title {
    display: block;
}

.desktop-subtitle {
    display: block;
}

.mobile-title {
    display: none;
}
/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {

    :root {
        --topbar-height: 64px;
    }
    /* =========================================================
   BRAND MOBILE TOPBAR
========================================================= */

    .desktop-system-title {
        display: none;
    }


    .mobile-system-title {
        display: flex;
        align-items: center;
        gap: 9px;
    }


    .mobile-brand-logo {
        width: 45px;
        height: 45px;
        object-fit: contain;
    }


    .mobile-system-title strong {
        font-size: 17px;
        font-weight: 700;
        color: var(--gsk-primary);
        white-space: nowrap;
    }


    /* Sin hamburguesa en móvil */

    .menu-button {
        display: none !important;
    }
    /* =========================================================
   TOPBAR MOBILE
========================================================= */

    .menu-button {
        display: none !important;
    }


    .desktop-title,
    .desktop-subtitle {
        display: none !important;
    }


    .mobile-title {
        display: block;
        margin: 0;
        font-size: 18px;
        font-weight: 700;
        color: var(--gsk-primary);
        white-space: nowrap;
    }


    .topbar-left {
        gap: 0;
    }


    .system-title {
        display: flex;
        justify-content: center;
        flex-direction: column;
    }
    .app-container .sidebar {
        display: none !important;
    }


    .app-container > main {
        margin-left: 0 !important;
        width: 100% !important;
    }


        .app-container > main > .topbar {
            left: 0;
            width: 100%;
            height: var(--gsk-topbar-height);
            padding: 0 16px;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }


        .app-container > main > .content {
            padding: 20px 15px 90px;
            padding-top: calc(var(--topbar-height) + 20px);
        }


    .bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 68px;
        display: flex;
        align-items: center;
        justify-content: space-around;
        background: white;
        border-top: 1px solid #E2E8F0;
        box-shadow: 0 -4px 15px rgba(15,23,42,.08);
        z-index: 3000;
    }
}
/* =========================================================
   IZQUIERDA TOPBAR
========================================================= */

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}


/* =========================================================
   BOTÓN HAMBURGUESA
========================================================= */

.menu-button {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gsk-primary);
    font-size: 25px;
    cursor: pointer;
    transition: .2s ease;
}


    .menu-button:hover {
        background: #F1F5F9;
    }


    .menu-button:active {
        transform: scale(.96);
    }