/* ============================================================
   NUBE UOH — app.css
   ============================================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: Arial, sans-serif; background: #F5F5F5; }

/* ── Variables ── */
:root {
    --navbar-h: 85px;
    --footer-h: 130px;
    --sidebar-w: 80px;
}

/* ══════════════════════════════════
   NAVBAR
   ══════════════════════════════════ */
.navbar {
    height: var(--navbar-h);
    background: #333849;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 300;
}
.navbar-left { display: flex; align-items: center; color: white; gap: 4px; flex: 1; }
.navbar-left h1 { font-size: 24px; white-space: nowrap; }
.logo { position: relative; width: 180px; height: 80px; flex-shrink: 0; }
.logo img { position: absolute; width: 80%; height: auto; top: 50%; left: 40%; transform: translate(-50%, -50%); }

/* Botón hamburguesa — OCULTO en desktop */
.navbar-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    flex-shrink: 0;
    margin-right: 8px;
    transition: background 0.15s;
}
.navbar-hamburger:hover { background: rgba(255,255,255,0.1); }
.navbar-hamburger span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: white;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}
.navbar-hamburger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.navbar-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.navbar-hamburger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* ══════════════════════════════════
   LAYOUT: sidebar + content lado a lado
   ══════════════════════════════════ */
.main-container {
    display: flex;
    /* Se estira para cubrir el espacio entre navbar y footer */
    min-height: calc(100vh - var(--navbar-h) - var(--footer-h));
    /* El fondo gris del layout */
    background: #e1e1e1;
    position: relative;
}

/* ══════════════════════════════════
   SIDEBAR — Desktop
   ══════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    /* Ocupa todo el alto del main-container gracias a align-items: stretch del flex */
    flex-shrink: 0;
    background: white;
    border-right: 1px solid #DADADA;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 0;
    /* Sticky para que acompañe el scroll */
    position: sticky;
    top: var(--navbar-h);
    /* Alto: total viewport menos navbar, sticky dentro del flex */
    height: calc(100vh - var(--navbar-h));
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

/* Links del sidebar */
.sidebar-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    padding: 10px 8px;
    border-radius: 12px;
    width: 64px;
    transition: background 0.15s, transform 0.15s;
    position: relative;
}
.sidebar-link:hover  { background: #f0f4f0; transform: scale(1.05); }
.sidebar-link.active { background: #e8f3ec; }
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 20%;
    height: 60%;
    width: 3px;
    background: #4E7A5C;
    border-radius: 0 3px 3px 0;
}

/* Imágenes: tamaño legible para íconos logotipo */
.sidebar-link img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    transition: transform 0.2s ease;
    display: block;
}
.sidebar-link:hover img { transform: scale(1.1); }

/* Etiqueta bajo el ícono */
.sidebar-label {
    font-size: 10px;
    color: #6B7280;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.sidebar-link.active .sidebar-label { color: #4E7A5C; }

/* Boton de usuario en header */
.navbar-right{
    margin-left: auto;
    display: flex;
    align-items: center;
}

.user-menu{
    position: relative;
}

.user-menu-toggle{
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #e1e1e1;
}

.user-menu-toggle:hover{
    background: #454c63;
}

.user-menu-dropdown{
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: none;
    min-width: 180px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.15);
    overflow: hidden;
    z-index: 1000;
}

.user-menu-dropdown.open{
    display: block;
}

.user-menu-dropdown a, .user-menu-dropdown button{
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: white;
    text-align: left;
    text-decoration: none;
    color: #333;
    cursor: pointer;
    font-size: 14px;
}

.user-menu-dropdown a:hover, .user-menu-dropdown button:hover{
    background: #f5f5f5;
}

/* ══════════════════════════════════
   CONTENIDO
   ══════════════════════════════════ */
.content {
    flex: 1;
    padding: 40px;
    min-width: 0; /* evita overflow en flex */
}

/* ══════════════════════════════════
   FOOTER
   ══════════════════════════════════ */
.footer {
    height: var(--footer-h);
    background: #1E212B;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    gap: 16px;
}

