﻿/* MyAppLayout.css */

.main-content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow-x: hidden;
}

.app-top-bar {
    position: sticky;
    top: 0;
    z-index: 1009;
    height: 60px;
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 2rem;
    flex-shrink: 0;
}

.user-menu-container {
    position: relative;
}

.user-menu-button {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

    .user-menu-button:hover {
        background-color: #f8f9fa;
    }

.user-name {
    font-weight: 600;
    color: #495057;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #e9ecef;
    color: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    border: 1px solid #dee2e6;
    width: 200px;
    z-index: 1050;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #495057;
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}

    .dropdown-item:hover {
        background-color: #f8f9fa;
    }

    .dropdown-item i {
        width: 20px;
        color: #6c757d;
    }

.dropdown-divider {
    height: 1px;
    background-color: #e9ecef;
    margin: 0.5rem 0;
}

.app-main-content {
    flex-grow: 1;
    padding: 2rem;
    background-color: #f4f7f6;
}

.app-layout-with-sidebar {
    display: flex;
}

.main-content-wrapper {
    margin-left: 260px;
    transition: margin-left 0.3s ease-in-out;
}

/* Aplica este margen solo en pantallas de escritorio (más anchas de 992px) */
@media (min-width: 993px) {
    .sidebar-collapsed .main-content-wrapper {
        margin-left: 78px;
    }
}

/* --- NUEVOS ESTILOS PARA MÓVILES --- */
.mobile-header {
    display: none; /* Oculto por defecto en escritorio */
}

@media (max-width: 992px) {
    .app-top-bar {
        display: none; /* Ocultamos la barra de escritorio */
    }

    /* ✅ NUEVOS ESTILOS PARA EL OVERLAY */
    .mobile-nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1099; /* Justo debajo del sidebar */
        animation: fadeIn 0.3s;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }

    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 60px;
        padding: 0 1rem;
        background-color: #fff;
        border-bottom: 1px solid #dee2e6;
        position: fixed; /* Cambiar de 'sticky' a 'fixed' */
        top: 0;
        width: 100%; /* Añadir para que ocupe todo el ancho */

        z-index: 1009;
    }

    .mobile-menu-toggle {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: #343a40;
        cursor: pointer;
    }

    .mobile-logo img {
        height: 30px;
    }

    .mobile-user-placeholder {
        width: 40px; /* Mismo ancho que el botón para centrar el logo */
    }

    .main-content-wrapper {
        margin-left: 0;
        height: auto;
        overflow-y: visible;
    }

    .app-main-content {
        padding: calc(60px + 1rem) 1rem 1rem;
    }

    /* Hacemos que el sidebar se comporte como un overlay */
    .app-layout-with-sidebar > :first-child { /* Apunta al AppSidebar */
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 1100;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 4px 0 15px rgba(0,0,0,0.1);
    }

    .app-layout-with-sidebar.mobile-nav-open > :first-child {
        transform: translateX(0);
    }
}
