/* =====================================================
   PROFILE.CSS - Public Profile Page (محدث)
   ===================================================== */

.public-profile {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: var(--space-12) var(--space-4) var(--space-8);
    background: var(--outer-bg-color, transparent);
    /* Use transparent as default fallback */
    position: relative;
    z-index: 1;
    /* Keep above fixed background if needed */
}

/* Support for Text Gradients */
.text-gradient {
    display: inline-block;
    background-clip: text !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
}

/* Global YouTube Background */
.public-profile-youtube-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.public-profile-youtube-bg iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 100vh;
    transform: translate(-50%, -50%) scale(1.15);
    /* Scale up slightly to hide YT controls/brand */
    pointer-events: none;
    border: none;
    opacity: 0.95;
}

@media (min-aspect-ratio: 16/9) {
    .public-profile-youtube-bg iframe {
        height: 56.25vw;
        /* 100vw * 9/16 */
    }
}

@media (max-aspect-ratio: 16/9) {
    .public-profile-youtube-bg iframe {
        width: 177.78vh;
        /* 100vh * 16/9 */
    }
}

/* === Profile Card === */
.profile-container {
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 2;
    background: var(--surface-primary);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-3xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg), 0 0 20px var(--card-glow-color, rgba(124, 58, 237, 0.4));
}

/* === Header (Cover + Avatar) === */
.profile-header {
    position: relative;
    height: 220px;
}

.profile-cover {
    height: 100%;
    background: var(--gradient-primary);
    position: relative;
    overflow: hidden;
}

.profile-cover-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-cover {
    height: 100%;
    background: var(--gradient-primary);
    position: relative;
    overflow: hidden;
}

.profile-cover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.4));
}

.profile-avatar-wrapper {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--bg-primary);
    padding: 4px;
    box-shadow: 0 0 30px var(--avatar-glow-color, rgba(124, 58, 237, 0.3));
}

.profile-avatar-large {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: inherit;
    object-fit: cover;
    border: 3px solid var(--avatar-border-color, var(--primary-500));
    transition: transform var(--transition-base);
}

.profile-avatar-large:hover {
    transform: scale(1.05);
}

/* Avatar shapes */
.profile-avatar-wrapper.shape-circle {
    border-radius: 50%;
}

.profile-avatar-wrapper.shape-square {
    border-radius: 0;
}

.profile-avatar-wrapper.shape-rounded {
    border-radius: var(--radius-lg);
}

/* === Profile Info Body === */
.profile-info {
    text-align: center;
    padding: calc(56px + var(--space-6)) var(--space-8) var(--space-8);
    background: transparent;
    backdrop-filter: blur(20px);
}

.profile-name-large {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: var(--space-1);
    letter-spacing: -0.02em;
    color: var(--name-color, var(--text-primary));
}

.profile-username-large {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-400);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
}

.verified-badge {
    color: var(--verified-badge-color, var(--primary-500));
    margin-right: var(--space-2);
    font-size: 1.1rem;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.4));
}


.profile-bio-large {
    color: var(--text-tertiary);
    max-width: 480px;
    margin: 0 auto var(--space-6);
    line-height: 1.7;
    font-size: 0.95rem;
    white-space: pre-wrap;
}

/* === Stats Bar === */
.profile-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    background: var(--stats-bg-color, var(--surface-secondary));
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-xl);
    padding: var(--space-4) var(--space-8);
    margin-bottom: var(--space-8);
    width: fit-content;
    margin-inline: auto;
}

.profile-stats.hidden {
    display: none;
}

.stat-item {
    text-align: center;
    padding: 0 var(--space-6);
}

.stat-item:not(:last-child) {
    border-right: 1px solid var(--border-secondary);
}

[dir="rtl"] .stat-item:not(:last-child) {
    border-right: none;
    border-left: 1px solid var(--border-secondary);
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--stats-text-color, var(--primary-400));
    line-height: 1;
    margin-bottom: var(--space-1);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--stats-text-color, var(--text-tertiary));
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

/* === Links Section === */
.profile-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.profile-social-icons {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
    flex-wrap: wrap;
}

.social-icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--social-icon-bg, var(--surface-secondary));
    border: 1px solid var(--social-icon-border, var(--border-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--social-icons-color, var(--text-secondary));
    font-size: 1.1rem;
    transition: all var(--transition-base);
}

.profile-link-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    background: var(--surface-secondary);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-xl);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-spring);
    position: relative;
    overflow: hidden;
}

/* حركات لفت الانتباه للروابط المميزة */
.profile-link-card--highlight-bounce {
    animation: linkBounce 1.8s ease-in-out infinite;
}

.profile-link-card--highlight-pulse {
    animation: linkPulse 1.6s ease-in-out infinite;
}

@keyframes linkBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    20% {
        transform: translateY(-4px);
    }

    40% {
        transform: translateY(0);
    }

    60% {
        transform: translateY(-2px);
    }

    80% {
        transform: translateY(0);
    }
}

@keyframes linkPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: var(--shadow-sm);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
    }
}

