/**
 * ═══════════════════════════════════════════════════════════════
 * CUSTOM CSS - GLASSMORPHISM PROFILE
 * ═══════════════════════════════════════════════════════════════
 */

/* ─────────────────────────────────────────────────────────────
   BASE STYLES
   ───────────────────────────────────────────────────────────── */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a0a;
}

body {
    font-family: var(--font-family, 'Inter', 'Segoe UI', sans-serif);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─────────────────────────────────────────────────────────────
   GLASS EFFECTS
   ───────────────────────────────────────────────────────────── */

.glass-card {
    background: rgba(255, 255, 255, var(--card-opacity, 0.1));
    backdrop-filter: blur(var(--card-blur, 20px));
    -webkit-backdrop-filter: blur(var(--card-blur, 20px));
    border: 1px solid rgba(255, 255, 255, var(--border-opacity, 0.15));
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 1px 0 rgba(255, 255, 255, 0.1) inset;
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, calc(var(--border-opacity, 0.15) + 0.1));
    box-shadow: 
        0 12px 48px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset,
        0 1px 0 rgba(255, 255, 255, 0.15) inset;
    transform: translateY(-2px);
}

.glass-inner {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ─────────────────────────────────────────────────────────────
   BACKGROUND EFFECTS
   ───────────────────────────────────────────────────────────── */

/* Vignette overlay */
.vignette {
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 40%,
        rgba(0, 0, 0, var(--vignette-strength, 0.6)) 100%
    );
}

/* Film grain effect */
.grain {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    animation: grainShift 0.5s steps(10) infinite;
}

@keyframes grainShift {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-2%, -2%); }
    20% { transform: translate(2%, 2%); }
    30% { transform: translate(-2%, 2%); }
    40% { transform: translate(2%, -2%); }
    50% { transform: translate(-2%, 0); }
    60% { transform: translate(2%, 0); }
    70% { transform: translate(0, 2%); }
    80% { transform: translate(0, -2%); }
    90% { transform: translate(2%, 2%); }
}

/* ─────────────────────────────────────────────────────────────
   AVATAR STYLES
   ───────────────────────────────────────────────────────────── */

.avatar-ring {
    position: relative;
    padding: 4px;
    border-radius: 50%;
    background: linear-gradient(
        135deg,
        var(--accent, #60a5fa) 0%,
        var(--accent-secondary, #a78bfa) 50%,
        var(--accent, #60a5fa) 100%
    );
    animation: ringGlow 3s ease-in-out infinite;
}

.avatar-ring::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: inherit;
    filter: blur(12px);
    opacity: 0.5;
    z-index: -1;
}

@keyframes ringGlow {
    0%, 100% { 
        opacity: 1;
        filter: brightness(1);
    }
    50% { 
        opacity: 0.8;
        filter: brightness(1.2);
    }
}

/* ─────────────────────────────────────────────────────────────
   DISCORD STATUS INDICATORS
   ───────────────────────────────────────────────────────────── */

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    animation: pulse 2s ease-in-out infinite;
}

.status-online { background: #23a55a; box-shadow: 0 0 8px #23a55a; }
.status-idle { background: #f0b232; box-shadow: 0 0 8px #f0b232; }
.status-dnd { background: #f23f43; box-shadow: 0 0 8px #f23f43; }
.status-offline { background: #80848e; }
.status-streaming { background: #593695; box-shadow: 0 0 8px #593695; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ─────────────────────────────────────────────────────────────
   BADGES & INTERACTIONS
   ───────────────────────────────────────────────────────────── */

.badge-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
    cursor: pointer;
}

.badge-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.social-btn {
    transition: all 0.2s ease;
}

.social-btn:hover {
    transform: translateY(-1px);
}

/* ─────────────────────────────────────────────────────────────
   VOLUME SLIDER
   ───────────────────────────────────────────────────────────── */

/* Volume bar container */
.volume-bar-container {
    position: relative;
    overflow: visible;
}

/* Horizontal volume slider - overlays the visual bar */
.volume-slider-horizontal {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 16px;
    background: transparent;
    cursor: pointer;
    margin: 0;
    z-index: 2;
}

.volume-slider-horizontal::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: transparent;
    border-radius: 3px;
}

.volume-slider-horizontal::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    margin-top: -4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    opacity: 0;
}

.volume-bar-container:hover .volume-slider-horizontal::-webkit-slider-thumb,
.volume-slider-horizontal:focus::-webkit-slider-thumb {
    opacity: 1;
}

.volume-slider-horizontal::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.volume-slider-horizontal::-moz-range-track {
    width: 100%;
    height: 6px;
    background: transparent;
    border-radius: 3px;
}

.volume-slider-horizontal::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.volume-bar-container:hover .volume-slider-horizontal::-moz-range-thumb {
    opacity: 1;
}

/* Legacy vertical slider (fallback) */
.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    writing-mode: vertical-lr;
    direction: rtl;
    transform: rotate(180deg);
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

/* ─────────────────────────────────────────────────────────────
   ANIMATIONS
   ───────────────────────────────────────────────────────────── */

/* Card entrance */
@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card-enter {
    animation: cardEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Player entrance */
@keyframes playerEnter {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.player-enter {
    animation: playerEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.3s;
}

/* Fade in */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

/* ─────────────────────────────────────────────────────────────
   PLAYER PROGRESS ANIMATION
   ───────────────────────────────────────────────────────────── */

#player-progress-container {
    position: relative;
    overflow: hidden;
}

#player-progress {
    transition: width 0.1s linear;
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE DESIGN
   ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    #profile-card {
        margin: 0 8px;
        padding: 24px 20px;
    }
    
    .avatar-ring img {
        width: 100px !important;
        height: 100px !important;
    }
    
    h1 {
        font-size: 1.75rem !important;
    }
    
    #music-player > div {
        min-width: 280px;
        padding: 12px 16px;
    }
    
    .badge-item {
        width: 40px;
        height: 40px;
    }
}

/* ─────────────────────────────────────────────────────────────
   NAVIGATION TABS (Above Card)
   ───────────────────────────────────────────────────────────── */

.nav-tabs {
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 9999px;
    transition: all 0.25s ease;
}

.nav-tab:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.08);
}

.nav-tab.active {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.12);
}

/* ─────────────────────────────────────────────────────────────
   SCROLLBAR (nếu có scroll)
   ───────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ─────────────────────────────────────────────────────────────
   SELECTION
   ───────────────────────────────────────────────────────────── */

::selection {
    background: var(--accent);
    color: white;
}

/* ─────────────────────────────────────────────────────────────
   FOCUS STATES (Accessibility)
   ───────────────────────────────────────────────────────────── */

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────
   LOADING STATES
   ───────────────────────────────────────────────────────────── */

.loading-pulse {
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Spotify progress shimmer */
.spotify-loading #spotify-progress {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
