/* ========================= */
/* AUTHENTICATED HEADER - FIXED SIZE */
/* ========================= */

/* User Profile Dropdown - Adjusted Size */
.user-profile-dropdown {
    position: relative;
    display: inline-block;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 8px; /* Reduced from var(--spacing-sm) */
    padding: 6px 10px; /* Reduced padding */
    background: var(--bg-secondary);
    border: 1px solid var(--border-light); /* Reduced border width */
    border-radius: 20px; /* Smaller radius */
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    color: var(--text-primary);
    max-width: 180px; /* Limit maximum width */
}

.profile-trigger:hover {
    border-color: var(--secondary-color);
    transform: translateY(-1px); /* Reduced hover effect */
    box-shadow: 0 2px 8px rgba(67, 97, 238, 0.15); /* Smaller shadow */
}

.profile-avatar {
    width: 28px; /* Reduced from 32px */
    height: 28px; /* Reduced from 32px */
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 12px; /* Reduced font size */
    flex-shrink: 0;
}

.profile-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    flex: 1;
}

.profile-name {
    font-size: 0.85rem; /* Reduced font size */
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px; /* Limit name width */
    line-height: 1.2;
}

.profile-role {
    font-size: 0.7rem; /* Reduced font size */
    color: var(--text-secondary);
    text-transform: capitalize;
    line-height: 1;
    margin-top: 1px;
}

.profile-dropdown-icon {
    color: var(--text-secondary);
    transition: transform var(--transition-fast);
    font-size: 0.8rem; /* Smaller icon */
    flex-shrink: 0;
}

.profile-trigger.active .profile-dropdown-icon {
    transform: rotate(180deg);
}

/* Dropdown Menu - Adjusted */
.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px); /* Reduced gap */
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 12px; /* Smaller radius */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12); /* Smaller shadow */
    min-width: 200px; /* Reduced minimum width */
    max-width: 250px; /* Add maximum width */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96); /* Smaller scale effect */
    transition: all var(--transition-normal);
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.profile-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-header {
    padding: 12px; /* Reduced padding */
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
    border-radius: 12px 12px 0 0;
}

.dropdown-user-info {
    display: flex;
    align-items: center;
    gap: 10px; /* Reduced gap */
}

.dropdown-avatar {
    width: 36px; /* Reduced from 40px */
    height: 36px; /* Reduced from 40px */
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px; /* Reduced font size */
}

.dropdown-user-details h4 {
    margin: 0;
    font-size: 0.9rem; /* Reduced font size */
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.dropdown-user-details p {
    margin: 2px 0 0 0;
    font-size: 0.75rem; /* Reduced font size */
    color: var(--text-secondary);
    line-height: 1.2;
}

/* Dropdown Menu Items - Adjusted */
.dropdown-menu-items {
    padding: 4px 0; /* Reduced padding */
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px; /* Reduced gap */
    padding: 8px 12px; /* Reduced padding */
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.85rem; /* Reduced font size */
}

.dropdown-item:hover {
    background: var(--bg-secondary);
    color: var(--secondary-color);
}

.dropdown-item i {
    width: 14px; /* Reduced icon width */
    color: var(--text-secondary);
    transition: color var(--transition-fast);
    font-size: 0.9rem; /* Smaller icons */
}

.dropdown-item:hover i {
    color: var(--secondary-color);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0; /* Reduced margin */
}

/* Mode Indicator - Adjusted */
.mode-indicator {
    display: inline-flex;
    align-items: center;
    gap: 3px; /* Reduced gap */
    padding: 1px 5px; /* Reduced padding */
    background: var(--yuzu);
    color: var(--text-dark);
    font-size: 0.65rem; /* Smaller font */
    font-weight: 600;
    border-radius: 8px; /* Smaller radius */
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-left: 4px;
}

.mode-indicator.demo {
    background: #ff9800;
    color: white;
}

.mode-indicator.guest {
    background: #9c27b0;
    color: white;
}

/* Hide auth buttons when logged in */
.header-actions.authenticated .auth-buttons {
    display: none;
}

.auth-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

/* ========================= */
/* MOBILE PROFILE MENU - Adjusted */
/* ========================= */

.mobile-user-profile {
    margin-bottom: var(--spacing-lg);
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mobile-profile-info {
    display: flex;
    align-items: center;
    gap: 12px; /* Reduced gap */
    padding: 12px; /* Reduced padding */
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-light));
    color: white;
    cursor: pointer;
}

