/* VI: Trang About dạng bio-link kiểu guns.lol: nền động, thẻ kính mờ, tên phát sáng, link mạng xã hội.
EN: guns.lol-style bio-link About page: animated background, glass card, glowing name, social links. */

#view-about {
    max-width: none;
}

.profile-stage {
    --profile-accent: #8b7bff;
    --glass: rgba(14, 14, 24, 0.42);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-soft: rgba(255, 255, 255, 0.06);
    --profile-text: #ffffff;
    --profile-muted: rgba(255, 255, 255, 0.68);
    position: relative;
    isolation: isolate;
    display: grid;
    place-items: center;
    min-height: calc(100dvh - var(--header-height) - 64px);
    padding: var(--space-8) var(--space-4);
    border-radius: var(--radius-xl);
    overflow: hidden;
    color: var(--profile-text);
}

[data-theme="light"] .profile-stage {
    --glass: rgba(255, 255, 255, 0.55);
    --glass-border: rgba(255, 255, 255, 0.7);
    --glass-soft: rgba(20, 24, 40, 0.05);
    --profile-text: #14161d;
    --profile-muted: rgba(20, 22, 30, 0.62);
}

/* ---------- Background ---------- */
.profile-bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    background-size: 200% 200%;
    background-position: center;
    animation: bg-pan 40s ease-in-out infinite alternate;
}

