/* Unified Header Styles - Guaranteed Consistency */

/* Header Wrapper - Full Width Background */
.header-wrapper {
    width: 100%;
    background-color: var(--background);
    position: sticky;
    top: 0;
    z-index: var(--header-z-index);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Header Container - RESPONSIVE POSITIONING */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
    padding: 0 16px;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

/* Mobile: Full width */
@media (max-width: 900px) {
    .app-header {
        max-width: 100%;
        margin: 0;
    }
}

/* Tablet: Slight padding for comfort */
@media (min-width: 481px) and (max-width: 900px) {
    .app-header {
        padding: 0 20px;
    }
}

/* CRITICAL: Prevent header from moving */
.app-header {
    box-sizing: border-box !important;
    min-height: var(--header-height) !important;
    max-height: var(--header-height) !important;
}

/* Logo - ABSOLUTE CENTER POSITIONING */
.logo-link {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo {
    height: 28px;
    width: auto;
    display: block;
    max-width: 120px;
}

/* Header Icons - CONSISTENT SIZING */
.header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    border: none;
    padding: 0;
    position: relative;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0; /* Prevent shrinking */
}

.header-icon:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.header-icon:active {
    transform: scale(0.95);
}

.header-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--text);
    fill: none;
    stroke-width: 2;
    pointer-events: none;
}

/* Header Spacer - CONSISTENT SPACING */
.header-spacer {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

/* Hamburger Menu Icon - LEFT SIDE */
.hamburger-menu {
    justify-self: flex-start;
    order: 1;
}

/* Notification Button - RIGHT SIDE */
.notification-btn {
    justify-self: flex-end;
    order: 3;
}

.notification-btn.has-notifications svg {
    stroke: var(--accent);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background-color: var(--accent);
    color: white;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    border: 2px solid var(--background);
}

/* DROPDOWN MENUS - CONSISTENT POSITIONING */
.dropdown-menu {
    position: fixed;
    background-color: var(--background-secondary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: var(--dropdown-z-index);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all var(--dropdown-anim-duration) ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
}

/* Hamburger Dropdown - LEFT SLIDE */
.hamburger-dropdown {
    top: var(--header-height);
    left: 0;
    width: 280px;
    max-width: 80vw;
    height: calc(100vh - var(--header-height));
    transform: translateX(-100%);
    transition: transform var(--dropdown-anim-duration) ease;
}

.hamburger-dropdown.active {
    transform: translateX(0);
}

/* Notification Dropdown - TOP RIGHT */
.notification-dropdown {
    top: calc(var(--header-height) + 8px);
    right: 16px;
    width: 320px;
    max-width: calc(100vw - 32px);
    max-height: 480px;
    border-radius: 12px;
    transform: translateY(-10px);
}

/* Desktop notification dropdown positioning */
@media (min-width: 901px) {
    .notification-dropdown {
        right: calc((100vw - 900px) / 2 + 16px);
    }
}

.notification-dropdown.active {
    transform: translateY(0);
}

/* Menu Items - CONSISTENT STYLING */
.menu-container {
    padding: 8px 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.menu-section {
    padding: 8px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 16px;
    font-family: inherit;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.menu-item svg {
    width: 20px;
    height: 20px;
    margin-right: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
    flex-shrink: 0;
}

.menu-item span {
    font-size: 16px;
    font-weight: 500;
    color: currentColor;
}

.menu-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.08);
    margin: 8px 20px;
}

/* Submenu Functionality */
.has-submenu .chevron {
    width: 16px;
    height: 16px;
    margin-left: auto;
    transform: rotate(0deg);
    transition: transform 0.3s ease;
    stroke: var(--text);
}

.has-submenu.expanded .chevron {
    transform: rotate(180deg);
}

.submenu {
    max-height: 0;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.1);
    transition: max-height 0.3s ease;
}

.submenu.active {
    max-height: 300px;
}

.submenu-item {
    display: block;
    padding: 12px 20px 12px 56px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.submenu-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

/* Special Button Styles */
.logout-item {
    color: var(--accent);
}

.logout-item svg {
    stroke: var(--accent);
}

.whatsapp-contact {
    background-color: rgba(37, 211, 102, 0.1);
    margin: 0 12px 12px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.whatsapp-contact:hover {
    background-color: rgba(37, 211, 102, 0.2);
}

.whatsapp-contact svg {
    stroke: #25D366;
}

.whatsapp-contact span {
    color: #25D366;
    font-weight: 600;
}

/* Notification Styles */
.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.notification-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

#mark-all-read {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

#mark-all-read:hover {
    background-color: rgba(255, 59, 48, 0.1);
}

.notification-list {
    max-height: 320px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.notification-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.notification-item.unread {
    background-color: rgba(255, 255, 255, 0.03);
}

.notification-icon {
    width: 36px;
    height: 36px;
    margin-right: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--background-tertiary);
    border-radius: 50%;
}

.notification-icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--text);
    fill: none;
    stroke-width: 2;
}

.notification-content {
    flex: 1;
}

.notification-text {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 4px;
}

.notification-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.notification-empty {
    padding: 40px 16px;
    text-align: center;
    color: var(--text-secondary);
}

.notification-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.notification-footer a {
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dropdown-anim-duration) ease;
    z-index: var(--overlay-z-index);
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .app-header {
        padding: 0 12px;
    }
    
    .notification-dropdown {
        right: 8px;
        left: 8px;
        width: auto;
        max-width: none;
    }
    
    .hamburger-dropdown {
        width: 85vw;
    }
    
    .logo {
        height: 24px;
    }
}

/* Accessibility */
.header-icon:focus,
.menu-item:focus,
#mark-all-read:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Prevent text selection */
.header-icon,
.menu-item,
.notification-item {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Scrollbar Styling */
.menu-container::-webkit-scrollbar,
.notification-list::-webkit-scrollbar {
    width: 4px;
}

.menu-container::-webkit-scrollbar-track,
.notification-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.menu-container::-webkit-scrollbar-thumb,
.notification-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}