.profile-link-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.profile-link-card:hover {
    border-color: var(--primary-400);
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-md), var(--glow-primary);
    background: var(--surface-hover);
    color: var(--text-primary);
}

/* Link icon shapes */
.profile-link-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 1;
}

.profile-link-icon.shape-circle {
    border-radius: 50%;
}

.profile-link-icon.shape-square {
    border-radius: 0;
}

.profile-link-icon.shape-rounded-square {
    border-radius: var(--radius-lg);
}

.profile-link-icon.shape-rectangle {
    border-radius: var(--radius-md);
    width: 60px;
}

.profile-link-content {
    flex: 1;
    text-align: right;
    min-width: 0;
    position: relative;
    z-index: 1;
}

[dir="ltr"] .profile-link-content {
    text-align: left;
}

.profile-link-title {
    font-weight: 700;
    margin-bottom: 2px;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-link-url {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.profile-link-arrow {
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.profile-link-card:hover .profile-link-arrow {
    color: var(--primary-400);
    transform: translateX(-4px);
}

[dir="ltr"] .profile-link-card:hover .profile-link-arrow {
    transform: translateX(4px);
}

/* === Empty Links === */
.empty-links-message {
    text-align: center;
    color: var(--text-tertiary);
    padding: var(--space-10);
    font-size: 0.95rem;
}

/* Rich Embeds داخل صفحة البروفايل */
.profile-embed-wrapper {
    margin-top: -10px;
    margin-bottom: var(--space-3);
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--surface-secondary);
    border: 1px solid var(--border-secondary);
}

.profile-embed {
    position: relative;
    width: 100%;
}

.profile-embed iframe {
    display: block;
    width: 100%;
    border: none;
}

.profile-embed--youtube iframe {
    aspect-ratio: 16 / 9;
    min-height: 180px;
}

.profile-embed--spotify iframe {
    min-height: 152px;
}

.profile-embed--soundcloud iframe {
    min-height: 180px;
}

.profile-embed--twitter {
    padding: var(--space-3);
}

/* === QR Section === */
.qr-section {
    margin-top: var(--space-8);
    padding: var(--space-6);
    background: var(--surface-secondary);
    border: 1px dashed var(--border-primary);
    border-radius: var(--radius-2xl);
    text-align: center;
}

.qr-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.qr-title i {
    color: var(--qr-title-color, var(--primary-400));
    margin-left: var(--space-2);
}

.qr-code-container {
    display: inline-flex;
    background: white;
    padding: var(--space-4);
    border-radius: var(--radius-xl);
    margin: var(--space-2) 0;
    box-shadow: var(--shadow-glow-sm);
}

.qr-note {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin: 0;
}

/* === Profile Footer === */
.profile-footer {
    margin-top: var(--space-8);
    color: var(--name-color, var(--text-tertiary));
    font-size: 0.8rem;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.profile-footer i.fa-link {
    color: var(--name-color, var(--text-tertiary));
}

.profile-footer a {
    color: var(--qr-title-color, var(--primary-400));
    font-weight: 700;
}

/* === Skeleton Loader === */
.skeleton-profile {
    width: 600px;
    max-width: 90vw;
    background: var(--surface-primary);
    border-radius: var(--radius-3xl);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-secondary);
}

.skeleton-banner {
    height: 180px;
    background: var(--surface-secondary);
    animation: pulse 1.5s infinite;
}

.skeleton-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--surface-tertiary);
    position: absolute;
    top: 130px;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid var(--surface-primary);
    animation: pulse 1.5s infinite;
}

.skeleton-title {
    width: 200px;
    height: 24px;
    background: var(--surface-secondary);
    border-radius: var(--radius-sm);
    margin: 60px auto 10px;
    animation: pulse 1.5s infinite;
}

.skeleton-bio {
    width: 300px;
    height: 14px;
    background: var(--surface-secondary);
    border-radius: var(--radius-sm);
    margin: 0 auto 30px;
    animation: pulse 1.5s infinite;
}

.skeleton-links {
    padding: 0 var(--space-6) var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.skeleton-link {
    height: 60px;
    background: var(--surface-secondary);
    border-radius: var(--radius-xl);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 0.3;
    }

    100% {
        opacity: 0.6;
    }
}

/* === Animations === */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === Not Found === */
.not-found-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    gap: var(--space-4);
}

.not-found-icon {
    font-size: 5rem;
    color: var(--error-500);
    opacity: 0.7;
}

.not-found-code {
    font-size: 5rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
}

.not-found-text {
    color: var(--text-tertiary);
    margin: 0;
    font-size: 1.1rem;
}

/* === Responsive === */
@media (max-width: 576px) {
    .profile-stats {
        flex-direction: column;
        width: 100%;
        gap: 0;
        padding: 0;
    }

    .stat-item {
        padding: var(--space-3) var(--space-4);
        border-right: none !important;
        border-left: none !important;
        border-bottom: 1px solid var(--border-secondary);
    }

    .stat-item:last-child {
        border-bottom: none;
    }

    .profile-info {
        padding: calc(56px + var(--space-5)) var(--space-5) var(--space-6);
    }

    .profile-name-large {
        font-size: 1.6rem;
    }
}

