/* ===== CSS Custom Properties ===== */
:root {
    /* Light mode colors - soft pinks and warm browns */
    --bg-primary: #f8f5f3;
    --bg-secondary: #fefefe;
    --bg-tertiary: #faf7f5;
    --border-color: rgba(210, 190, 180, 0.25);
    --border-color-strong: rgba(190, 170, 160, 0.35);
    
    --text-primary: #6a5a52;
    --text-secondary: #9a8a82;
    --text-muted: #c0b0a8;
    --text-accent: #d4a8a0;
    
    --accent-pink: #f0d4d4;
    --accent-pink-hover: #e8c8c8;
    --accent-warm: #e0c4b0;
    
    --shadow-soft: 0 2px 20px rgba(180, 160, 150, 0.08);
    --shadow-medium: 0 4px 30px rgba(180, 160, 150, 0.12);
    
    --traffic-red: #ffb5b5;
    --traffic-yellow: #ffe4b5;
    --traffic-green: #b5e8c3;
    
    --transition-fast: 0.15s ease;
    --transition-medium: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1614;
        --bg-secondary: #242020;
        --bg-tertiary: #2a2624;
        --border-color: rgba(100, 80, 70, 0.4);
        --border-color-strong: rgba(120, 100, 90, 0.5);
        
        --text-primary: #e8e0dc;
        --text-secondary: #b0a8a4;
        --text-muted: #706860;
        --text-accent: #c9a89a;
        
        --accent-pink: #8a6060;
        --accent-pink-hover: #9a7070;
        --accent-warm: #7a6050;
        
        --shadow-soft: 0 2px 20px rgba(0, 0, 0, 0.2);
        --shadow-medium: 0 4px 30px rgba(0, 0, 0, 0.3);
        
        --traffic-red: #cc8080;
        --traffic-yellow: #ccb080;
        --traffic-green: #80b090;
    }
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    line-height: 1.5;
}

a {
    color: var(--text-accent);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

a:hover {
    opacity: 0.7;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== Container ===== */
.container {
    width: 100%;
    max-width: 420px;
    animation: fadeIn 0.6s ease;
}

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

/* ===== Window ===== */
.window {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-medium);
    overflow: hidden;
    position: relative;
}

.window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.traffic-lights {
    display: flex;
    gap: 6px;
}

.light {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: transform var(--transition-fast);
}

.light:hover {
    transform: scale(1.1);
}

.light.red { background: var(--traffic-red); }
.light.yellow { background: var(--traffic-yellow); }
.light.green { background: var(--traffic-green); }

.window-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.action-btn:hover {
    color: var(--text-secondary);
    background: var(--bg-primary);
}

/* ===== Pages ===== */
.page {
    display: none;
    padding: 24px;
    min-height: 380px;
    animation: pageIn 0.3s ease;
    position: relative;
}

.page.active {
    display: block;
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== Home Page ===== */
.home-content {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.profile-section {
    flex: 0 0 auto;
}

.avatar-wrapper {
    position: relative;
    width: 120px;
    height: 140px;
    margin-bottom: 12px;
}

.avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    transition: transform var(--transition-medium), box-shadow var(--transition-medium);
}

.avatar:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-soft);
}

.status-indicator {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    background: var(--text-muted);
    transition: background var(--transition-fast);
}

