/* public/css/layout.css */

/* Tipografía base */
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 16px;
    background-color: #f5f5f7;
    color: #333333;
}

/* Contenedor general */
.layout-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* TOPNAV A TODO LO ANCHO */
.topnav {
    height: 56px;
    background-color: #ffffff;
    border-bottom: 1px solid #e1e4ea;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-sizing: border-box;
}

.topnav-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topnav-btn {
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
}

.topnav-title {
    font-size: 18px;
    font-weight: 600;
    color: #2f3a4c;
}

.topnav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topnav-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-name {
    font-size: 14px;
    color: #555f6f;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #4a90e2;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

/* LOGO EN ESQUINA SUPERIOR DERECHA */
.topnav-logo {
    width: 80px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #d0d6e3;
    background-color: #f5f7fb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #3a7bd5;
}

/* CUERPO: SIDEBAR + CONTENIDO EN FILA */
.body-wrapper {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* Sidebar izquierdo */
.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #4a90e2, #3a7bd5);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.logo-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: #ffffff;
    color: #3a7bd5;
    font-weight: 700;
    margin-right: 8px;
    font-size: 18px;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Ítem principal (vale para enlaces y botones) */
.nav-item {
    text-decoration: none;
    color: #e9f2ff;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 15px;
    display: block;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.18);
}

.nav-item.active {
    background-color: #ffffff;
    color: #3a7bd5;
    font-weight: 600;
}

/* Grupo con submenú (Procesar / Analizar Archivos) */
.nav-group {
    margin-top: 6px;
}

/* Padre del submenú desplegable */
.nav-item-parent {
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Botón de despliegue (clase especial para JS) */
.nav-toggle {
    width: 100%;
}

/* Icono de desplegable */
.nav-chevron {
    font-size: 12px;
    opacity: 0.9;
    transition: transform 0.2s ease;
}

/* Submenú oculto por defecto */
.nav-submenu {
    margin-left: 12px;
    margin-top: 2px;
    display: none;
    flex-direction: column;
    gap: 3px;
}

/* Subitems del menú */
.nav-subitem {
    text-decoration: none;
    color: #f4f7ff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 14px;
    display: block;
}

.nav-subitem:hover {
    background-color: rgba(255, 255, 255, 0.16);
}

/* Cuando el grupo está abierto */
.nav-group.open .nav-submenu {
    display: flex;
}

.nav-group.open .nav-chevron {
    transform: rotate(180deg);
}

/* Área principal */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Contenido */
.content {
    padding: 20px;
    box-sizing: border-box;
}

/* Responsivo básico */
@media (max-width: 768px) {
    .body-wrapper {
        flex-direction: row;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 56px; /* debajo del topnav */
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 1000;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    .main-area {
        flex: 1;
    }
}
