/* ==========================================================================
   Modern Cyber/Glassmorphism Design System - style.css
   ========================================================================== */

/* Design System Tokens */
:root {
    --bg-base: #050507;
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-muted: #6e6e73;
    
    /* Cyber tones (No purple-on-dark, using clean cyber cyan/silver) */
    --accent-cyan: #00f0ff;
    --accent-cyan-dim: rgba(0, 240, 255, 0.15);
    --accent-green: #00ff66;
    
    /* Glassmorphism properties */
    --card-bg: rgba(10, 10, 12, 0.45);
    --border-color: rgba(255, 255, 255, 0.08);
    --blur-strength: 20px;
    --card-shadow: 0 32px 80px rgba(0, 0, 0, 0.85);
    
    /* Typography */
    --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
}

/* ==========================================================================
   Base Elements & Reset
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    height: 100%;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Focus indicator style for accessibility */
a:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 4px;
}

/* ==========================================================================
   Background System & Overlays
   ========================================================================== */
.bg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    pointer-events: none;
    overflow: hidden;
}

/* Fallback cyber gradient style */
.bg-container.fallback {
    background: linear-gradient(135deg, #050508 0%, #0c0d15 50%, #060609 100%);
    background-size: 400% 400%;
    animation: cyberGradient 15s ease infinite;
}

@keyframes cyberGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.bg-container video, .bg-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Ambient Canvas Particles Overlay */
.particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
    opacity: 0.35;
}

/* Scanlines and Vignette overlay */
.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Subtle 4px scanlines and deep vignette */
    background: 
        radial-gradient(circle at center, transparent 35%, rgba(5, 5, 8, 0.9) 100%),
        linear-gradient(rgba(255, 255, 255, 0.005) 50%, rgba(0, 0, 0, 0.25) 50%);
    background-size: 100% 100%, 100% 4px;
    z-index: -1;
    pointer-events: none;
}

/* ==========================================================================
   Main Layout Wrapper
   ========================================================================== */
.main-wrapper {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    box-sizing: border-box;
}

/* ==========================================================================
   Glassmorphism Profile Card
   ========================================================================== */
.profile-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-strength)) saturate(185%);
    -webkit-backdrop-filter: blur(var(--blur-strength)) saturate(185%);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    border-radius: 24px;
    padding: 36px;
    width: 100%;
    max-width: 600px;
    opacity: 1;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), 
                background-color 0.3s, 
                border-color 0.3s;
    animation: cardEntrance 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    
    /* Disable text selection inside the profile card */
    user-select: none;
    -webkit-user-select: none;
}

.profile-card input, .profile-card textarea {
    user-select: text;
    -webkit-user-select: text;
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Header */
.card-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Avatar Wrapper & Fallbacks */
.avatar-wrapper {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.avatar-img.loaded {
    opacity: 1;
}

.avatar-img.loaded ~ .avatar-fallback {
    display: none !important;
}

.avatar-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.01) 100%);
    font-size: 1.5rem;
    font-weight: bold;
    text-transform: uppercase;
}



/* Header Text Information */
.header-info {
    display: flex;
    flex-direction: column;
}

.display-name {
    font-family: 'Silkscreen', monospace;
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--display-name-color, var(--text-primary));
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    line-height: 1.2;
}

.username {
    font-family: 'Silkscreen', monospace;
    font-size: 0.813rem;
    color: var(--username-color, var(--accent-cyan));
    margin-top: 4px;
    letter-spacing: 0.03em;
}



/* ==========================================================================
   Dynamic Badge System & Tooltips
   ========================================================================== */
.badges-container {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    vertical-align: middle;
}

.badge-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    outline: none;
    transition: transform 0.2s ease;
}

/* Cyber style accessible focus outline */
.badge-item:focus-visible {
    outline: 1.5px solid var(--accent-cyan);
    outline-offset: 3px;
    border-radius: 4px;
}

.badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.badge-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.badge-fallback-text {
    font-family: var(--font-mono);
    font-size: 0.688rem;
    font-weight: bold;
    color: var(--accent-cyan);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.badge-icon svg {
    width: 100%;
    height: 100%;
    display: inline-block;
    color: var(--text-secondary);
    vertical-align: middle;
    filter: drop-shadow(0 0 2px rgba(0, 240, 255, 0.25));
    transition: color 0.2s;
}

.badge-item:hover .badge-icon svg, 
.badge-item:focus-visible .badge-icon svg {
    color: var(--accent-cyan);
}


/* Typewriter Effect Cursor styling */
.typewriter-cursor {
    display: inline-block;
    margin-left: 2px;
    font-family: 'Silkscreen', monospace;
    font-weight: 700;
    color: var(--display-name-color, var(--text-primary));
    animation: cursorBlink 0.8s infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Custom CSS Tooltip overlay */
.badge-item .tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px) scale(0.95);
    background: rgba(10, 10, 12, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 4px 8px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    z-index: 100;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.badge-item .tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px;
    border-style: solid;
    border-color: rgba(10, 10, 12, 0.92) transparent transparent transparent;
}

/* Show Tooltip on Hover or Keyboard Focus */
.badge-item:hover .tooltip,
.badge-item:focus .tooltip,
.badge-item:focus-within .tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

/* ==========================================================================
   Bio Section
   ========================================================================== */
.bio-section {
    margin: 24px 0;
}

.bio-text {
    font-size: 0.938rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* ==========================================================================
   Widgets Grid & Cards (Single Column layout for Music Player)
   ========================================================================== */
.widgets-grid {
    display: grid;
    grid-template-columns: 1fr; /* Takes full width */
    gap: 16px;
    margin-bottom: 24px;
}

.widget-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                background-color 0.3s, 
                border-color 0.3s;
}

.widget-card:hover {
    transform: translateY(-2px);
    background-color: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.widget-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.widget-icon {
    display: inline-flex;
    color: var(--text-secondary);
}

.widget-title {
    font-family: var(--font-mono);
    font-size: 0.688rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.widget-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
}

/* ==========================================================================
   Real Music Player Styling
   ========================================================================== */
.music-widget .music-details {
    display: flex;
    align-items: center;
    gap: 10px;
}

.music-widget .track-art {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    flex-shrink: 0;
    overflow: hidden;
}

.music-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.music-cover-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Rotating Cover Art on Audio Playback */
.music-playing .track-art {
    animation: vinylSpin 8s linear infinite;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan-dim);
}

@keyframes vinylSpin {
    to { transform: rotate(360deg); }
}

.music-widget .track-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex-grow: 1;
}

