﻿/* =========================================================
   EL FARO 2.0 - LAYOUT DEFINITIVO + TEMA CENTRALIZADO
   ========================================================= */

:root {
    /* =====================================================
       MEDIDAS (NO TOCAR)
       ===================================================== */
    --app-topbar-height-mobile: 48px;
    --app-topbar-height-desktop: 42px;
    --app-sidebar-width: 274px;
    /* =====================================================
       TEMA VERDE PRO CON FLOW 🌿🔥
       ===================================================== */
    /* BASE */
    --color-bg: #f3f5f6;
    --color-surface: #ffffff;
    --color-border: #d6e2dc;
    --color-border-soft: #e4efea;
    /* 🌿 VERDE */
    --color-primary: #2f855a; /* verde principal */
    --color-primary-dark: #1b4332; /* verde oscuro */
    --color-primary-soft: #e6f4ee; /* fondo activo */
    --color-primary-hover: #d1ebe0; /* hover */
    /* TEXTO */
    --color-text: #1f2937;
    --color-text-soft: #6b7280;
    /* TOPBAR (🔥 muy importante) */
    --color-topbar-gradient-start: #1b4332;
    --color-topbar-gradient-end: #2f855a;
    /* SIDEBAR */
    --color-sidebar-header-bg: #f4faf7;
    --color-sidebar-header-text: #2f855a;
    --color-sidebar-title: #4b6b5a;
    /* SOMBRAS */
    --app-transition: 0.25s ease;
    --app-shadow-topbar: 0 2px 10px rgba(0, 0, 0, 0.12);
    --app-shadow-sidebar-mobile: 14px 0 30px rgba(0, 0, 0, 0.18);
}

/* =========================================================
   RESET BASE
   ========================================================= */

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--color-bg);
    color: var(--color-text);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* =========================================================
   ESTRUCTURA GENERAL
   ========================================================= */

.layout-app {
    min-height: 100vh;
    background: var(--color-bg);
}

.layout-main {
    width: 100%;
    min-height: 100vh;
    background: var(--color-bg);
}

.layout-content {
    width: 100%;
    max-width: 100%;
    min-height: calc(100vh - var(--app-topbar-height-mobile));
    padding: 18px 16px 24px;
    background: var(--color-bg);
}

/* =========================================================
   CONTROL DE MENU
   ========================================================= */

.menu-toggle-elfaro {
    display: none;
}

/* =========================================================
   TOPBAR
   ========================================================= */

.topbar-elfaro {
    position: sticky;
    top: 0;
    z-index: 1200;
    height: var(--app-topbar-height-desktop);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    background: linear-gradient(90deg, var(--color-topbar-gradient-start) 0%, var(--color-topbar-gradient-end) 100%);
    color: #ffffff;
    border-bottom: 1px solid #0d1117;
    box-shadow: var(--app-shadow-topbar);
}

.topbar-elfaro-left,
.topbar-elfaro-center,
.topbar-elfaro-right {
    display: flex;
    align-items: center;
    min-width: 0;
    height: 100%;
}

.topbar-elfaro-left {
    justify-content: flex-start;
    gap: 10px;
}

.topbar-elfaro-center {
    justify-content: center;
    overflow: hidden;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.topbar-elfaro-right {
    justify-content: flex-end;
    gap: 10px;
}

.topbar-elfaro-brand {
    display: inline-flex;
    align-items: center;
    color: #ffffff;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1;
    white-space: nowrap;
}

    .topbar-elfaro-brand:hover {
        color: #ffffff;
        text-decoration: none;
    }

/* =========================================================
   USUARIO TOPBAR
   ========================================================= */

.topbar-elfaro-user {
    display: inline-flex;
    align-items: center;
    gap: 0;
    font-size: 0.90rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1;
    white-space: nowrap;
}

    .topbar-elfaro-user .bi {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.85rem;
        line-height: 1;
        margin: 0;
        padding: 0;
    }

        .topbar-elfaro-user .bi::before {
            display: block;
            line-height: 1;
            margin-right: 5px;
            padding: 0;
            top: -1px;
        }

    .topbar-elfaro-user span {
        display: block;
        line-height: 1;
        margin: 0;
        padding: 0;
    }

/* =========================================================
   FECHA TOPBAR
   ========================================================= */

.fecha-escritorio-elfaro {
    display: inline;
}

.fecha-movil-elfaro {
    display: none;
}

/* =========================================================
   BOTON MENU MOVIL
   ========================================================= */

.menu-button-elfaro {
    width: 34px;
    height: 34px;
    margin: 0;
    flex-shrink: 0;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    transition: background var(--app-transition), border-color var(--app-transition), transform var(--app-transition);
}

    .menu-button-elfaro:hover {
        background: rgba(255, 255, 255, 0.10);
        border-color: rgba(255, 255, 255, 0.24);
    }

    .menu-button-elfaro span {
        display: block;
        width: 15px;
        height: 2px;
        background: #ffffff;
        border-radius: 2px;
    }

/* =========================================================
   OVERLAY MOVIL
   ========================================================= */

.menu-overlay-elfaro {
    position: fixed;
    inset: 0;
    z-index: 1290;
    background: rgba(7, 10, 14, 0.40);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--app-transition), visibility var(--app-transition);
}

