/* ============================================
   PROFILE PAGE STYLES - CHATFLY 2026
   Public profiles at chatfly.app/@username
   ============================================ */

/* Profile Page Container */
.profile-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px 60px;
    position: relative;
}

/* Back Button */
.profile-back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-elevated, #16161f);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    color: var(--text-secondary, #a0a0b0);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.profile-back-btn:hover {
    background: var(--bg-hover, #1e1e2a);
    color: #06b6d4;
    border-color: #06b6d4;
}

.profile-back-btn svg {
    width: 20px;
    height: 20px;
}

/* Edit Button */
.profile-edit-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-elevated, #16161f);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    color: var(--text-secondary, #a0a0b0);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.profile-edit-btn:hover {
    background: var(--bg-hover, #1e1e2a);
    color: #06b6d4;
    border-color: #06b6d4;
}

.profile-edit-btn svg {
    width: 18px;
    height: 18px;
}

/* Profile Card */
.profile-card {
    width: 100%;
    max-width: 600px;
    background: #1e293b;
    border-radius: 16px;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    padding: 40px 32px 32px;
    margin-top: 40px;
}

/* Profile Header */
.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #06b6d4;
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
    background: var(--bg-elevated, #16161f);
}

.profile-avatar-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid #06b6d4;
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
    background: var(--bg-elevated, #16161f);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    color: #06b6d4;
}

