/* ========================================
   Top Header Bar Component
   Fixed position header with navigation
   ======================================== */

:root {
    --header-height: 56px;
}

/* Header Container */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-default);
    box-shadow: var(--shadow-small);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-inline: 16px;
    gap: 24px;
    z-index: 1000;
    flex-shrink: 0;
}

/* Left Section */
.top-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* User Profile Button */
.top-header-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background 0.2s;
}

.top-header-profile:hover {
    background: var(--interactive-hover);
}

.top-header-profile-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-primary);
}

.top-header-profile-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-header-profile-chevron {
    font-size: 10px;
    color: var(--text-secondary);
}

/* Search Container (Expandable via GSAP) */
.search-container {
    display: flex;
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    /* No CSS transition - GSAP handles animation */
}

.search-button {
    width: 40px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}

.search-button:hover {
    background: var(--interactive-hover);
    color: var(--text-primary);
}

.search-input {
    flex: 1;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    padding-inline-end: 12px;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

/* Badge indicator for search results */
.search-button[data-badge]::after {
    content: attr(data-badge);
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    background: var(--blue-primary);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Activity Log Button */
.top-header-activity {
    width: 40px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    position: relative;
}

.top-header-activity:hover {
    background: var(--interactive-hover);
    color: var(--text-primary);
}

/* Badge indicator for activity log */
.top-header-activity[data-badge]::after {
    content: attr(data-badge);
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    background: var(--red-primary);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Center Section: Breadcrumb */
.top-header-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0; /* Allow flex shrinking */
}

.top-header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    overflow: hidden;
}

.breadcrumb-separator {
    color: var(--text-secondary);
    font-size: 14px;
    user-select: none;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0; /* Allow flex shrinking */
}

.breadcrumb-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.breadcrumb-label:hover {
    background: var(--interactive-hover);
}

.breadcrumb-dot-menu {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
    opacity: 0;
    pointer-events: none;
}

.breadcrumb-item:hover .breadcrumb-dot-menu {
    opacity: 1;
    pointer-events: auto;
}

.breadcrumb-dot-menu:hover {
    background: var(--interactive-hover);
    color: var(--text-primary);
}

/* Right Section */
.top-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Settings Button */
.top-header-settings {
    width: 40px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.top-header-settings:hover {
    background: var(--interactive-hover);
    color: var(--text-primary);
}

/* Theme Toggle Button */
.top-header-theme {
    width: 40px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.top-header-theme:hover {
    background: var(--interactive-hover);
    color: var(--text-primary);
}

/* Version Label */
.top-header-version {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    padding: 4px 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    user-select: none;
}

/* Copy Log Button */
.top-header-copy-log {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.top-header-copy-log:hover {
    background: var(--interactive-hover);
    color: var(--text-primary);
}

/* Generic Header Icon Button */
.top-header-icon-btn {
    width: 36px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    position: relative;
}

.top-header-icon-btn:hover {
    background: var(--interactive-hover);
    color: var(--text-primary);
}

/* Badge indicator for icon buttons (notifications, etc.) */
.top-header-icon-btn[data-badge]::after {
    content: attr(data-badge);
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    background: var(--red-primary);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* RTL Support */
[dir="rtl"] .top-header-profile-chevron {
    transform: scaleX(-1);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .search-button,
    .top-header-activity,
    .top-header-settings,
    .top-header-theme,
    .top-header-profile,
    .top-header-icon-btn,
    .breadcrumb-label,
    .breadcrumb-dot-menu {
        transition: none;
    }
}

/* Responsive */
@media (max-width: 900px) {
    .top-header-profile-name {
        display: none;
    }
}

@media (max-width: 600px) {
    .top-header {
        padding-inline: 8px;
        gap: 8px;
    }

    .top-header-left {
        gap: 8px;
    }

    .top-header-right {
        gap: 4px;
    }

    .breadcrumb-label {
        max-width: 100px;
    }
}