/* Verified badge */
.verified-badge {
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.4));
    animation: fadeIn 0.3s ease;
    transition: transform 0.2s ease;
}

.verified-badge:hover {
    transform: scale(1.1);
}

/* === Folders on Profile === */
.profile-folder-group {
    background: var(--folder-header-color, var(--surface-secondary));
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: var(--space-2);
    transition: all var(--transition-base);
}

.profile-folder-header {
    padding: var(--space-4) var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
}

.profile-folder-header:hover {
    background: var(--surface-hover);
}

.profile-folder-title {
    flex: 1;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    text-align: right;
}

[dir="ltr"] .profile-folder-title {
    text-align: left;
}

.profile-folder-arrow {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    transition: transform var(--transition-base);
}

.profile-folder-links {
    display: none;
    padding: 0 var(--space-4) var(--space-4);
    flex-direction: column;
    gap: var(--space-2);
}

.profile-folder-group.open .profile-folder-links {
    display: flex;
    animation: slideDown 0.3s ease;
}

.profile-folder-group.open .profile-folder-arrow {
    transform: rotate(180deg);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Social Icons === */
.profile-social-icons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.profile-social-icon {
    font-size: 1.4rem;
    color: var(--social-icons-color, inherit);
    transition: all var(--transition-base);
}

.profile-social-icon:hover {
    color: var(--name-color, var(--primary-400));
    transform: scale(1.2);
}

/* === Donations === */
.profile-donations {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-6);
    width: 100%;
}

.profile-donation-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-xl);
    text-decoration: none;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

/* === Discord Status Widget === */
.discord-status-widget {
    background: var(--surface-secondary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    transition: all var(--transition-spring);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.discord-status-widget:hover {
    transform: translateY(-2px);
    border-color: #5865F2;
    /* Discord Purple */
    box-shadow: 0 0 15px rgba(88, 101, 242, 0.3);
}

.discord-avatar-container {
    position: relative;
    width: 48px;
    height: 48px;
}

.discord-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.discord-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid var(--surface-secondary);
}

.status-online {
    background: #3ba55d;
}

.status-idle {
    background: #faa81a;
}

.status-dnd {
    background: #ed4245;
}

.status-offline {
    background: #747f8d;
}

.discord-info {
    flex: 1;
    min-width: 0;
}

.discord-user {
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.discord-activity {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.discord-badge {
    background: #5865F2;
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.profile-donation-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    filter: brightness(1.1);
}

.audio-player-floating {
    position: fixed;
    bottom: var(--space-6);
    left: var(--space-6);
    z-index: 1000;
    background: rgba(12, 8, 35, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    padding: var(--space-2) var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    box-shadow: var(--shadow-lg), var(--glow-primary);
    color: white;
    transition: all var(--transition-spring);
    max-width: 280px;
    animation: slideInLeft 0.8s var(--transition-spring) both;
}

[data-theme="light"] .audio-player-floating {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(124, 58, 237, 0.2);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
}

.ap-track-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    animation: rotate 8s linear infinite;
    animation-play-state: paused;
    border: 2px solid var(--primary-500);
}

.audio-player-floating.playing .ap-track-img {
    animation-play-state: running;
}

.ap-info {
    flex: 1;
    min-width: 0;
}

.ap-title {
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.ap-artist {
    font-size: 0.7rem;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ap-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.ap-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--surface-glass);
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ap-btn:hover {
    background: var(--primary-500);
    color: white;
    transform: scale(1.1);
}

.ap-visualizer {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
    margin-right: var(--space-2);
}

.ap-bar {
    width: 2px;
    background: var(--primary-400);
    border-radius: 1px;
    height: 4px;
}

.playing .ap-bar {
    animation: barGrow 0.8s ease-in-out infinite alternate;
}

.playing .ap-bar:nth-child(2) {
    animation-delay: 0.2s;
}

.playing .ap-bar:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes barGrow {
    0% {
        height: 4px;
    }

    100% {
        height: 12px;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-150%) scale(0.8);
        opacity: 0;
    }

    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

/* Music Player Embed Support */
.audio-player-floating.embed-active {
    transition: all var(--transition-slow);
    overflow: hidden;
}

.audio-player-floating.embed-active.minimized {
    height: 60px !important;
    width: 220px !important;
}

.audio-player-floating.embed-active.minimized .ap-embed-container {
    display: none;
}

.audio-player-floating.embed-active.minimized .ap-btn i {
    transform: rotate(180deg);
}

/* Discord Error State */
.discord-status-widget.discord-error {
    border: 1px dashed var(--error-500);
    background: rgba(239, 68, 68, 0.05);
}

@media (max-width: 480px) {
    .audio-player-floating {
        bottom: var(--space-4);
        left: var(--space-4);
        right: var(--space-4);
        max-width: none;
    }
}
/* Verified Badge Black Glow */
.verified-badge {
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.4));
}