.music-widget .track-name {
    font-size: 0.813rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-widget .track-artist {
    font-size: 0.688rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Music Control Buttons */
.music-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.music-control-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.music-control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: scale(1.08);
}

.music-control-btn:active {
    transform: scale(0.92);
}

.music-play-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s, color 0.2s;
    flex-shrink: 0;
}

.music-play-btn:hover {
    background-color: var(--text-primary);
    color: var(--bg-base);
    transform: scale(1.08);
}

.music-play-btn:active {
    transform: scale(0.92);
}

/* Timeline & Scrubbing */
.music-progress-wrapper {
    margin-top: 12px;
}

.progress-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-cyan);
    border-radius: 2px;
    transition: width 0.1s linear;
}

/* Timers & Volume controls */
.time-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.time-readout {
    letter-spacing: 0.02em;
}

.music-volume-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    transition: color 0.2s, transform 0.2s;
}

.music-volume-btn:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.music-volume-btn:active {
    transform: scale(0.9);
}

/* EQ Equalizer Animation */
.eq-container {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 10px;
    width: 14px;
}

.eq-bar {
    width: 2px;
    height: 100%;
    background-color: var(--text-secondary);
    transform-origin: bottom;
    transform: scaleY(0.2);
    transition: background-color 0.3s;
}

.music-playing .eq-bar {
    background-color: var(--accent-cyan);
    animation: eqBounce 1s ease infinite alternate;
}

.music-playing .eq-bar:nth-child(1) { animation-delay: 0.1s; animation-duration: 0.8s; }
.music-playing .eq-bar:nth-child(2) { animation-delay: 0.3s; animation-duration: 0.5s; }
.music-playing .eq-bar:nth-child(3) { animation-delay: 0.0s; animation-duration: 0.7s; }
.music-playing .eq-bar:nth-child(4) { animation-delay: 0.4s; animation-duration: 0.6s; }

@keyframes eqBounce {
    0% { transform: scaleY(0.2); }
    100% { transform: scaleY(1); }
}

/* Graceful Disabled/Empty State */
.music-widget.disabled {
    opacity: 0.55;
}

.music-widget.disabled .music-play-btn,
.music-widget.disabled .music-control-btn,
.music-widget.disabled .progress-bar-container,
.music-widget.disabled .music-volume-btn {
    pointer-events: none;
    cursor: default;
}

/* ==========================================================================
   Social Links Grid
   ========================================================================== */
.socials-container {
    margin: 28px 0 32px;
}

.socials-list {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    list-style: none;
    flex-wrap: wrap;
}

.social-link {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.social-link svg {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.social-link:hover, .social-link:focus-visible {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.social-link:hover svg, .social-link:focus-visible svg {
    transform: scale(1.1);
}

.social-link:active {
    transform: translateY(-1px) scale(0.96);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Card Footer (Stats, Location, Time)
   ========================================================================== */
.card-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    cursor: default;
    transition: color 0.2s;
}

.footer-item:hover {
    color: var(--text-secondary);
}

.footer-icon {
    flex-shrink: 0;
}

.footer-text {
    font-size: 0.75rem;
}

.font-mono {
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

/* ==========================================================================
   Responsive Adaptations & Breakpoints
   ========================================================================== */
@media (max-width: 768px) {
    .profile-card {
        padding: 30px;
    }
}

@media (max-width: 520px) {
    .main-wrapper {
        padding: 16px;
    }
    
    .profile-card {
        padding: 24px;
        border-radius: 20px;
    }
    
    .card-header {
        gap: 16px;
    }
    
    .avatar-wrapper {
        width: 64px;
        height: 64px;
    }
    
    .display-name {
        font-size: 1.4rem;
    }
    
    .widgets-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .social-link {
        width: 42px;
        height: 42px;
    }
    
    .card-footer {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        padding-top: 20px;
    }
}

@media (max-width: 360px) {
    .profile-card {
        padding: 18px;
    }
    
    .socials-list {
        gap: 8px;
    }
}

/* Accessibility: respect user prefers-reduced-motion setting */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-delay: -1ms !important;
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        background-attachment: initial !important;
        scroll-behavior: auto !important;
        transition-duration: 0s !important;
        transition-delay: 0s !important;
    }
    
    .particles-canvas {
        display: none;
    }
    
    .bg-container.fallback {
        animation: none;
    }
    
    .status-indicator-dot.online {
        animation: none;
    }
    
    .music-playing .track-art {
        animation: none;
    }
}
