:root {
    --header-height: 74px;
    --primary-color: #3CB8E6;
    --primary-hover: #2a9fd6;
    --text-dark: #2c3e50;
    --text-muted: #6c757d;
    --bg-white: #ffffff;
    --border-light: #eff2f5;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.03);
    --shadow-dropdown: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    /* border-bottom: 1px solid var(--border-light); replaced with shadow for cleaner look */
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: all 0.3s ease;
}

.dashboard-header {
    width: 100%;
}

@media (min-width: 992px) {
    .dashboard-header {
        padding-left: 280px; /* Sidebar width */
        box-sizing: border-box;
    }
    
    .dashboard-header .header-container {
        margin: 0;
        max-width: 100%;
    }
}

.header-container {
    max-width: 1440px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    min-width: 0;
    box-sizing: border-box;
}

/* Branding & Logo */
.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-dark);
}

.logo-wrapper {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-mask {
    width: 100%;
    height: 100%;
    -webkit-mask-image: url('/images/logo.png');
    mask-image: url('/images/logo.png');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    background-color: var(--primary-color);
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

/* Navigation */
.header-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.desktop-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
    border-radius: 2px;
}

.nav-link:hover::after {
    width: 100%;
}

/* Actions & User Profile */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-dark);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.action-btn:hover {
    background: rgba(60, 184, 230, 0.1);
    color: var(--primary-color);
}

.badge-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: #ff4757;
    border-radius: 50%;
    border: 1px solid white;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50px;
    transition: all 0.2s;
}

.user-profile-btn:hover {
    background: rgba(60, 184, 230, 0.05);
}

.header-avatar-container {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-light);
    background: #f8f9fa;
}

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

.header-avatar-monogram {
    width: 100%;
    height: 100%;
    background: #e9ecef;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-name-short {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.dropdown-arrow {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Auth Buttons */
.auth-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-text {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.btn-text:hover {
    color: var(--primary-color);
}

.btn-primary-sm {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(60, 184, 230, 0.2);
}

.btn-primary-sm:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(60, 184, 230, 0.3);
}

/* Dropdown Modern */
.user-dropdown-wrapper {
    position: relative;
}

.dropdown-menu-modern {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    width: 260px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-dropdown);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 1px solid var(--border-light);
}

.user-dropdown-wrapper.active .dropdown-menu-modern,
.notification-wrapper.active .dropdown-menu-modern,
.business-dropdown-wrapper.active .dropdown-menu-modern {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header-modern {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 0.5rem;
}

.dropdown-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dropdown-avatar-container {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.static-monogram {
    background: #e9ecef;
    color: var(--text-dark);
}

.dropdown-user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dropdown-user-details strong {
    font-size: 0.95rem;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-user-details span {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-item-modern {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}

.dropdown-item-modern:hover {
    background: #f8f9fa;
    color: var(--primary-color);
}

.dropdown-item-modern.text-danger:hover {
    background: #fff5f5;
    color: #dc3545;
}

.dropdown-divider-modern {
    height: 1px;
    background: var(--border-light);
    margin: 0.5rem 0;
}

/* Mobile Responsive */
.header-toggle-btn {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-dark);
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-only {
    display: none;
}

.mobile-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    background: white;
    padding: 0;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    z-index: 999;
}

.mobile-menu.active {
    max-height: 400px;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.mobile-link {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
}

.mobile-auth {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-primary-mobile {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
}

@media (max-width: 991px) {
    .desktop-nav {
        display: none;
    }

    .user-name-short {
        display: none;
    }

    .header-toggle-btn {
        display: block;
    }

    .mobile-only {
        display: block;
    }

    .auth-actions {
        display: none;
    }
}

/* Notification System */
.notification-wrapper {
    position: relative;
}

.notification-dropdown {
    width: 320px;
    right: -60px;
}

@media (max-width: 576px) {
    .notification-dropdown {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0;
        border: none;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    }
}

.notification-list {
    max-height: 350px;
    overflow-y: auto;
}

.notification-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s;
    cursor: pointer;
    position: relative;
    display: block;
    text-decoration: none;
}

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

.notification-item:hover {
    background-color: #f8f9fa;
}

.notification-item.unread {
    background-color: #f0f9ff;
    border-left: 3px solid var(--primary-color);
}

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
    display: block;
}

.notification-message {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: block;
}

.notification-time {
    font-size: 0.75rem;
    color: #adb5bd;
    margin-top: 0.5rem;
    display: block;
}

.btn-link-sm {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.btn-link-sm:hover {
    text-decoration: underline;
}

.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

/* Business Switcher */
.business-dropdown-wrapper {
    position: relative;
    margin-right: 0.5rem;
    padding-right: 1rem;
    border-right: 1px solid var(--border-light);
}

.business-btn {
    width: auto;
    height: 40px;
    padding: 0.25rem 0.75rem 0.25rem 0.25rem;
    border-radius: 50px;
    background: transparent;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.business-btn:hover {
    background: rgba(60, 184, 230, 0.05);
    border-color: rgba(60, 184, 230, 0.1);
}

.business-avatar-mini {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.business-name-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.business-menu {
    width: 280px;
    right: auto;
    left: 0; /* Align left */
}

.business-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.business-item:hover {
    background: #f8f9fa;
}

.business-item.active {
    background: rgba(60, 184, 230, 0.05);
}

.business-avatar-small {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #e9ecef;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}

.business-item.active .business-avatar-small {
    background: var(--primary-color);
    color: white;
}

.business-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.business-info .name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.business-info .role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.check-icon {
    color: var(--primary-color);
    font-size: 0.9rem;
}

.create-new {
    color: var(--primary-color);
    justify-content: center;
    background: rgba(60, 184, 230, 0.05);
    margin-top: 0.5rem;
}

.create-new:hover {
    background: rgba(60, 184, 230, 0.1);
}

/* Mobile adjustments */
@media (max-width: 991px) {
    .business-dropdown-wrapper {
        border-right: none;
        margin-right: 0;
        padding-right: 0;
    }

    .business-name-label {
        display: none;
    }
}

/* ── Mobile overflow fix ─────────────────────────────────── */
@media (max-width: 991px) {
    /* Clip horizontal overflow on the container, NOT the header itself.
       overflow:hidden on .header would clip absolutely-positioned
       dropdown menus that extend below the header bar. */
    .header-container {
        padding: 0 1rem;
        gap: 0;
        overflow-x: clip;
    }

    .header-left {
        flex-shrink: 0;
        min-width: 0;
        gap: 0.5rem;
    }

    .header-right {
        gap: 0.75rem;
        flex-shrink: 0;
        min-width: 0;
    }

    .header-actions {
        gap: 0.25rem;
    }

    /* Shrink action buttons slightly on mobile */
    .action-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    /* Prevent brand text from pushing layout */
    .brand-text {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0 0.75rem;
    }

    .header-actions {
        gap: 0.15rem;
    }

    /* On very small screens hide the brand text, keep logo */
    .brand-text {
        display: none;
    }
}
