/* ========================================
   CSS Variables & Theme
   ======================================== */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #16161f;
    --bg-hover: #1c1c28;
    --text-primary: #f0f0f5;
    --text-secondary: #8b8b9e;
    --text-muted: #5a5a6e;
    --accent: #7c5cff;
    --accent-glow: rgba(124, 92, 255, 0.4);
    --accent-secondary: #ff6b9d;
    --status-online: #3ba55c;
    --status-idle: #faa61a;
    --status-dnd: #ed4245;
    --status-offline: #747f8d;
    --border: rgba(255, 255, 255, 0.06);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --cloud-bg: #2a2a3a;
    --cloud-text: #f0f0f5;
}

/* Light Mode Theme */
[data-theme="light"] {
    --bg-primary: #f5f5f7;
    --bg-secondary: #e8e8ec;
    --bg-card: #ffffff;
    --bg-hover: #f0f0f4;
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a5e;
    --text-muted: #7a7a8e;
    --accent: #6b4ce6;
    --accent-glow: rgba(107, 76, 230, 0.3);
    --accent-secondary: #e94f7a;
    --border: rgba(0, 0, 0, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --cloud-bg: #ffffff;
    --cloud-text: #1a1a2e;
}

[data-theme="light"] .bg-gradient {
    background: 
        radial-gradient(ellipse 80% 50% at 20% -20%, rgba(107, 76, 230, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(233, 79, 122, 0.08), transparent),
        radial-gradient(ellipse 50% 50% at 50% 50%, rgba(107, 76, 230, 0.03), transparent);
}

[data-theme="light"] .noise-overlay {
    opacity: 0.015;
}

[data-theme="light"] .avatar {
    border-color: var(--bg-secondary);
}

[data-theme="light"] .status-indicator {
    border-color: var(--bg-primary);
}

[data-theme="light"] .spotify-card {
    background: linear-gradient(135deg, rgba(30, 215, 96, 0.08), var(--bg-card));
    border-color: rgba(30, 215, 96, 0.15);
}

[data-theme="light"] .spotify-progress {
    background: var(--bg-secondary);
}

/* ========================================
   Theme Toggle Button
   ======================================== */
.theme-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: all 0.3s ease;
    overflow: hidden;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: scale(1.05);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.theme-toggle svg {
    width: 22px;
    height: 22px;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    position: absolute;
}

.theme-toggle:hover svg {
    color: var(--accent);
}

/* Dark mode: show moon, hide sun */
.theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Light mode: show sun, hide moon */
[data-theme="light"] .theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="light"] .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

/* ========================================
   Thinking Cloud
   ======================================== */
.thinking-cloud {
    position: absolute;
    top: -20px;
    left: 100%;
    margin-left: 15px;
    background: var(--cloud-bg);
    padding: 12px 18px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    z-index: 10;
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.thinking-cloud.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.thinking-cloud::before {
    content: '';
    position: absolute;
    bottom: 12px;
    left: -8px;
    width: 16px;
    height: 16px;
    background: var(--cloud-bg);
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.thinking-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--cloud-text);
    font-style: italic;
}

/* Thought bubbles trail */
.cloud-bubbles {
    position: absolute;
    left: -30px;
    bottom: -5px;
}

.bubble {
    position: absolute;
    background: var(--cloud-bg);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.bubble-1 {
    width: 12px;
    height: 12px;
    bottom: 0;
    left: 0;
}

.bubble-2 {
    width: 8px;
    height: 8px;
    bottom: -8px;
    left: -10px;
}

.bubble-3 {
    width: 5px;
    height: 5px;
    bottom: -14px;
    left: -16px;
}

/* Light mode cloud animation - subtle glow */
[data-theme="light"] .thinking-cloud {
    animation: cloudGlow 2s ease-in-out infinite;
}

@keyframes cloudGlow {
    0%, 100% { box-shadow: 0 4px 20px rgba(107, 76, 230, 0.15); }
    50% { box-shadow: 0 4px 30px rgba(107, 76, 230, 0.25); }
}

/* Dark mode cloud - comfort glow */
.thinking-cloud.comfort {
    animation: comfortGlow 1.5s ease-in-out infinite;
}

@keyframes comfortGlow {
    0%, 100% { box-shadow: 0 4px 20px rgba(124, 92, 255, 0.3); }
    50% { box-shadow: 0 4px 30px rgba(124, 92, 255, 0.5); }
}

/* ========================================
   Reset & Base Styles
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ========================================
   Background Effects
   ======================================== */
.bg-gradient {
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 20% -20%, rgba(124, 92, 255, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(255, 107, 157, 0.1), transparent),
        radial-gradient(ellipse 50% 50% at 50% 50%, rgba(124, 92, 255, 0.03), transparent);
    pointer-events: none;
    z-index: 0;
}

.noise-overlay {
    position: fixed;
    inset: 0;
    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.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: 1;
}

/* ========================================
   Layout
   ======================================== */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 60px 24px 80px;
    position: relative;
    z-index: 10;
}

/* ========================================
   Profile Section
   ======================================== */
.profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

.avatar-container {
    position: relative;
    margin-bottom: 28px;
}

.avatar-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    opacity: 0;
    animation: pulse-ring 3s ease-in-out infinite;
}

.avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bg-card);
    position: relative;
    z-index: 2;
    transition: transform 0.3s ease;
}

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

.avatar.loading {
    opacity: 0.5;
}