.mobile-profile-info .profile-avatar {
    width: 36px; /* Reduced from 40px */
    height: 36px; /* Reduced from 40px */
    font-size: 14px; /* Reduced font size */
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.mobile-profile-info .profile-info {
    flex: 1;
}

.mobile-profile-info .profile-name {
    color: white;
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 0.9rem; /* Reduced font size */
}

.mobile-profile-info .profile-role {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem; /* Reduced font size */
}

.mobile-profile-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.1rem; /* Reduced size */
    cursor: pointer;
    padding: 6px; /* Reduced padding */
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.mobile-profile-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-profile-toggle i {
    transition: transform var(--transition-normal);
}

.mobile-profile-toggle.active i {
    transform: rotate(180deg);
}

/* Mobile Profile Menu */
.mobile-profile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: var(--bg-primary);
}

.mobile-profile-menu.show {
    max-height: 300px;
    padding: 6px 0; /* Reduced padding */
}

.mobile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px; /* Reduced gap */
    padding: 10px 16px; /* Reduced padding */
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem; /* Reduced font size */
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--border-light);
}

.mobile-dropdown-item:last-child {
    border-bottom: none;
    color: var(--primary-color);
}

.mobile-dropdown-item:hover {
    background: var(--bg-secondary);
    padding-left: calc(16px + 6px); /* Reduced offset */
}

.mobile-dropdown-item i {
    width: 18px; /* Reduced width */
    font-size: 1rem; /* Reduced size */
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.mobile-dropdown-item:hover i {
    color: var(--secondary-color);
}

.mobile-dropdown-item.logout-btn:hover i {
    color: var(--primary-color);
}

/* Responsive - Further adjustments */
@media screen and (max-width: 768px) {
    .profile-trigger {
        padding: 5px 8px; /* Even smaller on mobile */
        gap: 6px;
    }
    
    .profile-avatar {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    
    .profile-info {
        display: none; /* Hide name/role on very small screens */
    }
    
    .profile-dropdown-menu {
        right: -10px;
        min-width: 180px;
    }
    
    .dropdown-header {
        padding: 10px;
    }
}

@media screen and (max-width: 480px) {
    .profile-dropdown-menu {
        position: fixed;
        top: 70px;
        right: 10px;
        left: 10px;
        width: auto;
        min-width: auto;
    }
    
    .mobile-profile-info {
        padding: 10px;
    }
    
    .mobile-dropdown-item {
        padding: 8px 12px;
    }
}

/* Dark mode adjustments */
[data-theme="dark"] .profile-dropdown-menu {
    background: var(--bg-primary);
    border-color: var(--border-dark);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .dropdown-header {
    background: var(--bg-tertiary);
    border-color: var(--border-dark);
}

[data-theme="dark"] .dropdown-item:hover {
    background: var(--bg-tertiary);
}

[data-theme="dark"] .mobile-user-profile {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Loading state - Smaller */
.profile-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.profile-loading .spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-light);
    border-top: 2px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Force smaller profile trigger on profile page */
.profile-main .site-header .profile-trigger {
    max-width: 160px; /* Even smaller on profile page */
    padding: 5px 8px;
}

.profile-main .site-header .profile-avatar {
    width: 26px;
    height: 26px;
    font-size: 11px;
}

.profile-main .site-header .profile-name {
    font-size: 0.8rem;
    max-width: 80px;
}

.profile-main .site-header .profile-role {
    font-size: 0.65rem;
}