/* =========================================================
   SIDEBAR / PANEL LATERAL
   ========================================================= */

.menu-panel-elfaro {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1300;
    width: min(var(--app-sidebar-width), 84vw);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    box-shadow: var(--app-shadow-sidebar-mobile);
    transform: translateX(-100%);
    transition: transform 0.28s ease;
}

/* =========================================================
   CABECERA SIDEBAR
   ========================================================= */

.menu-panel-header-elfaro {
    height: var(--app-topbar-height-mobile);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    flex-shrink: 0;
    background: linear-gradient(90deg, var(--color-topbar-gradient-start) 0%, var(--color-topbar-gradient-end) 100%);
    color: #ffffff;
    border-bottom: 1px solid #0d1117;
}

.menu-panel-title-elfaro {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.menu-close-elfaro {
    position: relative;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    transition: background var(--app-transition), border-color var(--app-transition);
}

    .menu-close-elfaro:hover {
        background: rgba(255, 255, 255, 0.10);
        border-color: rgba(255, 255, 255, 0.24);
    }

    .menu-close-elfaro span {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 14px;
        height: 2px;
        background: #ffffff;
        border-radius: 2px;
    }

        .menu-close-elfaro span:first-child {
            transform: translate(-50%, -50%) rotate(45deg);
        }

        .menu-close-elfaro span:last-child {
            transform: translate(-50%, -50%) rotate(-45deg);
        }

/* =========================================================
   ENLACES SIDEBAR
   ========================================================= */

.menu-links-elfaro {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    padding: 14px 10px 18px;
}

.menu-link-elfaro {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background var(--app-transition), color var(--app-transition), transform var(--app-transition);
}

    .menu-link-elfaro:hover {
        background: var(--color-primary-hover);
        color: var(--color-primary-dark);
        text-decoration: none;
    }

    .menu-link-elfaro.active {
        background: var(--color-primary-soft);
        color: var(--color-primary-dark);
        font-weight: 700;
    }

    .menu-link-elfaro .bi {
        width: 18px;
        flex-shrink: 0;
        text-align: center;
        font-size: 1rem;
    }

    .menu-link-elfaro.active::before {
        content: "";
        position: absolute;
        left: 0;
        width: 4px;
        height: 60%;
        background: var(--color-primary);
        border-radius: 0 4px 4px 0;
    }

/* =========================================================
   PIE SIDEBAR
   ========================================================= */

.menu-footer-elfaro {
    flex-shrink: 0;
    padding: 12px 10px 28px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border-soft);
}

.menu-link-elfaro-logout {
    color: #374151;
}

    .menu-link-elfaro-logout:hover {
        background: #eceff3;
        color: #111827;
    }

/* =========================================================
   ESTADO ABIERTO MENU MOVIL
   ========================================================= */

.menu-toggle-elfaro:checked ~ .menu-overlay-elfaro {
    opacity: 1;
    visibility: visible;
}

.menu-toggle-elfaro:checked ~ .menu-panel-elfaro {
    transform: translateX(0);
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 991.98px) {
    .layout-content {
        padding: 18px 14px 24px;
    }

    .topbar-elfaro-brand {
        font-size: 0.88rem;
    }

    .topbar-elfaro-center {
        font-size: 0.80rem;
    }

    .topbar-elfaro-user {
        font-size: 0.84rem;
    }
}