.status-indicator[data-status="online"] { background: #43b581; }
.status-indicator[data-status="idle"] { background: #faa61a; }
.status-indicator[data-status="dnd"] { background: #f04747; }
.status-indicator[data-status="offline"] { background: var(--text-muted); }

.profile-info {
    text-align: center;
    position: relative;
}

.sparkle {
    display: block;
    font-size: 0.6rem;
    color: var(--text-muted);
    opacity: 0.5;
    margin-bottom: 2px;
    animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

.name {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.bio {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.6;
    letter-spacing: 0.3px;
}

.custom-status {
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 0.2px;
    margin-top: 8px;
    padding: 5px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity var(--transition-medium), transform var(--transition-medium);
}

.custom-status.visible {
    opacity: 1;
    transform: translateY(0);
}

.nav-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.3px;
    transition: all var(--transition-medium);
}

.nav-btn:hover {
    background: var(--bg-primary);
    border-color: var(--accent-pink);
    box-shadow: 0 2px 8px rgba(240, 212, 212, 0.3);
}

.nav-btn svg {
    color: var(--text-muted);
    transition: all var(--transition-medium);
}

.nav-btn:hover svg {
    color: var(--accent-pink);
    transform: scale(1.1);
}

.home-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.now-playing {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.65rem;
    color: var(--text-muted);
    max-width: 60%;
}

.now-playing-icon {
    flex-shrink: 0;
    opacity: 0.6;
}

.now-playing-icon svg {
    opacity: 0.8;
}

.track-info {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.credits {
    text-align: right;
    font-size: 0.6rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ===== Guidelines Page ===== */
.guidelines-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.info-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.column-title {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
    text-align: center;
    letter-spacing: 0.5px;
}

.info-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

.info-box p {
    font-size: 0.65rem;
    color: var(--text-secondary);
    line-height: 1.6;
    word-break: break-word;
}

.notes-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
    text-align: center;
    letter-spacing: 0.5px;
}

.notes-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

.notes-box p {
    font-size: 0.65rem;
    color: var(--text-secondary);
    line-height: 1.6;
    text-align: center;
}

.terms-section {
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.checkbox-wrapper input {
    display: none;
}

.checkmark {
    width: 14px;
    height: 14px;
    border: 1px solid var(--border-color-strong);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.checkbox-wrapper input:checked + .checkmark {
    background: var(--accent-pink);
    border-color: var(--accent-pink);
}

.checkbox-wrapper input:checked + .checkmark::after {
    content: '✓';
    font-size: 10px;
    color: var(--bg-secondary);
}

.terms-text a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ===== Loves Page ===== */
.loves-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.love-zones-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.zone {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.zone-title {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
    text-align: center;
    letter-spacing: 0.5px;
}

.zone-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

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

.animes-section {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

.animes-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.animes-title svg {
    color: var(--accent-pink);
}

.animes-box p {
    font-size: 0.6rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== Spotify Page ===== */
.spotify-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.spotify-profile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-decoration: none;
    transition: all var(--transition-medium);
}

.spotify-profile-btn:hover {
    background: var(--bg-primary);
    border-color: var(--accent-pink);
    box-shadow: 0 2px 8px rgba(240, 212, 212, 0.3);
}

.spotify-profile-btn svg {
    color: #1DB954;
}

.music-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stats-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats-title {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-muted);
    text-align: center;
    letter-spacing: 0.5px;
}

.albums-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.album-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    text-align: center;
}

.album-card.loading .album-cover {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.album-cover {
    width: 70px;
    height: 70px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: transform var(--transition-fast);
}

.album-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.album-card:hover .album-cover {
    transform: scale(1.05);
}

.album-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 70px;
}

.album-name {
    font-size: 0.6rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-artist {
    font-size: 0.55rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.artists-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.artist-tag {
    font-size: 0.6rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    transition: all var(--transition-fast);
}

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

.artist-tag.loading {
    color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 440px) {
    body {
        padding: 12px;
        align-items: center;
        justify-content: center;
    }
    
    .container {
        max-width: 100%;
    }
    
    .page {
        padding: 18px;
        min-height: 340px;
    }
    
    .home-content {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .profile-section {
        text-align: center;
    }
    
    .avatar-wrapper {
        width: 100px;
        height: 120px;
        margin: 0 auto 12px;
    }
    
    .nav-section {
        width: 100%;
        padding-top: 0;
    }
    
    .home-footer {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .now-playing {
        max-width: 100%;
        justify-content: center;
    }
    
    .credits {
        text-align: center;
    }
    
    .info-columns {
        grid-template-columns: 1fr;
    }
    
    .love-zones-section {
        grid-template-columns: 1fr;
    }
    
    .playlist-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .playlist-cover {
        width: 60px;
        height: 60px;
    }
}

/* ===== Desktop hover enhancements ===== */
@media (hover: hover) and (pointer: fine) {
    .window {
        transition: box-shadow var(--transition-medium);
    }
    
    .window:hover {
        box-shadow: var(--shadow-medium), 0 8px 40px rgba(180, 160, 150, 0.1);
    }
}

/* ===== Page Sparkle ===== */
.page-sparkle {
    position: absolute;
    top: 50%;
    left: 12px;
    font-size: 0.55rem;
    color: var(--text-muted);
    opacity: 0.4;
    writing-mode: vertical-rl;
    letter-spacing: 2px;
}

/* ===== Loading state ===== */
.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ===== Subtle decorative elements ===== */
.window::before {
    content: '';
    position: absolute;
    top: 60px;
    left: 20px;
    width: 8px;
    height: 8px;
    font-size: 8px;
    color: var(--text-muted);
    opacity: 0.3;
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--accent-pink);
    outline-offset: 2px;
}

/* ===== Custom scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color-strong);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
