/* Account page (Konto); .profile-card and related tokens are reused on other pages */
.content-container {
    padding-top: var(--nav-height);
    min-height: 100vh;
    background: var(--bg-color);
    padding-left: var(--safe-area-inset-left);
    padding-right: var(--safe-area-inset-right);
    padding-bottom: var(--safe-area-inset-bottom);
}

/* Reset place-detail decoration on profile page */
.content-container::before {
    display: none !important;
    content: none !important;
}

/* Ensure profile loader stays centered fullscreen */
#loader.loader,
#loader {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999 !important;
}

/* Password Field with Toggle */
.password-field {
    position: relative;
    display: block; /* Changed from flex for better Android compatibility */
    width: 100%;
}

.password-field .form-input {
    padding-right: 3rem;
    width: 100%;
    box-sizing: border-box;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.2s ease;
    z-index: 10; /* Higher z-index for Android */
    height: 2rem; /* Explicit height for Android */
    width: 2rem; /* Explicit width for Android */
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--primary-color);
}

.password-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.password-toggle i {
    font-size: 1.1rem;
}

.profile-container {
    width: 100%;
    max-width: min(1200px, 100%);
    margin: 0 auto;
    padding: 1rem 1rem 2.5rem;
    box-sizing: border-box;
}

/* Extra breathing room below the grid on wide layouts (cache card / last column) */
@media (min-width: 1025px) {
    .profile-container {
        padding-bottom: 5.5rem;
    }
}

.profile-header {
    text-align: center;
    margin-bottom: 2rem;
    margin: 15px;
}

/* Direct styling for title and subtitle (like status and favorites pages) */
.profile-container > .profile-title {
    text-align: center;
    margin-bottom: 0.5rem;
}

.profile-container > .profile-subtitle {
    text-align: center;
    margin-bottom: 2rem;
}

/* Two independent columns: avoids CSS grid row-height = max(both cells), which caused huge gaps under short cards (e.g. Profilbild vs. tall Kontosicherheit). */
.profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.profile-grid-column--stack {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-width: 0;
}

.profile-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

.profile-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin: 0;
}

.profile-card {
    background: var(--card-background);
    border-radius: 0 0 16px 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.profile-card-header {
    padding: 1.5rem 2rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(139, 92, 246, 0.05));
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.profile-card-title-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.profile-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-card-title i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.profile-card-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 0.25rem 0;
}

/* Right column in header (buttons/dropdowns) — matches title + subtitle row */
.profile-card-header-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

/* Profile Picture Styles */
.profile-picture-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.profile-picture-container {
    position: relative;
    width: 150px;
    height: 150px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.profile-picture-container:hover {
    transform: scale(1.05);
}

.profile-picture {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-color);
    background: var(--card-background);
    transition: border-color 0.2s ease;
}

.profile-picture-container:hover .profile-picture {
    border-color: var(--secondary-color);
}

.profile-picture-spinner {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 20;
    align-items: center;
    justify-content: center;
}

.profile-picture-spinner .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.profile-picture-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s ease;
    cursor: pointer;
    gap: 0.25rem;
}

.profile-picture-overlay i {
    font-size: 1.5rem;
}

.profile-picture-actions {
    margin-top: 1rem;
    text-align: center;
}

/* Secondary destructive: outline pill — no link-underline, icon-only accent */
.profile-picture-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 auto;
    padding: 0.5rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: 0.01em;
    color: var(--text-color);
    background: color-mix(in srgb, var(--card-background) 92%, var(--border-color));
    border: 1px solid var(--border-color);
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    text-decoration: none !important;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        color 0.18s ease,
        transform 0.12s ease;
    -webkit-appearance: none;
    appearance: none;
}

.profile-picture-remove-btn i {
    font-size: 1rem;
    color: #e11d48;
    opacity: 0.95;
    flex-shrink: 0;
}