/* ══════════════════════════════════
   OVERLAY (mobile)
   ══════════════════════════════════ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 200;
}
.sidebar-overlay.open { display: block; }

/* ══════════════════════════════════
   DEV MENU
   ══════════════════════════════════ */
.dev-menu { position: relative; }
.dev-menu-toggle { background: #ff6b35; color: white; border: none; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: bold; cursor: pointer; white-space: nowrap; transition: background 0.15s; }
.dev-menu-toggle:hover { background: #e55a25; }
.dev-menu-dropdown { display: none; position: absolute; top: calc(100% + 8px); right: 0; background: #1e2535; border: 1px solid #3a4460; border-radius: 10px; min-width: 200px; padding: 8px; z-index: 9999; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.dev-menu-dropdown.open { display: flex; flex-direction: column; gap: 2px; }
.dev-menu-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #6b7280; padding: 10px 8px 4px; font-weight: 600; display: block; }
.dev-menu-label:first-child { padding-top: 4px; }
.dev-menu-dropdown a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px; color: #cbd5e0; font-size: 14px; text-decoration: none; transition: background 0.12s, color 0.12s; }
.dev-menu-dropdown a:hover { background: rgba(255,255,255,0.08); color: white; }

/* ══════════════════════════════════
   LOGIN: sin sidebar
   ══════════════════════════════════ */
body.page-login .sidebar  { display: none; }
body.page-login .content  { padding: 0; }

/* ══════════════════════════════════
   TABLET (≤ 1024px)
   ══════════════════════════════════ */
@media (max-width: 1024px) {
    .navbar  { padding: 0 20px; }
    .logo    { width: 130px; }
    .content { padding: 28px 20px; }
    .footer  { padding: 0 24px; }
    .sidebar { width: 70px; }
    .sidebar-link { width: 56px; }
    .sidebar-link img { width: 30px; height: 30px; }
}

/* ══════════════════════════════════
   MOBILE (≤ 768px)
   ══════════════════════════════════ */
@media (max-width: 768px) {
    :root { --navbar-h: 60px; --footer-h: 110px; }

    /* Navbar compacto */
    .navbar           { padding: 0 14px; }
    .navbar-left h1   { font-size: 18px; }
    .logo             { width: 90px; height: 55px; }

    /* Hamburguesa visible en mobile */
    .navbar-hamburger { display: flex; }

    /* Dev menu: dropdown a la izquierda para no salirse */
    .dev-menu-dropdown { right: auto; left: 0; }

    /* Sidebar: drawer desde la izquierda, oculto por defecto */
    .sidebar {
        position: fixed;
        top: var(--navbar-h);
        left: 0;
        bottom: 0;
        width: 210px;
        height: calc(100vh - var(--navbar-h));
        z-index: 250;
        transform: translateX(-100%);  /* oculto */
        flex-direction: column;
        align-items: flex-start;
        padding: 16px 10px;
        gap: 4px;
        box-shadow: 4px 0 24px rgba(0,0,0,0.2);
        overflow-y: auto;
    }
    /* Abierto al pulsar hamburguesa */
    .sidebar.open { transform: translateX(0); }

    /* Link horizontal en mobile */
    .sidebar-link {
        flex-direction: row;
        width: 100%;
        gap: 14px;
        padding: 12px 14px;
        border-radius: 10px;
    }
    .sidebar-link::before { display: none; }
    .sidebar-link img { width: 28px; height: 28px; flex-shrink: 0; }
    .sidebar-label { font-size: 14px; color: #374151; font-weight: 500; letter-spacing: 0; white-space: normal; }
    .sidebar-link.active .sidebar-label { color: #4E7A5C; font-weight: 700; }

    /* Content ocupa todo el ancho */
    .content { padding: 16px 14px 32px; }

    /* Footer apilado */
    .footer { height: auto; flex-direction: column; text-align: center; padding: 20px 16px; gap: 12px; }
}

/* ══════════════════════════════════
   SMALL MOBILE (≤ 480px)
   ══════════════════════════════════ */
@media (max-width: 480px) {
    .navbar-left h1 { font-size: 16px; }
    .logo           { width: 70px; }
    .content        { padding: 12px 10px 24px; }
}