.profile-username-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-username {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.profile-tier-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-tier-badge--starter {
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.profile-tier-badge--pro {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.profile-tier-badge--business {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.profile-level {
    font-size: 0.85rem;
    color: var(--text-secondary, #a0a0b0);
    font-weight: 500;
}

/* Online Status */
.profile-online-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.profile-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.profile-online-dot--online {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    animation: profile-pulse-online 2s ease-in-out infinite;
}

.profile-online-dot--offline {
    background: #6b7280;
}

@keyframes profile-pulse-online {
    0%, 100% { box-shadow: 0 0 8px rgba(34, 197, 94, 0.4); }
    50% { box-shadow: 0 0 16px rgba(34, 197, 94, 0.8); }
}

.profile-online-text {
    color: #22c55e;
}

.profile-offline-text {
    color: #6b7280;
}

/* Bio Section */
.profile-bio {
    text-align: center;
    color: var(--text-secondary, #a0a0b0);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 24px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    word-break: break-word;
}

/* Section Headings */
.profile-section-heading {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted, #606070);
    margin-bottom: 12px;
    padding-left: 4px;
}

/* Social Links */
.profile-social-links {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.profile-social-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-elevated, #16161f);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary, #a0a0b0);
    text-decoration: none;
}

.profile-social-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.profile-social-btn:hover {
    transform: translateY(-2px);
}

.profile-social-btn--twitter:hover {
    background: #1DA1F2;
    border-color: #1DA1F2;
    color: #fff;
}

.profile-social-btn--instagram:hover {
    background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    border-color: #dc2743;
    color: #fff;
}

.profile-social-btn--facebook:hover {
    background: #1877F2;
    border-color: #1877F2;
    color: #fff;
}

.profile-social-btn--youtube:hover {
    background: #FF0000;
    border-color: #FF0000;
    color: #fff;
}

.profile-social-btn--tiktok:hover {
    background: #000;
    border-color: #69C9D0;
    color: #fff;
    box-shadow: 0 0 12px rgba(105, 201, 208, 0.4);
}

/* Custom Links (Linktree style) */
.profile-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.profile-link-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: var(--bg-elevated, #16161f);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 12px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-link-btn:hover {
    border-color: #06b6d4;
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.2);
    transform: translateY(-1px);
    color: #fff;
}

/* Subdomain Links */
.profile-subdomains {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.profile-subdomain-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-elevated, #16161f);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 12px;
    color: #fff;
    text-decoration: none;
    transition: all 0.2s ease;
}

.profile-subdomain-link:hover {
    border-color: #06b6d4;
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.2);
    color: #fff;
}

.profile-subdomain-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.profile-subdomain-icon--forumfly {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.profile-subdomain-icon--chatwit {
    background: rgba(6, 182, 212, 0.15);
    color: #06b6d4;
}

.profile-subdomain-info {
    display: flex;
    flex-direction: column;
}

.profile-subdomain-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.profile-subdomain-url {
    font-size: 0.75rem;
    color: var(--text-muted, #606070);
}

/* Game Scores */
.profile-game-scores {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 24px;
}

.profile-game-card {
    background: var(--bg-elevated, #16161f);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}

.profile-game-icon {
    font-size: 1.5rem;
    margin-bottom: 6px;
}

.profile-game-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary, #a0a0b0);
    margin-bottom: 6px;
}

.profile-game-stat {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.profile-game-stat--wins {
    color: #22c55e;
}

.profile-game-stat--losses {
    color: #ef4444;
}

.profile-game-winrate {
    font-size: 0.7rem;
    color: var(--text-muted, #606070);
    margin-top: 2px;
}

.profile-game-elo {
    font-size: 0.75rem;
    color: #eab308;
    margin-top: 2px;
}

/* Badges */
.profile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.profile-badge {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--bg-elevated, #16161f);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: default;
}

.profile-badge-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 20;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}

.profile-badge-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #0f172a;
}

.profile-badge:hover .profile-badge-tooltip {
    opacity: 1;
}

/* Loading State */
.profile-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
    color: var(--text-secondary, #a0a0b0);
}

.profile-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border, rgba(255, 255, 255, 0.08));
    border-top-color: #06b6d4;
    border-radius: 50%;
    animation: profile-spin 0.8s linear infinite;
}

@keyframes profile-spin {
    to { transform: rotate(360deg); }
}

/* Error State */
.profile-error {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary, #a0a0b0);
}

.profile-error-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.profile-error-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.profile-error-msg {
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.profile-error-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: #06b6d4;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.profile-error-btn:hover {
    background: #0891b2;
}

/* ============================================
   EDIT MODE
   ============================================ */

.profile-edit-mode {
    width: 100%;
    max-width: 600px;
    margin-top: 40px;
}

.profile-edit-card {
    background: #1e293b;
    border-radius: 16px;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    padding: 32px;
}

.profile-edit-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 24px;
    text-align: center;
}

.profile-edit-group {
    margin-bottom: 20px;
}

.profile-edit-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary, #a0a0b0);
    margin-bottom: 6px;
}

.profile-edit-input,
.profile-edit-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-elevated, #16161f);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.profile-edit-input:focus,
.profile-edit-textarea:focus {
    outline: none;
    border-color: #06b6d4;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.profile-edit-textarea {
    resize: vertical;
    min-height: 80px;
}

.profile-edit-char-count {
    font-size: 0.75rem;
    color: var(--text-muted, #606070);
    text-align: right;
    margin-top: 4px;
}

.profile-edit-char-count--over {
    color: #ef4444;
}

/* Input with prefix */
.profile-edit-input-prefix {
    display: flex;
    align-items: center;
    background: var(--bg-elevated, #16161f);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.profile-edit-input-prefix:focus-within {
    border-color: #06b6d4;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.profile-edit-input-prefix span {
    padding: 10px 0 10px 14px;
    color: var(--text-muted, #606070);
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.profile-edit-input-prefix input {
    flex: 1;
    padding: 10px 14px 10px 2px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.9rem;
    font-family: inherit;
    min-width: 0;
}

.profile-edit-input-prefix input:focus {
    outline: none;
}

/* Social input row */
.profile-edit-social-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.profile-edit-social-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-elevated, #16161f);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary, #a0a0b0);
    flex-shrink: 0;
}

.profile-edit-social-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.profile-edit-social-row .profile-edit-input {
    flex: 1;
}

/* Custom links edit */
.profile-edit-link-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.profile-edit-link-row .profile-edit-input {
    flex: 1;
}

.profile-edit-link-remove {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.profile-edit-link-remove:hover {
    background: rgba(239, 68, 68, 0.2);
}

.profile-edit-add-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px dashed var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 8px;
    color: var(--text-secondary, #a0a0b0);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-edit-add-link:hover {
    border-color: #06b6d4;
    color: #06b6d4;
}

/* Toggle */
.profile-edit-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.profile-edit-toggle-label {
    font-size: 0.9rem;
    color: var(--text-secondary, #a0a0b0);
}

.profile-edit-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.profile-edit-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.profile-edit-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-elevated, #16161f);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 24px;
    transition: all 0.2s ease;
}

.profile-edit-switch-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    top: 2px;
    background: var(--text-secondary, #a0a0b0);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.profile-edit-switch input:checked + .profile-edit-switch-slider {
    background: rgba(6, 182, 212, 0.2);
    border-color: #06b6d4;
}

.profile-edit-switch input:checked + .profile-edit-switch-slider::before {
    transform: translateX(20px);
    background: #06b6d4;
}

/* Edit action buttons */
.profile-edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.profile-edit-save {
    flex: 1;
    padding: 12px;
    background: #06b6d4;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.profile-edit-save:hover {
    background: #0891b2;
}

.profile-edit-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.profile-edit-cancel {
    flex: 1;
    padding: 12px;
    background: transparent;
    color: var(--text-secondary, #a0a0b0);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-edit-cancel:hover {
    border-color: var(--text-secondary, #a0a0b0);
    color: #fff;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
    .profile-page {
        padding: 16px 12px 40px;
    }

    .profile-card {
        padding: 32px 20px 24px;
        margin-top: 32px;
        border-radius: 12px;
    }

    .profile-avatar,
    .profile-avatar-placeholder {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }

    .profile-username {
        font-size: 1.25rem;
    }

    .profile-game-scores {
        grid-template-columns: 1fr;
    }

    .profile-back-btn,
    .profile-edit-btn {
        width: 36px;
        height: 36px;
        top: 12px;
    }

    .profile-back-btn {
        left: 12px;
    }

    .profile-edit-btn {
        right: 12px;
    }

    .profile-edit-card {
        padding: 24px 16px;
    }

    .profile-edit-link-row {
        flex-direction: column;
    }

    .profile-edit-link-remove {
        width: 100%;
        height: 32px;
    }

    .profile-edit-actions {
        flex-direction: column;
    }
}
