/* ============================================================================
   LAYOUT.CSS - HEADER, SIDEBAR Y FOOTER
   Sistema de Permisos de Salida - Sandoval Abogados
   ============================================================================ */

/* ============================================================================
   GLOBAL
   ============================================================================ */

body {
    overflow-x: hidden;
}

.mobile-menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    margin-left: 12px;
    border: none;
    border-radius: 10px;
    background: rgba(255,255,255,0.15);
    color: white;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: rgba(255,255,255,0.24);
}

.sidebar-overlay {
    position: fixed;
    inset: 70px 0 0 0;
    background: rgba(15,23,42,0.46);
    border: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 89;
}

/* ============================================================================
   HEADER
   ============================================================================ */

.header {
    background: #9b2247;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0;
}

.header-left-green {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #1e5b4f;
    padding: 0 30px;
    height: 70px;
}

.header-left-wine {
    flex: 1;
    background: #9b2247;
    height: 70px;
    display: flex;
    align-items: center;
    padding-left: 30px;
}

.logo {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 10px 0;
}

.logo img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.system-title {
    color: white;
    font-size: 14px;
    font-weight: 500;
    margin-left: 20px;
    padding-left: 20px;
    border-left: 1px solid rgba(255,255,255,0.2);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-right: 30px;
}

/* Oculta iconos de buscar y alertas del encabezado */
.header-right .header-btn {
    display: none;
}

.header-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
}

.header-btn:hover {
    background: rgba(255,255,255,0.25);
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff6b6b;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s;
    position: relative;
}

.user-menu:hover {
    background: rgba(255,255,255,0.15);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9b2247;
    font-weight: 700;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    color: white;
    font-size: 14px;
    font-weight: 600;
}

.user-role {
    color: rgba(255,255,255,0.7);
    font-size: 12px;
}

/* User Dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
}

.user-dropdown-header {
    padding: 20px;
    border-bottom: 1px solid #e4e6ef;
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-dropdown-avatar {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(135deg, #9b2247 0%, #7a1b38 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 24px;
}

.user-dropdown-info {
    flex: 1;
}

.user-dropdown-name {
    font-size: 16px;
    font-weight: 700;
    color: #181c32;
    margin-bottom: 4px;
}

.user-dropdown-email {
    font-size: 13px;
    color: #a1a5b7;
}

.user-dropdown-body {
    padding: 20px;
}

.user-info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: #f9fafb;
    transition: all 0.2s;
}

.user-info-item:hover {
    background: #f1f1f4;
}

.user-info-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.user-info-icon.wine {
    background: #fef2f5;
    color: #9b2247;
}

.user-info-icon.green {
    background: #e8f5e9;
    color: #00853F;
}

.user-info-icon.blue {
    background: #e3f2fd;
    color: #1976d2;
}

.user-info-content {
    flex: 1;
}

.user-info-label {
    font-size: 11px;
    font-weight: 600;
    color: #a1a5b7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.user-info-value {
    font-size: 14px;
    font-weight: 600;
    color: #181c32;
    line-height: 1.4;
}

.user-dropdown-footer {
    padding: 15px 20px;
    border-top: 1px solid #e4e6ef;
    display: flex;
    gap: 10px;
}

.user-dropdown-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.user-dropdown-btn.profile {
    background: #f1f1f4;
    color: #3f4254;
}

.user-dropdown-btn.profile:hover {
    background: #e4e6ef;
}

.user-dropdown-btn.logout {
    background: #9b2247;
    color: white;
}

.user-dropdown-btn.logout:hover {
    background: #7a1b38;
}

/* ============================================================================
   SIDEBAR
   ============================================================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 70px;
    width: 260px;
    height: calc(100vh - 70px);
    background: #1e1e2d;
    padding: 20px 0;
    overflow-y: auto;
    z-index: 90;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #2c2c3e;
    border-radius: 10px;
}

.menu-section {
    padding: 0 20px;
    margin-bottom: 30px;
}

.menu-title {
    color: #565674;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: #a1a5b7;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
    margin-bottom: 5px;
    cursor: pointer;
}

.menu-item:hover {
    background: #2c2c3e;
    color: #fff;
}

.menu-item.active {
    background: #1e5b4f;
    color: white;
}

.menu-item i {
    width: 20px;
    text-align: center;
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.footer {
    background: #1e1e2d;
    color: #a1a5b7;
    padding: 20px 30px;
    margin-left: 260px;
    margin-top: 30px;
    text-align: center;
    font-size: 13px;
}

.footer a {
    color: #00853F;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: inline-flex;
    }

    .sidebar {
        width: min(320px, 85vw);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 0 10px 40px rgba(0,0,0,0.22);
    }

    body.sidebar-open {
        overflow: hidden;
    }

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

    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .footer {
        margin-left: 0;
        padding: 20px;
    }

    .header-left-green {
        padding: 0 12px;
    }

    .header-left-wine {
        padding-left: 12px;
    }

    .system-title {
        display: none;
    }

    .header-right {
        padding-right: 15px;
        gap: 10px;
    }

    .user-info {
        display: none;
    }

    .user-dropdown {
        right: -10px;
        width: 280px;
    }

    .user-dropdown::before {
        right: 20px;
    }
}

@media (max-width: 480px) {
    .header {
        height: 64px;
    }

    .header-left-green,
    .header-left-wine {
        height: 64px;
    }

    .sidebar {
        top: 64px;
        height: calc(100vh - 64px);
    }

    .sidebar-overlay {
        inset: 64px 0 0 0;
    }

    .header-btn {
        width: 36px;
        height: 36px;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
    }

    .logo img {
        height: 34px;
    }

    .user-dropdown {
        width: calc(100vw - 40px);
        right: -10px;
    }
}

/* Sandoval visual system */
.header {
    background: rgba(10, 15, 30, 0.72);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 42px rgba(2, 6, 23, 0.22);
    backdrop-filter: blur(18px);
}

.header-left-green,
.header-left-wine {
    background: transparent;
}

.logo {
    padding: 8px 0;
}

.logo img {
    max-width: 210px;
    height: 48px;
    padding: 7px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    object-fit: contain;
    mix-blend-mode: normal;
}

.system-title {
    color: #f8fafc;
    border-left-color: rgba(255, 255, 255, 0.14);
}

.user-avatar,
.user-dropdown-avatar {
    background: linear-gradient(180deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 10px 24px rgba(99, 102, 241, 0.28);
}

.sidebar {
    background: rgba(10, 15, 30, 0.84);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
}

.menu-title {
    color: #94a3b8;
}

.menu-item {
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.02);
}

.menu-item:hover,
.menu-item.active {
    background: rgba(99, 102, 241, 0.14);
    border-color: rgba(129, 140, 248, 0.24);
    color: #fff;
}

.footer {
    background: rgba(10, 15, 30, 0.78);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
