/* retoor <retoor@molodetz.nl> */

.profile-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.profile-sidebar {
    position: sticky;
    top: calc(var(--nav-height) + 1rem);
    min-width: 0;
}

.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
}

.profile-avatar-wrap {
    margin-bottom: 1rem;
}

.profile-avatar-wrap .avatar {
    margin: 0 auto;
}

.avatar-regen-btn {
    display: block;
    margin: 0.5rem auto 0;
}

.profile-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    overflow-wrap: break-word;
    word-break: break-word;
}

.profile-presence {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.profile-presence.online {
    color: var(--success);
}

.profile-presence::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    margin-right: 0.375rem;
    vertical-align: middle;
}

.profile-presence.online::before {
    background: var(--success);
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.profile-stat {
    text-align: center;
}

.profile-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    display: block;
}

a.profile-stat-value {
    color: var(--text-primary);
    text-decoration: none;
}

a.profile-stat-value:hover {
    color: var(--accent);
}

.profile-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-level-bar {
    margin-bottom: 1rem;
}

.profile-level-bar .level-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    display: flex;
    justify-content: space-between;
}

.profile-level-bar .bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.profile-level-bar .bar-fill {
    height: 100%;
    width: var(--bar-pct, 0);
    background: var(--accent);
    border-radius: 3px;
}

.profile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--accent-light);
    color: var(--accent);
}

.profile-badge-icon {
    font-size: 0.875rem;
    line-height: 1;
}

.profile-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-top: 1rem;
}

.profile-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    font-size: 0.8125rem;
}

.profile-info-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.profile-info-label {
    color: var(--text-muted);
    flex-shrink: 0;
}

.profile-info-row > .flex-center-gap {
    min-width: 0;
    align-items: flex-start;
}

.profile-info-value {
    color: var(--text-secondary);
    min-width: 0;
    text-align: left;
    overflow-wrap: break-word;
    word-break: break-word;
}

.profile-info-edit {
    color: var(--text-muted);
    padding: 0.25rem;
    font-size: 0.8125rem;
    flex-shrink: 0;
}

.profile-info-edit:hover {
    color: var(--accent);
}

.profile-content {
    min-width: 0;
}

.profile-tabs {
    margin-bottom: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 0.25rem;
    border: 1px solid var(--border);
    scroll-margin-top: calc(var(--nav-height) + 1rem);
}

.profile-tab {
    flex-shrink: 0;
    white-space: nowrap;
}

.profile-tabs .overflow-tabs-more {
    background: none;
    border: none;
    cursor: pointer;
}

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

.profile-tab.active {
    background: var(--accent);
    color: var(--on-accent);
}

.profile-posts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

@media (max-width: 768px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }
    .profile-sidebar {
        position: static;
    }
}

@media (max-width: 480px) {
    .profile-tabs {
        gap: 0.125rem;
    }

    .profile-tab {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }

    .profile-card {
        padding: 1rem;
    }

    .profile-name {
        font-size: 1.125rem;
    }

    .profile-stats {
        gap: 0.75rem;
    }

    .profile-stat-value {
        font-size: 1.125rem;
    }
}