/* ========================================
   Status Indicators
   ======================================== */
.status-indicator {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--status-offline);
    border: 4px solid var(--bg-primary);
    z-index: 3;
    transition: background 0.3s ease;
}

.status-indicator.online { background: var(--status-online); }
.status-indicator.idle { background: var(--status-idle); }
.status-indicator.dnd { background: var(--status-dnd); }
.status-indicator.offline { background: var(--status-offline); }

.status-indicator::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: inherit;
    opacity: 0;
    animation: status-pulse 2s ease-in-out infinite;
}

.status-indicator.online::after,
.status-indicator.idle::after,
.status-indicator.dnd::after {
    opacity: 0.4;
}

.name {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 20px;
}

.status-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    margin-bottom: 16px;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-offline);
}

.status-dot.online { background: var(--status-online); }
.status-dot.idle { background: var(--status-idle); }
.status-dot.dnd { background: var(--status-dnd); }

/* ========================================
   Custom Status
   ======================================== */
.custom-status {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.custom-status.visible {
    display: flex;
}

.custom-status-emoji {
    font-size: 1.2rem;
}

/* ========================================
   Bio Section
   ======================================== */
.bio {
    text-align: left;
    margin-top: 40px;
    animation: fadeInUp 0.8s ease-out 0.3s backwards;
}

.bio p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.bio p:last-child {
    margin-bottom: 0;
}

.highlight {
    color: var(--accent);
    font-weight: 500;
}

/* ========================================
   Section Titles
   ======================================== */
.section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-weight: 600;
}

/* ========================================
   Activity Section
   ======================================== */
.activity-section {
    margin-top: 48px;
    animation: fadeInUp 0.8s ease-out 0.35s backwards;
}

.activity-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-top: 16px;
    display: none;
    animation: fadeInUp 0.5s ease-out;
}

.activity-card:first-of-type {
    margin-top: 0;
}

.activity-card.visible {
    display: block;
}

.activity-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
}

.activity-header svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.activity-content {
    display: flex;
    gap: 16px;
    align-items: center;
}

.activity-image {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-secondary);
}

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

.activity-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-details {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-state {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================
   No Activity Card
   ======================================== */
.no-activity-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.no-activity-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 0;
}

.no-activity-emoji {
    font-size: 1.5rem;
}

.no-activity-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.no-activity-zzz {
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-style: italic;
    animation: float 2s ease-in-out infinite;
}

/* ========================================
   Spotify Card
   ======================================== */
.spotify-card {
    background: linear-gradient(135deg, rgba(30, 215, 96, 0.1), var(--bg-card));
    border: 1px solid rgba(30, 215, 96, 0.2);
}

.spotify-card .activity-header {
    color: #1ed760;
}

.spotify-progress {
    margin-top: 12px;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
}

.spotify-progress-bar {
    height: 100%;
    background: #1ed760;
    border-radius: 2px;
    transition: width 1s linear;
}

.spotify-time {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-family: 'JetBrains Mono', monospace;
}

/* ========================================
   Links Section
   ======================================== */
.links {
    margin-top: 48px;
    animation: fadeInUp 0.8s ease-out 0.4s backwards;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.link-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(124, 92, 255, 0.15);
}

.link-item svg {
    width: 22px;
    height: 22px;
    fill: var(--text-secondary);
    transition: fill 0.3s ease;
}

.link-item:hover svg {
    fill: var(--accent);
}

.link-text {
    font-weight: 500;
    font-size: 0.95rem;
}

/* ========================================
   Tech Stack Section
   ======================================== */
.tech-stack {
    margin-top: 48px;
    animation: fadeInUp 0.8s ease-out 0.5s backwards;
}

.tech-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tech-tag {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.tech-tag:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ========================================
   Footer
   ======================================== */
.footer {
    margin-top: 60px;
    text-align: center;
    animation: fadeInUp 0.8s ease-out 0.6s backwards;
}

.footer-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-ring {
    0%, 100% { opacity: 0; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.05); }
}

@keyframes status-pulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.5); opacity: 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 600px) {
    .container {
        padding: 40px 20px 60px;
    }

    .name {
        font-size: 2rem;
    }

    .avatar {
        width: 120px;
        height: 120px;
    }

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

    .activity-content {
        flex-direction: column;
        text-align: center;
    }

    .activity-info {
        text-align: center;
    }

    .no-activity-content {
        flex-direction: column;
        gap: 8px;
    }

    .theme-toggle {
        top: 16px;
        right: 16px;
        width: 42px;
        height: 42px;
    }

    .theme-toggle svg {
        width: 18px;
        height: 18px;
    }

    .thinking-cloud {
        top: -60px;
        left: 50%;
        transform: translateX(-50%) translateY(10px) scale(0.9);
        margin-left: 0;
        font-size: 0.85rem;
    }

    .thinking-cloud.visible {
        transform: translateX(-50%) translateY(0) scale(1);
    }

    .thinking-cloud::before {
        bottom: -6px;
        left: 50%;
        transform: translateX(-50%);
    }

    .cloud-bubbles {
        left: 50%;
        bottom: -20px;
        transform: translateX(-50%);
    }

    .bubble-1 {
        left: -15px;
        bottom: 0;
    }

    .bubble-2 {
        left: 0;
        bottom: -6px;
    }

    .bubble-3 {
        left: 12px;
        bottom: -10px;
    }
}
