/**
 * User Profile - Header & Tabs
 *
 * Profile header, avatar, tabs navigation, and related styles
 * Mobile-first with fluid typography and touch-friendly targets
 *
 * @package PC Kompas User API
 */

/* User Profile Header */
.user-profile-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: clamp(1.5rem, 4vw, 2.5rem) 0;
}

.user-profile-header__container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 3vw, 1.5rem);
}

.user-profile-header__content {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: clamp(1rem, 3vw, 2rem);
}

.user-profile-header__avatar {
    width: clamp(80px, 12vw, 128px);
    height: clamp(80px, 12vw, 128px);
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    flex-shrink: 0;
}

.user-profile-header__info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.user-profile-header__name {
    font-size: clamp(1.5rem, 4vw + 1rem, 2.5rem);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    word-break: break-word;
}

.user-profile-header__meta {
    font-size: clamp(0.875rem, 1.5vw + 0.25rem, 1rem);
    color: var(--text-secondary);
    margin: 0;
}

.user-profile-header__stats {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: clamp(0.75rem, 2vw, 1rem);
    margin-top: 8px;
    font-size: clamp(0.8125rem, 1.25vw + 0.25rem, 0.9375rem);
}

.user-profile-header__stats .stat {
    color: var(--text-secondary);
    white-space: nowrap;
}

.user-profile-header__stats .stat strong {
    color: var(--text-primary);
    font-weight: 600;
}

.user-profile-header__stats .stat-separator {
    color: var(--text-muted);
}

.user-profile-header__actions {
    display: flex;
    align-items: flex-start;
    gap: clamp(0.5rem, 1.5vw, 0.75rem);
    flex-shrink: 0;
}

/* User Profile Tabs Navigation */
.user-profile-tabs {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 60px;
    z-index: 50;
}

/* Admin bar adjustment */
.admin-bar .user-profile-tabs {
    top: 92px;
}

@media (max-width: 782px) {
    .admin-bar .user-profile-tabs {
        top: 106px;
    }
}

.user-profile-tabs__container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 clamp(0.75rem, 3vw, 1.5rem);
    overflow: hidden;
}

.user-profile-tabs__nav {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-tertiary);
    scroll-snap-type: x mandatory;
    scroll-padding: 0 16px;
    padding-bottom: 4px;
    margin-bottom: -4px;
}

/* Show thin scrollbar on mobile for scroll indication */
.user-profile-tabs__nav::-webkit-scrollbar {
    height: 4px;
}

.user-profile-tabs__nav::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 2px;
}

.user-profile-tabs__nav::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 2px;
}

/* Scroll fade indicators */
.user-profile-tabs__container {
    position: relative;
}

.user-profile-tabs__container::before,
.user-profile-tabs__container::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 4px;
    width: 24px;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.user-profile-tabs__container::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-secondary), transparent);
}

.user-profile-tabs__container::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-secondary), transparent);
}

/* Show fade indicators when scrollable - requires JS to add class */
.user-profile-tabs__container--scroll-left::before,
.user-profile-tabs__container--scroll-right::after {
    opacity: 1;
}

.user-profile-tabs__tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 48px;
    min-height: 48px;
    padding: clamp(10px, 1.5vw, 14px) clamp(10px, 1.5vw, 16px);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: clamp(0.75rem, 1.1vw + 0.25rem, 0.875rem);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    cursor: pointer;
    scroll-snap-align: start;
    touch-action: manipulation;
}

.user-profile-tabs__tab:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.user-profile-tabs__tab:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.user-profile-tabs__tab--active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.user-profile-tabs__tab--active:hover {
    background-color: transparent;
}

.user-profile-tabs__tab svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* Subtabs Navigation (e.g., for Topics: Mijn Topics / Gevolgde Topics) */
.user-profile-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.5rem, 1.5vw, 0.75rem);
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
    padding-bottom: clamp(1rem, 2vw, 1.25rem);
    border-bottom: 1px solid var(--border);
}

.user-profile-subtabs__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 48px;
    min-height: 48px;
    padding: 12px 16px;
    font-size: clamp(0.8125rem, 1.25vw + 0.25rem, 0.875rem);
    font-weight: 500;
    color: var(--text-secondary);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.15s ease;
    touch-action: manipulation;
}

.user-profile-subtabs__item:hover {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
    border-color: var(--border-light);
}

.user-profile-subtabs__item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.user-profile-subtabs__item--active {
    color: var(--accent);
    background-color: var(--bg-tertiary);
    border-color: var(--accent);
}

.user-profile-subtabs__item--active:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.user-profile-subtabs__item svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* Tab Badge (for unread count) */
.user-profile-tabs__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 7px;
    font-size: clamp(0.625rem, 1vw + 0.125rem, 0.6875rem);
    font-weight: 700;
    color: var(--bg-primary);
    background: var(--accent);
    border-radius: 10px;
    margin-left: 6px;
}

/* Bio Section (for Profile tab) */
.user-profile-bio {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
}

.user-profile-bio__text {
    font-size: clamp(0.875rem, 1.5vw + 0.25rem, 0.9375rem);
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
}

.user-profile-bio__edit-btn {
    margin-top: clamp(1rem, 2vw, 1.25rem);
}

/* Mobile Header Layout (stack on small screens) */
@media (max-width: 640px) {
    .user-profile-header__content {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .user-profile-header__actions {
        width: 100%;
        gap: 8px;
    }

    .user-profile-header__actions .btn {
        flex: 1;
        justify-content: center;
        min-height: 48px;
        padding: 12px 16px;
    }

    /* Show only icons on very small screens */
    .user-profile-tabs__tab .tab-label {
        display: none;
    }

    /* Ensure minimum touch target spacing between tabs */
    .user-profile-tabs__nav {
        gap: 4px;
    }
}

/* Show tab labels on larger mobile screens */
@media (min-width: 480px) {
    .user-profile-tabs__tab .tab-label {
        display: inline;
    }
}

/* Ensure consistent header button sizing on mobile */
@media (max-width: 480px) {
    .user-profile-header__actions {
        flex-direction: column;
    }

    .user-profile-header__actions .btn {
        width: 100%;
    }
}