.profile-picture-remove-btn:hover {
    text-decoration: none !important;
    color: var(--text-color);
    background: color-mix(in srgb, #e11d48 10%, var(--card-background));
    border-color: color-mix(in srgb, #e11d48 45%, var(--border-color));
    box-shadow: 0 2px 10px rgba(225, 29, 72, 0.12);
}

.profile-picture-remove-btn:active {
    transform: scale(0.98);
}

.profile-picture-remove-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.profile-picture-container:hover .profile-picture-overlay {
    opacity: 1;
}

/* Form Styles */
.profile-form {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--input-background);
    color: var(--text-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input:disabled {
    background: var(--disabled-background);
    color: var(--text-muted);
    cursor: not-allowed;
}

.input-with-status {
    position: relative;
}

.input-with-status .form-input {
    padding-right: 2.75rem;
}

.input-status-icon {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.2rem;
    height: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.input-status-icon.visible {
    opacity: 1;
}

.input-status-icon.success {
    color: var(--success-color);
}

.input-status-icon.error {
    color: var(--error-color);
}

.input-status-icon.spin {
    font-size: 0;
    border: 2px solid rgba(148, 163, 184, 0.35);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: profileCircleSpin 0.8s linear infinite;
}

@keyframes profileCircleSpin {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
}

#usernameAvailabilityText .username-suggest-apply {
    font-size: inherit;
    font-weight: 500;
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

#usernameAvailabilityText .username-suggest-apply:hover {
    opacity: 0.9;
}

.location-settings-group {
    background: var(--input-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.location-settings-group .form-group:last-child {
    margin-bottom: 0;
}

.location-inline-help-title {
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
}

.location-inline-help-title .profile-inline-help-link {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
}

.location-inline-help-title .profile-inline-help-link:hover {
    opacity: 0.9;
}

.settings-subcard {
    background: var(--input-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.settings-subcard .form-group:last-child {
    margin-bottom: 0;
}

.location-input-container {
    position: relative;
}

.location-input-container .form-input {
    width: 100%;
    min-width: 0;
    padding-right: 7.5rem;
}

.location-update-btn {
    position: absolute;
    right: 0.45rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
    min-width: 0;
    padding: 0.45rem 0.8rem;
    z-index: 2;
}

.location-tracking-settings {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.setting-header {
    margin-bottom: 0.75rem;
}

.setting-header .form-label {
    margin-bottom: 0;
}

.setting-toggle {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
}

.setting-info {
    flex: 1;
}

.setting-title {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.setting-description {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.45;
}

.location-status {
    margin-top: 0.7rem;
}

.location-status small {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    line-height: 1.45;
}

.community-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.community-membership-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #9ca3af;
    background: rgba(156, 163, 175, 0.12);
    border: 1px solid rgba(156, 163, 175, 0.35);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
    width: fit-content;
}

.community-membership-status i {
    color: #9ca3af;
}

#communityActionBtn.is-joined {
    border-color: rgba(156, 163, 175, 0.45);
    color: #9ca3af;
}



.form-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1.5rem 0;
}



.form-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
}

.form-actions .btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.form-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.form-message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    display: none;
}

.form-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.form-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .profile-grid {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        /* Override grid's align-items:start — in a column flex, that shrinks cards to content width */
        align-items: stretch;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    /* Flatten columns so card order can match classic single-column flow */
    .profile-grid-column--stack {
        display: contents;
    }

    /* Every card is a direct flex child — prevent horizontal overflow / clipping on narrow viewports */
    .profile-grid > .profile-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    #profilePictureCard {
        order: 1;
    }

    #profileAccountSecurityCard {
        order: 2;
    }

    #profileThemeCard {
        order: 3;
    }

    #profileLocationCard {
        order: 4;
    }

    #accountStatsCard {
        order: 5;
    }

    /* Same as other cards: default order:0 would sort first; keep below Aktivität & Rang on narrow viewports */
    #profileCommunityCard {
        order: 6;
    }

    #profileCacheClearCard {
        order: 7;
    }
}