@media (max-width: 360px) {
    .profile-stats {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

.profile-heatmap-card {
    padding: var(--space-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    margin-bottom: var(--space-lg);
}

.heatmap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.heatmap-title {
    font-size: 0.95rem;
    margin: 0;
}

.streak-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.heatmap-scroll {
    overflow-x: auto;
    padding-bottom: var(--space-xs);
}

.heatmap-inner {
    display: inline-flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.heatmap-months {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.heatmap-grid {
    display: flex;
    gap: 0.1875rem;
}

.heatmap-week {
    display: flex;
    flex-direction: column;
    gap: 0.1875rem;
}

.heatmap-cell {
    width: 11px;
    height: 11px;
    border-radius: 2px;
    background: var(--border);
}

.heatmap-cell.level-1 {
    background: rgba(var(--accent-rgb), 0.35);
}

.heatmap-cell.level-2 {
    background: rgba(var(--accent-rgb), 0.55);
}

.heatmap-cell.level-3 {
    background: rgba(var(--accent-rgb), 0.75);
}

.heatmap-cell.level-4 {
    background: var(--accent);
}

.api-key-card {
    margin-top: 1rem;
    padding: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
}

.api-key-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.api-key-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.api-key-docs {
    font-size: 0.75rem;
    color: var(--accent);
}

.api-key-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.api-key-hint {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.customization-card {
    margin-top: 1rem;
    padding: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
}

.customization-head {
    margin-bottom: 0.5rem;
}

.customization-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.customization-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0;
}

.customization-label {
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.customization-row form {
    margin: 0;
}

.customization-hint {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.ai-correction-prompt {
    width: 100%;
    margin: 0.5rem 0;
    resize: vertical;
}

.ai-correction-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.ai-correction-status[data-state="success"] {
    color: var(--success);
}

.ai-correction-status[data-state="error"] {
    color: var(--danger);
}

.follow-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.25rem;
    border-bottom: 1px solid var(--border);
}
.follow-row:last-child {
    border-bottom: none;
}
.follow-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    flex: 1 1 auto;
}
.follow-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.follow-user-name {
    font-weight: 600;
    color: var(--text-primary);
}
.follow-user-bio {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.follow-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}
.follow-page-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.ai-usage-card {
    padding: var(--space-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    margin-bottom: var(--space-lg);
}

.ai-usage-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.ai-usage-title {
    font-size: 0.95rem;
    margin: 0;
}

.ai-usage-updated {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.correction-usage-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
    gap: var(--space-sm);
}

.correction-usage-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.correction-usage-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.correction-usage-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.correction-usage-cost .correction-usage-value {
    color: var(--accent);
}

.ai-usage-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

.ai-quota {
    margin-bottom: var(--space-md);
}

.ai-quota-bar {
    height: 10px;
    border-radius: 999px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    overflow: hidden;
}

.ai-quota-fill {
    display: block;
    height: 100%;
    width: var(--quota-pct, 0);
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.ai-quota-fill.ai-quota-danger {
    background: var(--danger);
}

.ai-quota-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-xs);
}

.ai-quota-pct {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-quota-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ai-usage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-sm);
}

.ai-usage-stat {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.ai-usage-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-usage-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ai-usage-spark-wrap {
    margin-top: var(--space-md);
}

.ai-usage-spark-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ai-usage-spark {
    display: flex;
    align-items: flex-end;
    gap: 0.125rem;
    height: 48px;
    margin-top: var(--space-xs);
}

.ai-usage-bar {
    flex: 1 1 auto;
    min-width: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
    opacity: 0.75;
}

.ai-usage-table {
    width: 100%;
    margin-top: var(--space-md);
    border-collapse: collapse;
    font-size: 0.82rem;
}

.ai-usage-table th,
.ai-usage-table td {
    text-align: left;
    padding: var(--space-xs) var(--space-sm);
    border-bottom: 1px solid var(--border);
}

.ai-usage-table th {
    color: var(--text-muted);
    font-weight: 600;
}

.ai-usage-table td {
    color: var(--text-secondary);
}

.notif-prefs {
    padding: 1.5rem;
}

.notif-prefs-intro {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.notif-prefs-intro p {
    margin: 0 0 0.5rem;
}

.notif-prefs-admin {
    color: var(--accent);
}

.notif-prefs-table {
    width: 100%;
    border-collapse: collapse;
}

.notif-prefs-table th,
.notif-prefs-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.notif-prefs-table th {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.notif-prefs-col {
    width: 5rem;
    text-align: center;
}

.notif-prefs-label {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
}

.notif-prefs-desc {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.notif-switch {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.notif-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.notif-switch-track {
    position: relative;
    width: 2.4rem;
    height: 1.3rem;
    background: var(--border);
    border-radius: var(--radius-lg);
    transition: background 0.15s ease;
}

.notif-switch-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.05rem;
    height: 1.05rem;
    background: var(--bg-card);
    border-radius: 50%;
    transition: transform 0.15s ease;
}

.notif-switch input:checked + .notif-switch-track {
    background: var(--accent);
}

.notif-switch input:checked + .notif-switch-track::after {
    transform: translateX(1.1rem);
}

.notif-switch input:disabled + .notif-switch-track {
    opacity: 0.5;
}

.notif-switch-disabled {
    cursor: not-allowed;
}

.notif-prefs-hint {
    color: var(--accent);
}

.notif-prefs-scroll {
    overflow-x: auto;
}

.notif-prefs-actions {
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .notif-prefs-table th,
    .notif-prefs-table td {
        padding: 0.6rem 0.35rem;
    }

    .notif-prefs-col {
        width: 3.25rem;
    }

    .notif-prefs-desc {
        display: none;
    }

    .notif-switch-track {
        width: 2.1rem;
        height: 1.15rem;
    }

    .notif-switch-track::after {
        width: 0.9rem;
        height: 0.9rem;
    }

    .notif-switch input:checked + .notif-switch-track::after {
        transform: translateX(0.95rem);
    }
}

.profile-achievements {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: var(--space-md);
    padding: var(--space-sm) var(--space-md);
}

.profile-achievements-summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: var(--text-primary);
    list-style: none;
}

.profile-achievements-summary::-webkit-details-marker {
    display: none;
}

.profile-achievements-count {
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.achievement-group {
    margin-top: var(--space-md);
}

.achievement-group-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin: 0 0 var(--space-sm) 0;
    display: flex;
    gap: var(--space-sm);
    align-items: baseline;
}

.achievement-group-count {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-sm);
}

.achievement {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    padding: var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.achievement.locked {
    opacity: 0.45;
    filter: grayscale(1);
}

.achievement.earned {
    border-color: var(--accent);
}

.achievement-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.achievement-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.achievement-name {
    font-weight: 600;
    color: var(--text-primary);
}

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

.privacy-panel h3 {
    margin: var(--space-xl) 0 var(--space-sm);
}

.privacy-panel h3:first-child {
    margin-top: 0;
}

.privacy-intro {
    color: var(--text-secondary);
    margin: 0 0 var(--space-lg);
}

.privacy-intro a {
    color: var(--accent);
}

.privacy-suspension {
    padding: var(--space-md);
    border-left: 3px solid var(--danger);
    background: var(--bg-card-hover);
    border-radius: var(--radius);
    color: var(--text-primary);
    margin: 0 0 var(--space-lg);
}