/* =========================================================
   MOVIL
   ========================================================= */

@media (max-width: 767.98px) {
    .topbar-elfaro {
        grid-template-columns: auto 1fr auto;
        gap: 8px;
        padding: 0 10px;
        height: var(--app-topbar-height-mobile);
    }

    .topbar-elfaro-left {
        gap: 0;
    }

    .topbar-elfaro-brand {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.78rem;
    }

    .topbar-elfaro-center {
        padding: 0 6px;
        font-size: 0.72rem;
    }

    .topbar-elfaro-right {
        gap: 8px;
    }

    .topbar-elfaro-user {
        gap: 4px;
        font-size: 0.76rem;
    }

        .topbar-elfaro-user .bi {
            font-size: 0.80rem;
        }

    .fecha-escritorio-elfaro {
        display: none;
    }

    .fecha-movil-elfaro {
        display: inline;
    }

    .menu-button-elfaro {
        width: 30px;
        height: 30px;
        order: 2;
    }

        .menu-button-elfaro span {
            width: 13px;
        }

    .layout-content {
        padding: 16px 10px 22px;
    }
}

@media (max-width: 575.98px) {
    .topbar-elfaro {
        padding: 0 8px;
    }

    .topbar-elfaro-brand {
        max-width: 100px;
        font-size: 0.74rem;
    }

    .topbar-elfaro-center {
        padding: 0 4px;
        font-size: 0.70rem;
    }

    .topbar-elfaro-user {
        font-size: 0.70rem;
    }

        .topbar-elfaro-user .bi {
            font-size: 0.74rem;
        }
}

/* =========================================================
   ESCRITORIO
   ========================================================= */

@media (min-width: 992px) {
    .topbar-elfaro {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: var(--app-topbar-height-desktop);
        padding: 0 18px;
    }

    .topbar-elfaro-center {
        font-size: 0.88rem;
        font-weight: 700;
    }

    .topbar-elfaro-user {
        font-size: 0.84rem;
    }

    .menu-button-elfaro,
    .menu-overlay-elfaro,
    .menu-close-elfaro {
        display: none !important;
    }

    .menu-panel-elfaro {
        top: var(--app-topbar-height-desktop);
        z-index: 1100;
        width: var(--app-sidebar-width);
        height: calc(100vh - var(--app-topbar-height-desktop));
        transform: translateX(0);
        box-shadow: none;
    }

    .menu-panel-header-elfaro {
        height: 46px;
        padding: 0 16px;
        background: var(--color-sidebar-header-bg);
        color: var(--color-sidebar-header-text);
        border-bottom: 1px solid var(--color-border);
    }

    .menu-panel-title-elfaro {
        font-size: 0.82rem;
        font-weight: 800;
        letter-spacing: 0.6px;
        text-transform: uppercase;
        color: var(--color-sidebar-title);
    }

    .layout-main {
        padding-top: var(--app-topbar-height-desktop);
        padding-left: var(--app-sidebar-width);
    }

    .layout-content {
        min-height: calc(100vh - var(--app-topbar-height-desktop));
        padding: 18px 20px 26px;
    }
}

/* =========================================================
   MENÚ LATERAL - ESTRUCTURA
   ========================================================= */

.menu-panel-elfaro {
    display: flex;
    flex-direction: column;
}

.menu-links-elfaro {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 16px;
}

.menu-footer-elfaro {
    flex-shrink: 0;
    background: inherit;
}

/* =========================================================
   MENÚ LATERAL - MÓVIL / SAFARI / IPHONE
   ========================================================= */

@media (max-width: 991.98px) {

    .menu-panel-elfaro {
        height: 100dvh;
        max-height: 100dvh;
    }

    .menu-footer-elfaro {
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
    }
}

/* =========================================================
   AVISOS SONOROS
   ========================================================= */

.avisos-sonoros-bar {
    position: fixed;
    top: 12px;
    right: 14px;
    z-index: 3000;
}

.avisos-sonoros-btn {
    border-radius: 999px;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
}