@media (max-width: 768px) {
    .profile-container {
        padding: 0.75rem 1rem 1rem;
        padding-bottom: 2rem;
    }
    
    .profile-container > .profile-title {
        font-size: 2.5rem;
    }
    
    .profile-card-header {
        padding: 1rem 1.5rem 0.75rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .profile-card-title-section {
        width: 100%;
    }
    
    .profile-card-title {
        margin-bottom: 0.25rem;
    }
    
    .profile-card-subtitle {
        margin-top: 0.25rem;
    }

    .profile-card-header-actions {
        align-self: flex-end;
        width: 100%;
        justify-content: flex-end;
        margin-left: 0;
    }
    
    .card-header-actions {
        align-self: flex-end;
        margin-top: 0;
    }
    
    .profile-form {
        padding: 1.5rem;
    }
    
    .profile-picture-container {
        width: 120px;
        height: 120px;
    }
    
    .profile-picture-wrapper {
        padding: 1.5rem;
    }
    
    .form-actions {
        justify-content: center;
    }

    .location-update-btn {
        right: 0.4rem;
        padding: 0.42rem 0.7rem;
    }
}

@media (max-width: 480px) {
    .profile-container {
        padding-top: 0.5rem;
        padding-bottom: 2rem;
    }
    
    .profile-container > .profile-title {
        font-size: 2.5rem;
    }
    
    .profile-card-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .profile-card-title-section {
        width: 100%;
    }
    
    .profile-card-title {
        margin-bottom: 0.25rem;
    }
    
    .profile-card-subtitle {
        margin-top: 0.25rem;
    }

    .profile-card-header-actions {
        align-self: flex-end;
        width: 100%;
        justify-content: flex-end;
        margin-left: 0;
    }
    
    .card-header-actions {
        align-self: flex-end;
        margin-top: 0;
    }
    
    .profile-form {
        padding: 1rem;
    }
    
    .profile-picture-container {
        width: 100px;
        height: 100px;
    }
    
    .profile-picture-wrapper {
        padding: 1rem;
    }

    .location-input-container {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .location-input-container .form-input {
        padding-right: 1rem;
    }

    .location-update-btn {
        position: static;
        transform: none;
        width: 100%;
        justify-content: center;
        padding: 0.55rem 0.75rem;
        font-size: 0.95rem;
    }
} 

/* Dark Mode adjustments for profile page */
[data-theme="dark"] .content-container {
    background: var(--bg-color);
}

/* Removed profile-header styling since we're no longer using that div */

[data-theme="dark"] .profile-title {
    color: var(--text-primary);
}

[data-theme="dark"] .profile-subtitle {
    color: var(--text-secondary);
}

[data-theme="dark"] .profile-card {
    background: var(--surface-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .profile-card-header {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .profile-card-title {
    color: var(--text-primary);
}

[data-theme="dark"] .profile-card-subtitle {
    color: var(--text-secondary);
}

[data-theme="dark"] .profile-card-content {
    color: var(--text-primary);
}

[data-theme="dark"] .form-group label {
    color: var(--text-primary);
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea {
    background: var(--input-background);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

[data-theme="dark"] .btn {
    background: var(--surface-color);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .btn:hover {
    background: var(--primary-color);
    color: white;
}

[data-theme="dark"] .btn-primary {
    background: var(--primary-color);
    color: white;
}

[data-theme="dark"] .btn-primary:hover {
    background: var(--primary-hover);
}

[data-theme="dark"] .btn-danger {
    background: var(--danger-color);
    color: white;
}

[data-theme="dark"] .btn-danger:hover {
    background: #dc2626;
}

[data-theme="dark"] .profile-picture-container {
    border-color: var(--border-color);
}

[data-theme="dark"] .profile-picture-overlay {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .profile-picture-remove-btn {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(148, 163, 184, 0.28);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .profile-picture-remove-btn i {
    color: #fb7185;
}

[data-theme="dark"] .profile-picture-remove-btn:hover {
    color: #f8fafc;
    background: rgba(244, 63, 94, 0.14);
    border-color: rgba(244, 63, 94, 0.45);
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.15);
}

[data-theme="dark"] .profile-picture-remove-btn:focus-visible {
    outline-color: #60a5fa;
}

/* Toggle Switch Styling for Profile */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    cursor: pointer;
}

.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
    background-color: var(--primary-color);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-switch:hover .toggle-slider {
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

/* Switch Row Layout */
.switch-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 1rem !important;
}

.switch-row .form-label {
    margin: 0 !important;
    font-weight: 500 !important;
}

/* Aktivität & Rang — Karte + Inhalt wie Admin „Top 10 aktive Nutzer“ */
.profile-card--account-stats {
    background: linear-gradient(
        160deg,
        color-mix(in srgb, var(--card-background) 92%, #3b82f6 8%),
        color-mix(in srgb, var(--card-background) 90%, #06b6d4 10%)
    );
}

.account-stats-body {
    padding: 1rem 1.5rem 1.5rem;
}

/* Kompakte Zeitauswahl in der Box (nicht im Header) */
.account-stats-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.55rem;
    margin-bottom: 0.85rem;
    padding: 0.4rem 0.55rem;
    border-radius: 10px;
    background: color-mix(in srgb, var(--surface-color) 88%, #0f172a 12%);
    border: 1px solid color-mix(in srgb, var(--border-color) 80%, #1d4ed8 20%);
}

.account-stats-toolbar-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
}

.account-stats-toolbar-select {
    padding: 0.32rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.3;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-primary);
    min-width: 118px;
    max-width: 100%;
}

.account-stats-toolbar-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.account-stats-toolbar-year {
    min-width: 140px;
}

@media (max-width: 520px) {
    .account-stats-toolbar {
        width: 100%;
    }

    .account-stats-toolbar-select {
        flex: 1 1 120px;
        min-width: 0;
    }
}

/* [hidden] must win over .account-stats-* display rules (otherwise loading never hides) */
.account-stats-loading[hidden],
.account-stats-content[hidden],
.account-stats-error[hidden] {
    display: none !important;
}

.account-stats-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 120px;
    color: var(--text-muted);
}

.account-stats-loading .spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.account-stats-content {
    display: block;
}

/* Gleiche Struktur wie .top-active-user-item im Admin */
.account-stats-user-panel {
    padding: 0.95rem 1rem;
    border: 1px solid color-mix(in srgb, var(--border-color) 75%, #3b82f6 25%);
    border-radius: 12px;
    background: color-mix(in srgb, var(--bg-color) 94%, #0f172a 6%);
}

.account-stats-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
}

.account-stats-rank {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    flex-shrink: 0;
}

.account-stats-user-name {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-stats-user-score {
    margin-left: auto;
    font-weight: 700;
    color: #22c55e;
    font-size: 0.92rem;
    white-space: nowrap;
}

.account-stats-detail-text {
    margin: 0;
}

.account-stats-line {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0.28rem 0 0;
    line-height: 1.45;
}

.account-stats-line:first-child {
    margin-top: 0;
}

.account-stats-divider {
    border: none;
    height: 0;
    margin: 0.65rem 0 0.75rem;
    border-top: 1px solid color-mix(in srgb, var(--border-color) 82%, #3b82f6 18%);
}

/* Balken wie Admin */
.account-stats-bar-wrap {
    width: 100%;
    height: 0.6rem;
    border-radius: 999px;
    overflow: hidden;
    background: color-mix(in srgb, var(--border-color) 76%, #0f172a 24%);
    margin-bottom: 0.65rem;
}

.account-stats-bar {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb 0%, #06b6d4 50%, #22c55e 100%);
    transition: width 0.45s ease;
}

/* Metrik-Chips wie .top-active-user-metrics */
.account-stats-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.account-stats-metrics span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding: 0.22rem 0.48rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-color) 85%, #0f172a 15%);
    border: 1px solid color-mix(in srgb, var(--border-color) 80%, #1d4ed8 20%);
}

.account-stats-metrics span i {
    flex-shrink: 0;
    opacity: 0.95;
}

.account-stats-error {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
}

/* Standalone card: app cache clear */
.profile-card--cache-clear {
    background: var(--card-background);
    border-left: 3px solid var(--primary-color);
}

.profile-card--cache-clear .profile-card-header {
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--primary-color) 12%, transparent),
        color-mix(in srgb, var(--card-background) 96%, #0f172a 4%)
    );
}

.profile-cache-clear-body {
    padding: 1.35rem 1.5rem 1.75rem;
}

@media (min-width: 1025px) {
    .profile-cache-clear-body {
        padding-bottom: 2.35rem;
    }
}

.profile-cache-clear-desc {
    margin: 0 0 1.25rem;
    max-width: 40rem;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.profile-cache-clear-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.profile-cache-clear-btn {
    min-height: 2.75rem;
    padding: 0.55rem 1.35rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--radius-md, 10px);
    box-shadow: 0 2px 6px color-mix(in srgb, var(--primary-color) 35%, transparent);
}

.profile-cache-clear-btn:disabled {
    opacity: 0.72;
    box-shadow: none;
}

.profile-cache-clear-footnote-wrap {
    margin-top: 1.35rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--border-color);
}

.profile-cache-clear-footnote {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--text-muted);
}

@media (max-width: 520px) {
    .profile-cache-clear-btn {
        width: 100%;
    }
}

/* Theme row: same stack as location-tracking (toggle + text) */
.profile-theme-settings {
    margin-bottom: 0;
}

/* Community card: subtle separator between toggle block and dropdown blocks */
.profile-community-section-divider {
    height: 0;
    margin: 1rem 0;
    padding: 0;
    border: 0;
    border-top: 1px solid color-mix(in srgb, var(--border-color) 92%, transparent);
}

@media (max-width: 520px) {
    .profile-community-section-divider {
        margin: 0.85rem 0;
    }
}

/* Community: follower / following list visibility (select + text, matches dark profile card) */
.setting-row--community-select {
    align-items: flex-start;
}

.profile-community-select-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.profile-community-visibility-select {
    min-width: 148px;
    max-width: 100%;
    padding: 0.42rem 0.65rem;
    font-size: 0.875rem;
    line-height: 1.35;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-primary);
    cursor: pointer;
    appearance: auto;
    background-image: linear-gradient(
        180deg,
        color-mix(in srgb, var(--surface-color) 92%, transparent),
        color-mix(in srgb, var(--bg-color) 88%, #0f172a)
    );
    box-shadow: 0 1px 0 color-mix(in srgb, var(--border-color) 65%, transparent);
}

.profile-community-visibility-select:hover {
    border-color: color-mix(in srgb, var(--primary-color) 45%, var(--border-color));
}

.profile-community-visibility-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

@media (max-width: 520px) {
    .setting-row--community-select {
        flex-wrap: wrap;
    }

    .profile-community-select-wrap {
        width: 100%;
        margin-bottom: 0.35rem;
    }

    .profile-community-visibility-select {
        width: 100%;
        min-width: 0;
    }
}

.profile-stats-compact .profile-stat-no-link {
    color: var(--text-primary);
    cursor: default;
    opacity: 0.92;
}

.profile-stats-compact .profile-stat-no-link strong {
    font-weight: 600;
}

/* Phone verification flow (profile page) */
.profile-phone-verify-field .phone-verify-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    flex-wrap: wrap;
}

.profile-phone-verify-field .phone-verify-row input[type='tel'] {
    flex: 1 1 160px;
    min-width: 0;
}

.profile-phone-verify-field .phone-verify-send-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.profile-phone-verify-field .phone-verified-line {
    margin-top: 0.35rem;
    font-size: 0.88rem;
    color: #059669;
    font-weight: 500;
}

.phone-verify-modal-overlay.modal-overlay {
    z-index: 10055;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.phone-verify-modal-content.modal-content {
    position: relative;
    max-width: 420px;
    width: 100%;
    padding: 1.75rem 1.5rem 1.5rem;
    border-radius: 16px;
    text-align: center;
}

.phone-verify-modal-close {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
}

.phone-verify-icon-wrap {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    border: 2px solid #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #10b981;
    font-size: 1.5rem;
}

.phone-verify-title {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.phone-verify-intro,
.phone-verify-target {
    margin: 0 0 0.35rem;
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.45;
}

.phone-verify-target {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: #0f172a;
}

.phone-verify-code-label {
    display: block;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #334155;
}

.phone-verify-code-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.phone-verify-digit {
    width: 3rem;
    height: 3rem;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
}

.phone-verify-help {
    margin: 0 0 1rem;
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.4;
    text-align: center;
}

.phone-verify-confirm-btn {
    width: 100%;
    margin-bottom: 0.35rem;
}

.phone-verify-resend-hint {
    margin: 0.25rem 0 0.5rem;
    font-size: 0.8rem;
    color: #b45309;
    text-align: center;
}

.phone-verify-resend--footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.25rem 0.4rem;
    margin: 0 0 0.35rem;
    padding: 0;
    border: none;
    text-align: right;
}

.phone-verify-resend-timer {
    font-size: 0.68rem;
    color: #94a3b8;
    line-height: 1.3;
    max-width: 11rem;
    text-align: right;
}

.phone-verify-resend-sep {
    font-size: 0.65rem;
    color: #cbd5e1;
    user-select: none;
}

.phone-verify-resend-btn {
    -webkit-tap-highlight-color: transparent;
    display: inline-block;
    font-size: 0.68rem !important;
    line-height: 1.2 !important;
    font-weight: 500;
    padding: 0.3rem 0.5rem !important;
    min-height: 0;
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
    text-decoration: none;
}

.phone-verify-resend-btn:hover,
.phone-verify-resend-btn:focus-visible {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
    outline: none;
}

.phone-verify-resend-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.phone-verify-resend-caption {
    margin: 0 0 0.15rem;
    font-size: 0.65rem;
    line-height: 1.35;
    color: #94a3b8;
    text-align: right;
}

[data-theme='dark'] .profile-phone-verify-field .phone-verified-line {
    color: #34d399;
}

[data-theme='dark'] .phone-verify-target {
    color: #e2e8f0;
}

[data-theme='dark'] .phone-verify-digit {
    background: #1e293b;
    border-color: #475569;
    color: #f8fafc;
}

[data-theme='dark'] .phone-verify-resend-btn {
    background: #1e293b;
    border-color: #475569;
    color: #cbd5e1;
}

/* Current phone summary (top of account security form) */
.profile-current-phone-summary {
    margin: 0 0 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md, 10px);
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--surface-color) 92%, var(--primary-color) 8%);
}

.profile-current-phone-summary__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1rem;
}

.profile-current-phone-summary__inner > .bi-phone {
    font-size: 1.35rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.profile-current-phone-summary__text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    flex: 1 1 160px;
}

.profile-current-phone-summary__label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.profile-current-phone-summary__value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-all;
}

.profile-current-phone-summary__value.is-empty {
    font-weight: 500;
    color: var(--text-muted);
}

.profile-current-phone-summary__badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: color-mix(in srgb, #16a34a 22%, transparent);
    color: #15803d;
    border: 1px solid color-mix(in srgb, #22c55e 40%, transparent);
    flex-shrink: 0;
}

[data-theme='dark'] .profile-current-phone-summary__badge {
    color: #86efac;
    background: color-mix(in srgb, #16a34a 28%, transparent);
    border-color: color-mix(in srgb, #22c55e 35%, transparent);
}

.profile-current-phone-summary__pending-hint {
    margin: 0.65rem 0 0;
    padding: 0;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-muted);
}