/* =============================================
   GLOBAL NAVIGATION BAR
   Consistent header across all pages
   ============================================= */

.global-nav {
    background: white;
    border-bottom: 2px solid #e2e8f0;
    padding: 0 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.global-nav-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.nav-brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e3a8a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 10px 20px;
    color: #64748b;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover {
    background: #f1f5f9;
    color: #1e3a8a;
}

.nav-link.active {
    background: #eff6ff;
    color: #1e3a8a;
}

/* Connection Status Indicator */
.nav-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Global Search Container */
.global-search-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    padding: 6px 12px;
    min-width: 300px;
    transition: all 0.3s;
}

.global-search-container:focus-within {
    background: white;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.global-search-container .search-icon {
    font-size: 1rem;
    color: #64748b;
}

.global-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.9rem;
    color: #1e293b;
    min-width: 0;
}

.global-search-input::placeholder {
    color: #94a3b8;
}

/* Search Results Dropdown */
.global-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: -150px;
    width: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 2000;
    animation: slideDown 0.2s ease-out;
}

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

.global-search-dropdown.hidden {
    display: none;
}

/* =============================================
   USER AVATAR MENU
   ============================================= */

.user-avatar-container {
    position: relative;
    margin-left: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    overflow: hidden;
    position: relative;
}

.user-avatar:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59,130,246,0.4);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.user-avatar span {
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    user-select: none;
}

/* User Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    border: 1px solid #e2e8f0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    transition-delay: 0s;
    z-index: 2000;
    pointer-events: none;
}

/* Add invisible bridge to maintain hover state */
.user-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
    background: transparent;
}

.user-avatar-container:hover .user-dropdown,
.user-dropdown:hover {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto;
    transition-delay: 0s;
}

/* Keep dropdown visible for a moment when moving mouse */
.user-dropdown:hover::before {
    content: '';
    pointer-events: auto;
}

/* Force hide when clicking outside */
.user-dropdown.force-hide {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-10px) !important;
    pointer-events: none !important;
}

.user-dropdown-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-large {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.user-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.user-avatar-large span {
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    text-transform: uppercase;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 700;
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

.user-department {
    color: #3b82f6;
    font-weight: 600;
}

.user-meta-separator {
    color: #cbd5e1;
}

.user-role {
    text-transform: capitalize;
    color: #64748b;
}

.user-dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 8px 0;
}

.user-dropdown-section {
    padding: 8px 0;
}

.dropdown-section-title {
    padding: 8px 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-item {
    width: 100%;
    padding: 12px 20px;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #475569;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
}

.dropdown-item:hover {
    background: #f8fafc;
    color: #1e3a8a;
}

.dropdown-item.danger {
    color: #dc2626;
}

.dropdown-item.danger:hover {
    background: #fef2f2;
    color: #991b1b;
}

.dropdown-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
}

/* =============================================
   GLOBAL SEARCH RESULTS
   ============================================= */

.global-search-results {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.global-search-results .empty-state {
    text-align: center;
    padding: 24px 16px;
}

.global-search-results .empty-state-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.5;
}

.global-search-results .empty-state p {
    margin: 4px 0;
    color: #64748b;
    font-size: 0.9rem;
}

.global-search-results .empty-state p:first-of-type {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

/* Search Result Item */
.search-result-item {
    padding: 14px 16px;
    background: white;
    border-radius: 8px;
    transition: all 0.2s;
}

.search-result-item:hover {
    background: #f1f5f9;
}

.search-result-main {
    width: 100%;
}

.search-result-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
}

.search-result-name-clickable {
    cursor: pointer;
    color: #1e3a8a;
    transition: all 0.2s;
    display: inline-block;
}

.search-result-name-clickable:hover {
    color: #3b82f6;
    text-decoration: underline;
}

.search-result-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 12px;
    font-size: 0.85rem;
    color: #64748b;
}

.search-result-detail {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.search-result-detail-icon {
    flex-shrink: 0;
}

.copy-btn {
    opacity: 0;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 8px;
    flex-shrink: 0;
}

.search-result-detail:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.search-location-link {
    color: #3b82f6;
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.search-location-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.search-result-phone-clickable {
    cursor: pointer;
    transition: all 0.2s;
}

.search-result-phone-clickable:hover {
    background: #eff6ff;
    border-radius: 4px;
}

.search-phone-link {
    color: #3b82f6;
    font-weight: 500;
    transition: all 0.2s;
}

.search-result-phone-clickable:hover .search-phone-link {
    color: #2563eb;
    text-decoration: underline;
}

.hidden {
    display: none !important;
}