.profile-bg.bg-aurora {
    background-image:
        radial-gradient(40% 50% at 20% 30%, rgba(139, 123, 255, 0.55), transparent 70%),
        radial-gradient(45% 55% at 80% 20%, rgba(43, 179, 154, 0.45), transparent 70%),
        radial-gradient(50% 60% at 60% 90%, rgba(236, 72, 153, 0.35), transparent 70%),
        linear-gradient(160deg, #07060f, #0d0b1e);
}

.profile-bg.bg-sunset {
    background-image:
        radial-gradient(50% 60% at 20% 80%, rgba(255, 122, 89, 0.6), transparent 70%),
        radial-gradient(45% 55% at 80% 30%, rgba(236, 72, 153, 0.5), transparent 70%),
        linear-gradient(170deg, #1a0b1f, #2a0f22);
}

.profile-bg.bg-ocean {
    background-image:
        radial-gradient(50% 60% at 30% 20%, rgba(56, 189, 248, 0.45), transparent 70%),
        radial-gradient(50% 60% at 75% 85%, rgba(91, 140, 240, 0.5), transparent 70%),
        linear-gradient(180deg, #03111f, #061a33);
}

.profile-bg.bg-night {
    background-image:
        radial-gradient(60% 40% at 50% 0%, rgba(139, 123, 255, 0.25), transparent 70%),
        linear-gradient(180deg, #05060d, #0b0d18);
}

.profile-bg.bg-custom {
    background-color: #0b0d14;
    background-size: cover;
    animation: none;
}

/* VI: Lớp phủ tối cho ảnh tuỳ chỉnh để chữ luôn đọc được. EN: Dark overlay on custom images so text stays readable. */
.profile-bg.bg-custom::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}

[data-theme="light"] .profile-bg.bg-aurora {
    background-image:
        radial-gradient(40% 50% at 20% 30%, rgba(139, 123, 255, 0.45), transparent 70%),
        radial-gradient(45% 55% at 80% 20%, rgba(43, 179, 154, 0.35), transparent 70%),
        radial-gradient(50% 60% at 60% 90%, rgba(236, 72, 153, 0.3), transparent 70%),
        linear-gradient(160deg, #eef0ff, #f6f1ff);
}

[data-theme="light"] .profile-bg.bg-sunset {
    background-image:
        radial-gradient(50% 60% at 20% 80%, rgba(255, 122, 89, 0.45), transparent 70%),
        radial-gradient(45% 55% at 80% 30%, rgba(236, 72, 153, 0.35), transparent 70%),
        linear-gradient(170deg, #fff1ec, #ffeef6);
}

[data-theme="light"] .profile-bg.bg-ocean {
    background-image:
        radial-gradient(50% 60% at 30% 20%, rgba(56, 189, 248, 0.4), transparent 70%),
        radial-gradient(50% 60% at 75% 85%, rgba(91, 140, 240, 0.4), transparent 70%),
        linear-gradient(180deg, #ecf7ff, #eaf0ff);
}

[data-theme="light"] .profile-bg.bg-night {
    background-image:
        radial-gradient(60% 40% at 50% 0%, rgba(139, 123, 255, 0.25), transparent 70%),
        linear-gradient(180deg, #e9ebf5, #f4f5fb);
}

@keyframes bg-pan {
    from { background-position: 0% 0%; }
    to { background-position: 100% 100%; }
}

/* ---------- Particles ---------- */
.profile-particles {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.profile-particles span {
    position: absolute;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: #fff;
}

[data-theme="light"] .profile-particles span {
    background: var(--profile-accent);
}

.effect-snow span {
    top: -10px;
    opacity: 0.75;
    animation: snow-fall linear infinite;
}

.effect-stars span {
    bottom: -10px;
    box-shadow: 0 0 6px 1px var(--profile-accent);
    animation: star-rise linear infinite;
}

@keyframes snow-fall {
    to { transform: translate(var(--drift), calc(100dvh + 20px)); }
}

@keyframes star-rise {
    0% { transform: translate(0, 0); opacity: 0; }
    20% { opacity: 0.6; }
    80% { opacity: 0.5; }
    100% { transform: translate(var(--drift), calc(-100dvh - 20px)); opacity: 0; }
}

/* ---------- Corner controls ---------- */
.profile-views,
.profile-edit-btn {
    position: absolute;
    top: var(--space-4);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--profile-text);
    font-size: 13px;
    font-weight: 600;
    z-index: 2;
}

.profile-views {
    left: var(--space-4);
}

.profile-edit-btn {
    right: var(--space-4);
    transition: background var(--transition);
}

.profile-edit-btn:hover {
    background: color-mix(in srgb, var(--profile-accent) 35%, var(--glass));
}

/* ---------- Card ---------- */
.profile-card {
    position: relative;
    width: min(460px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-8) var(--space-6) var(--space-6);
    border-radius: 26px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35), 0 0 60px color-mix(in srgb, var(--profile-accent) 18%, transparent);
    text-align: center;
    transition: transform 200ms ease-out, filter 500ms ease, opacity 500ms ease;
    will-change: transform;
}

.profile-avatar-wrap {
    position: relative;
    margin-bottom: var(--space-1);
}

.profile-avatar {
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--profile-accent), #2bb39a);
    background-size: cover;
    background-position: center;
    color: #fff;
    font-size: 46px;
    font-weight: 800;
    box-shadow:
        0 0 0 4px color-mix(in srgb, var(--profile-accent) 45%, transparent),
        0 0 40px color-mix(in srgb, var(--profile-accent) 55%, transparent);
    animation: avatar-glow 9s ease-in-out infinite;
}

@keyframes avatar-glow {
    50% {
        box-shadow:
            0 0 0 6px color-mix(in srgb, var(--profile-accent) 30%, transparent),
            0 0 60px color-mix(in srgb, var(--profile-accent) 70%, transparent);
    }
}

.profile-status-dot {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 4px solid #15151f;
    background: #f0b232;
}

[data-theme="light"] .profile-status-dot {
    border-color: #f3f3f8;
}

.status-online { background: #23a55a; }
.status-busy { background: #f23f43; }
.status-idle { background: #f0b232; }

.profile-name {
    position: relative;
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    background: linear-gradient(90deg, var(--profile-text) 0%, var(--profile-accent) 45%, var(--profile-text) 90%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--profile-accent) 70%, transparent));
    animation: name-shine 14s linear infinite;
}

/* VI: Hai tia lấp lánh cạnh tên. EN: Two sparkles beside the name. */
.profile-name::before,
.profile-name::after {
    content: '✦';
    position: absolute;
    font-size: 14px;
    color: #fff;
    -webkit-text-fill-color: #fff;
    text-shadow: 0 0 8px var(--profile-accent);
    animation: sparkle 7s ease-in-out infinite;
}

.profile-name::before { left: -18px; top: -2px; }
.profile-name::after { right: -16px; bottom: 0; animation-delay: 3.5s; font-size: 11px; }

@keyframes name-shine {
    to { background-position: -200% center; }
}

@keyframes sparkle {
    0%, 100% { opacity: 0.25; transform: scale(0.7) rotate(0deg); }
    50% { opacity: 0.85; transform: scale(1) rotate(45deg); }
}

.profile-handle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--profile-muted);
    font-size: 14px;
    font-weight: 500;
}

.profile-badges {
    display: inline-flex;
    gap: 4px;
}

.profile-badge {
    position: relative;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: var(--glass-soft);
    color: var(--profile-accent);
    font-size: 15px;
    filter: drop-shadow(0 0 4px color-mix(in srgb, var(--profile-accent) 60%, transparent));
}

/* Tooltips for badges and links */
[data-tip] {
    position: relative;
}

[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translate(-50%, 4px);
    padding: 4px 8px;
    border-radius: 6px;
    background: #111;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease, transform 120ms ease;
    z-index: 5;
}

[data-tip]:hover::after,
[data-tip]:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.profile-bio {
    min-height: 24px;
    max-width: 360px;
    color: var(--profile-text);
    font-size: 15.5px;
    font-weight: 500;
}

.type-caret {
    margin-left: 1px;
    color: var(--profile-accent);
    animation: caret-blink 1.8s ease-in-out infinite;
}

@keyframes caret-blink {
    50% { opacity: 0.25; }
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 14px;
    color: var(--profile-muted);
    font-size: 13px;
}

.profile-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Discord-like presence */
.presence-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    margin-top: var(--space-2);
    padding: var(--space-3);
    border-radius: 16px;
    background: var(--glass-soft);
    border: 1px solid var(--glass-border);
    text-align: left;
}

.presence-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--profile-accent), color-mix(in srgb, var(--profile-accent) 40%, #000));
    color: #fff;
    font-size: 26px;
}

.presence-icon[data-status="busy"] {
    animation: avatar-glow 9s ease-in-out infinite;
}

.presence-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.presence-label {
    color: var(--profile-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.presence-title {
    font-weight: 700;
    font-size: 14.5px;
}

.presence-sub {
    color: var(--profile-muted);
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.profile-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-2);
}

.profile-link {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--profile-text);
    font-size: 26px;
    text-decoration: none;
    transition: transform var(--transition), color var(--transition), filter var(--transition);
}

.profile-link:hover {
    color: var(--profile-accent);
    transform: translateY(-3px) scale(1.08);
    filter: drop-shadow(0 0 10px var(--profile-accent));
}

/* ---------- Click to enter ---------- */
.profile-enter {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    place-items: center;
    background: rgba(5, 6, 10, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.08em;
    transition: opacity 600ms ease, visibility 600ms;
}

.profile-enter span {
    animation: enter-pulse 5s ease-in-out infinite;
    text-shadow: 0 0 18px var(--profile-accent);
}

@keyframes enter-pulse {
    50% { opacity: 0.7; }
}

.profile-stage.entered .profile-enter {
    opacity: 0;
    visibility: hidden;
}

.profile-stage:not(.entered) .profile-card {
    filter: blur(4px);
    transform: scale(0.96);
}

/* ---------- Edit profile dialog ---------- */
.profile-form {
    max-width: 620px;
}

.profile-form-scroll {
    max-height: min(62vh, 560px);
    overflow-y: auto;
    margin: 0 calc(-1 * var(--space-2));
    padding: 0 var(--space-2);
}

.form-section {
    margin: var(--space-4) 0 var(--space-2);
    color: var(--text-faint) !important;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.form-section:first-child {
    margin-top: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.form-grid .span-2 {
    grid-column: 1 / -1;
}

/* VI: Chọn avatar: xem trước + link + tải ảnh từ máy. EN: Avatar picker: preview + link + upload from device. */
.avatar-picker {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.avatar-picker input[type="url"] {
    flex: 1;
    min-width: 0;
}

.avatar-preview {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-2) center / cover no-repeat;
    border: 1px solid var(--border);
}

.avatar-picker .btn-sm {
    flex: none;
    cursor: pointer;
}

.form-grid .input-group > span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-grid textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    font: inherit;
    color: inherit;
    resize: vertical;
    outline: none;
}

.form-grid textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-grid input[type="color"] {
    width: 100%;
    height: 42px;
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
    cursor: pointer;
}

.badge-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge-option {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-faint);
    font-size: 18px;
    transition: all var(--transition);
}

.badge-option.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

/* VI: Tắt hết chuyển động khi người dùng bật "giảm chuyển động". EN: Turn motion off for prefers-reduced-motion. */
@media (prefers-reduced-motion: reduce) {
    .profile-stage *,
    .profile-stage *::before,
    .profile-stage *::after {
        animation: none !important;
    }

    .profile-particles {
        display: none;
    }
}

@media (max-width: 860px) {
    .profile-stage {
        min-height: calc(100dvh - 210px);
        padding: 64px var(--space-3) var(--space-6);
        border-radius: var(--radius-lg);
    }

    .profile-card {
        padding: var(--space-6) var(--space-4) var(--space-5);
    }

    .profile-name {
        font-size: 30px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- Public link in the edit dialog ---------- */
.profile-public-link {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    background: var(--surface-2, rgba(127, 127, 127, 0.08));
    color: var(--text-muted);
    font-size: 13px;
    word-break: break-all;
}

.profile-public-link a {
    color: var(--accent, #8b7bff);
    font-weight: 600;
}

/* ---------- Public page (/@username): only the card, full screen ---------- */
.profile-home-link {
    display: none;
}

body.public-mode .sidebar,
body.public-mode .header-bar,
body.public-mode .profile-edit-btn {
    display: none;
}

body.public-mode .view-scroll {
    padding: 0;
}

body.public-mode .profile-stage {
    min-height: 100dvh;
    border-radius: 0;
}

body.public-mode .profile-home-link {
    position: absolute;
    bottom: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--profile-muted);
    font-size: 12px;
    text-decoration: none;
}

body.public-mode .profile-home-link:hover {
    color: var(--profile-text);
}
