/* ╔═══════════════════════════════════════════════════════════════════════════╗
   ║                                                                           ║
   ║          FIREASSISTIQ PRO - UPTICK-STYLE HEADER COMPONENT                ║
   ║                                                                           ║
   ║  Professional enterprise header with user profile, notifications,        ║
   ║  company switcher, and mobile-responsive design                          ║
   ║                                                                           ║
   ╚═══════════════════════════════════════════════════════════════════════════╝ */

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: white;
    border-bottom: 1px solid var(--neutral-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    z-index: var(--z-sticky);
    box-shadow: var(--shadow-sm);
}

/* When sidebar is present (desktop admin view) */
.has-sidebar .app-header {
    left: 240px;
}

/* Logo & Branding */
.header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.header-brand:hover {
    opacity: 0.8;
}

.header-logo {
    width: 40px;
    height: 40px;
    background: var(--brand-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.header-logo i {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.header-brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.header-brand-name {
    font-size: var(--font-lg);
    font-weight: var(--font-bold);
    color: var(--neutral-900);
    line-height: 1;
}

.header-brand-tagline {
    font-size: var(--font-xs);
    color: var(--neutral-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: var(--font-semibold);
}

/* Hide tagline on mobile */
@media (max-width: 640px) {
    .header-brand-tagline {
        display: none;
    }
}

/* Center Section - Search or Page Title */
.header-center {
    flex: 1;
    max-width: 600px;
    margin: 0 var(--space-6);
}

.header-search {
    position: relative;
    width: 100%;
}

.header-search-input {
    width: 100%;
    padding: var(--space-2) var(--space-4) var(--space-2) var(--space-10);
    border: 2px solid var(--neutral-200);
    border-radius: var(--radius-lg);
    font-size: var(--font-sm);
    background: var(--neutral-50);
    transition: all var(--transition-fast);
}

.header-search-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    background: white;
    box-shadow: 0 0 0 3px var(--brand-primary-light);
}

.header-search-icon {
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--neutral-500);
    pointer-events: none;
}

/* Hide search on mobile */
@media (max-width: 768px) {
    .header-center {
        display: none;
    }
}

/* Right Section - Actions & Profile */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Company Switcher (for multi-tenant) */
.header-company-switcher {
    position: relative;
    display: none; /* Show only when user has multiple companies */
}

.header-company-switcher.has-companies {
    display: block;
}

.header-company-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--neutral-50);
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: var(--font-sm);
    font-weight: var(--font-medium);
    color: var(--neutral-800);
}

.header-company-btn:hover {
    background: var(--neutral-100);
    border-color: var(--neutral-300);
}

.header-company-icon {
    width: 24px;
    height: 24px;
    background: var(--brand-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    font-weight: var(--font-bold);
}

/* Hide company name on mobile */
@media (max-width: 640px) {
    .header-company-name {
        display: none;
    }
}

/* Notification Bell */
.header-notification {
    position: relative;
}

.header-icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--neutral-600);
    transition: all var(--transition-fast);
    position: relative;
}

.header-icon-btn:hover {
    background: var(--neutral-100);
    color: var(--neutral-900);
}

.header-icon-btn i {
    font-size: 18px;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--error);
    border: 2px solid white;
    border-radius: var(--radius-full);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.notification-count {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--error);
    color: white;
    font-size: 10px;
    font-weight: var(--font-bold);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* User Profile */
.header-profile {
    position: relative;
}

.header-profile-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1);
    background: transparent;
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.header-profile-btn:hover {
    background: var(--neutral-50);
    border-color: var(--neutral-200);
}

.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-primary);
    color: white;
    font-weight: var(--font-bold);
    font-size: var(--font-sm);
    overflow: hidden;
}

.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-profile-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.header-profile-name {
    font-size: var(--font-sm);
    font-weight: var(--font-semibold);
    color: var(--neutral-900);
    line-height: 1;
}

.header-profile-role {
    font-size: var(--font-xs);
    color: var(--neutral-500);
    line-height: 1;
}

/* Hide profile info on mobile */
@media (max-width: 768px) {
    .header-profile-info {
        display: none;
    }
}

/* View Mode Badge */
.header-view-badge {
    padding: var(--space-1) var(--space-3);
    background: var(--brand-primary);
    color: white;
    font-size: var(--font-xs);
    font-weight: var(--font-bold);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: var(--space-2);
}

.header-view-badge.engineer {
    background: var(--info);
}

/* Mobile Menu Toggle */
.header-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--neutral-700);
}

@media (max-width: 768px) {
    .header-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   DROPDOWN MENUS
   ═══════════════════════════════════════════════════════════════════════════ */

.header-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 280px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--neutral-200);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    z-index: var(--z-dropdown);
}

.header-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-dropdown-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--neutral-200);
    background: var(--neutral-50);
}

.header-dropdown-title {
    font-size: var(--font-sm);
    font-weight: var(--font-semibold);
    color: var(--neutral-900);
    margin-bottom: var(--space-1);
}

.header-dropdown-subtitle {
    font-size: var(--font-xs);
    color: var(--neutral-600);
}

.header-dropdown-body {
    max-height: 400px;
    overflow-y: auto;
}

.header-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: background var(--transition-fast);
    text-decoration: none;
    color: var(--neutral-800);
}

.header-dropdown-item:hover {
    background: var(--neutral-50);
}

.header-dropdown-item i {
    width: 20px;
    color: var(--neutral-500);
}

.header-dropdown-item-content {
    flex: 1;
}

.header-dropdown-item-title {
    font-size: var(--font-sm);
    font-weight: var(--font-medium);
    color: var(--neutral-900);
    margin-bottom: 2px;
}

.header-dropdown-item-subtitle {
    font-size: var(--font-xs);
    color: var(--neutral-600);
}

.header-dropdown-divider {
    height: 1px;
    background: var(--neutral-200);
    margin: var(--space-2) 0;
}

.header-dropdown-footer {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--neutral-200);
    background: var(--neutral-50);
}

/* Notification Items */
.notification-item {
    padding: var(--space-4);
    border-bottom: 1px solid var(--neutral-200);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: var(--neutral-50);
}

.notification-item.unread {
    background: var(--info-light);
}

.notification-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-2);
}

.notification-item-title {
    font-size: var(--font-sm);
    font-weight: var(--font-semibold);
    color: var(--neutral-900);
}

.notification-item-time {
    font-size: var(--font-xs);
    color: var(--neutral-500);
    white-space: nowrap;
}

.notification-item-body {
    font-size: var(--font-sm);
    color: var(--neutral-700);
    line-height: var(--line-height-normal);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE ADJUSTMENTS
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
    .app-header {
        padding: 0 var(--space-4);
    }
    
    .header-dropdown {
        min-width: calc(100vw - 32px);
        right: -16px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   OFFLINE INDICATOR
   ═══════════════════════════════════════════════════════════════════════════ */

.header-offline-indicator {
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-2) var(--space-4);
    background: var(--warning);
    color: white;
    font-size: var(--font-sm);
    font-weight: var(--font-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    animation: slideDown 0.3s ease-out;
    z-index: var(--z-toast);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.header-offline-indicator i {
    animation: pulse 2s infinite;
}
