/* layout.css - Estructura General y Navegación */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

/* --- SIDEBAR (Móvil Primero) --- */
.sidebar {
    width: 100%;
    height: 65px;
    background: var(--bg-card);
    display: flex;
    flex-direction: row;
    padding: 0 16px;
    border-right: none;
    border-top: 1px solid var(--border);
    order: 2; /* Mover al fondo */
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
}

.sidebar .logo {
    display: none; /* Ocultar logo en nav inferior */
}

.nav-links {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-item {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    gap: 4px;
    flex: 1;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-app);
    color: var(--text-main);
}

.nav-item.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent);
}

.nav-item.active i {
    color: var(--accent);
}

.nav-item.logout-item {
    color: var(--danger);
}

.nav-item i {
    width: 20px;
    height: 20px;
}

.nav-item span {
    font-size: 0.65rem;
}

.nav-footer {
    display: none; /* Ocultar pie en nav inferior */
}

/* --- MAIN CONTENT & VIEWS --- */
.main-content {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px; 
    padding-bottom: 120px;
    position: relative;
    width: 100%;
    max-width: 100%;
}

.view {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.view.active {
    display: block;
}

.view-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
    overflow: hidden;
}

.view-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    word-break: break-word;
}

@media (min-width: 768px) {
    .main-content {
        padding: 40px 60px;
    }
    .view-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 32px;
    }
    .view-header h1 {
        font-size: 2rem;
    }
}

/* --- DESKTOP UPGRADE (min-width: 1024px) --- */
@media (min-width: 1024px) {
    .app-container {
        flex-direction: row;
    }

    .sidebar {
        order: 0;
        width: 260px;
        height: 100vh;
        flex-direction: column;
        border-top: none;
        border-right: 1px solid var(--border);
        padding: 30px 24px;
        position: static;
    }

    .sidebar-top-status {
        background: #f8fafc;
        padding: 15px;
        border-radius: var(--radius-md);
        margin-bottom: 25px;
        border: 1px solid var(--border);
        display: block;
    }

    .status-clock {
        font-size: 1.2rem;
        font-weight: 800;
        color: var(--primary);
        font-family: 'Courier New', monospace;
        letter-spacing: 1px;
    }

    .status-greeting {
        font-size: 0.75rem;
        color: var(--text-muted);
        font-weight: 600;
        margin-top: 4px;
    }

    .sidebar .logo {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-bottom: 40px;
        gap: 10px;
    }
    
    .logo img {
        width: 100px;
        height: auto;
    }
    
    .logo-text {
        font-size: 1.5rem;
        font-weight: 800;
        color: var(--primary);
    }

    .nav-links {
        flex-direction: column;
        justify-content: flex-start;
        gap: 8px;
        height: 100%;
    }

    .nav-item.logout-item {
        margin-top: auto;
    }

    .sidebar .nav-links .nav-item.active {
        box-shadow: none;
    }

    .sidebar .nav-links .nav-item i {
        width: 24px;
        height: 24px;
    }
    
    .sidebar .nav-links .nav-item span {
        font-size: 1.05rem;
        font-weight: 500;
    }

    .nav-footer {
        display: block;
        margin-top: auto;
    }

    .system-tag {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 0.65rem;
        color: var(--text-muted);
        font-weight: 700;
        margin-top: 8px;
    }

    .system-tag .dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
    }

    .system-tag .dot.online { background: var(--success); box-shadow: 0 0 5px var(--success); }
    .system-tag .dot.offline { background: var(--danger); box-shadow: 0 0 5px var(--danger); }
}
