@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap');

/* --- CSS VARIABLES & THEMES --- */
:root {
    /* Default (Original-ish Dark) */
    --bg-color: #000000;
    --text-color: #e0e0e0;
    --accent-color: #33ff00; /* Hacker Green */
    --secondary-color: #666666;
    --border-color: #333333;
    --panel-bg: #111111;
    --font-main: 'JetBrains Mono', 'Courier New', Courier, monospace;
}

/* Catppuccin Mocha Theme */
:root[data-theme="catppuccin-mocha"],
[data-theme="catppuccin-mocha"] {
    --bg-color: #1e1e2e;
    --text-color: #cdd6f4;
    --accent-color: #a6e3a1; /* Green */
    --secondary-color: #9399b2; /* Overlay 2 */
    --border-color: #313244; /* Surface 0 */
    --panel-bg: #181825; /* Mantle */
}

/* Dracula Theme */
:root[data-theme="dracula"],
[data-theme="dracula"] {
    --bg-color: #282a36;
    --text-color: #f8f8f2;
    --accent-color: #ff79c6; /* Pink */
    --secondary-color: #6272a4;
    --border-color: #44475a;
    --panel-bg: #21222c;
}

/* Nord Theme */
:root[data-theme="nord"],
[data-theme="nord"] {
    --bg-color: #2e3440;
    --text-color: #d8dee9;
    --accent-color: #88c0d0; /* Frost Blue */
    --secondary-color: #4c566a;
    --border-color: #434c5e;
    --panel-bg: #3b4252;
}

/* Light Theme */
:root[data-theme="light"],
[data-theme="light"] {
    --bg-color: #ffffff;
    --text-color: #333333;
    --accent-color: #000000;
    --secondary-color: #888888;
    --border-color: #e0e0e0;
    --panel-bg: #f9f9f9;
}

/* --- GLOBAL STYLES --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.6;
    padding: 2rem;
    transition: background-color 0.3s, color 0.3s;
    max-width: 1200px;
    margin: 0 auto;
}

a {
    color: var(--text-color);
    text-decoration: none;
    border-bottom: 1px dotted var(--secondary-color);
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-color);
    border-bottom-style: solid;
}

/* --- LAYOUT --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: -1px;
}

.logo span {
    color: var(--accent-color);
}

/* --- THEME SELECTOR --- */
.theme-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-icon {
    color: var(--secondary-color);
    flex-shrink: 0;
}

select {
    background-color: var(--panel-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    font-family: var(--font-main);
    cursor: pointer;
    outline: none;
}

/* --- HERO SECTION --- */
.hero {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 4rem;
    margin-bottom: 4rem;
}

.hero-text h1 {
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 1rem;
}

.hero-text p {
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.status-badge {
    display: inline-block;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 2px 8px;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

/* --- TERMINAL WINDOW --- */
.terminal-window {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    font-size: 0.95rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    color: var(--secondary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.command-line {
    margin-bottom: 15px;
}

.prompt {
    color: var(--accent-color);
    margin-right: 10px;
}

.cursor {
    animation: blink 1s infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.file-list {
    list-style: none;
}

.file-list li {
    margin-bottom: 5px;
    display: flex;
}

.file-id {
    color: var(--secondary-color);
    width: 30px;
    display: inline-block;
}

/* --- GRID CONTENT --- */
.grid-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.col h3 {
    margin-bottom: 1.5rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--secondary-color);
}

.link-list {
    list-style: none;
}

.link-list li {
    margin-bottom: 0.8rem;
}

/* --- FOOTER --- */
footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.socials a {
    margin-left: 15px;
}

/* --- SPOTIFY WIDGET --- */
.spotify-container {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.spotify-terminal-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
    gap: 8px;
}

.spotify-terminal-header .dots {
    display: flex;
    gap: 6px;
}

.spotify-terminal-header .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.spotify-terminal-header .dot.red { background: #ff5f56; }
.spotify-terminal-header .dot.yellow { background: #ffbd2e; }
.spotify-terminal-header .dot.green { background: #27ca40; }

.spotify-terminal-header .title {
    flex: 1;
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.8rem;
}

.spotify-widget {
    border-radius: 12px;
    padding: 16px;
    margin: 12px;
    font-size: 0.9rem;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    transition: background 0.5s ease;
    position: relative;
    overflow: hidden;
}

.spotify-header {
    position: absolute;
    top: 16px;
    right: 16px;
}

.spotify-logo {
    width: 24px;
    height: 24px;
    fill: #1DB954;
}

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

.album-art {
    width: 100px;
    height: 100px;
    background-color: #333;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

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

.music-icon {
    color: #666;
    font-size: 2rem;
}

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

.track-name {
    color: #fff;
    font-weight: bold;
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.track-name a {
    color: inherit;
    border: none;
}

.track-name a:hover {
    text-decoration: underline;
}

.artist-name {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.spotify-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #1DB954;
    color: #000;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.1s, background 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.spotify-open-btn:hover {
    transform: scale(1.03);
    background: #1ed760;
    color: #000;
    border: none;
}

.spotify-open-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.playing-indicator {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 24px;
    align-self: center;
}

.playing-indicator span {
    width: 4px;
    background: #1DB954;
    border-radius: 2px;
    animation: soundwave 0.5s ease-in-out infinite alternate;
}

.playing-indicator span:nth-child(1) { height: 8px; animation-delay: 0s; }
.playing-indicator span:nth-child(2) { height: 20px; animation-delay: 0.1s; }
.playing-indicator span:nth-child(3) { height: 14px; animation-delay: 0.2s; }
.playing-indicator span:nth-child(4) { height: 10px; animation-delay: 0.3s; }

@keyframes soundwave {
    0% { transform: scaleY(0.4); }
    100% { transform: scaleY(1); }
}

.not-playing .playing-indicator span {
    animation: none;
    opacity: 0.4;
}

.status-text {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.status-text.playing {
    color: #1DB954;
}

/* Hidden canvas for color extraction */
#color-canvas {
    display: none;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .hero {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin-bottom: 2rem;
    }

    .hero-text h1 {
        font-size: 2.5rem;
    }

    .hero-text p {
        font-size: 1rem;
    }

    .terminal-window {
        padding: 15px;
        font-size: 0.85rem;
    }

    .grid-section {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding-top: 1.5rem;
    }

    footer {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        margin-top: 2rem;
    }

    .socials {
        display: flex;
        justify-content: center;
        gap: 15px;
    }

    .socials a {
        margin-left: 0;
    }

    .spotify-widget {
        padding: 12px;
    }

    .spotify-content {
        gap: 12px;
    }

    .album-art {
        width: 70px;
        height: 70px;
    }

    .track-name {
        font-size: 1rem;
    }

    .artist-name {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }

    .spotify-open-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    .playing-indicator {
        display: none;
    }

    .spotify-header {
        top: 12px;
        right: 12px;
    }

    .spotify-logo {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.75rem;
    }

    .logo {
        font-size: 1.25rem;
    }

    .hero-text h1 {
        font-size: 2rem;
    }

    .hero-text p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .status-badge {
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    .terminal-window {
        padding: 12px;
        font-size: 0.8rem;
    }

    .command-line {
        margin-bottom: 10px;
    }

    .file-list li {
        font-size: 0.85rem;
    }

    .col h3 {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    footer {
        font-size: 0.8rem;
    }

    .theme-wrapper {
        width: 100%;
        justify-content: space-between;
    }

    select {
        flex: 1;
        max-width: 150px;
    }

    /* Spotify widget - stacked layout for very small screens */
    .spotify-widget {
        padding: 16px;
    }

    .spotify-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .album-art {
        width: 80px;
        height: 80px;
    }

    .track-info {
        width: 100%;
        display: flex;
        flex-direction: column;
    }

    .track-name {
        font-size: 1rem;
        white-space: normal;
        line-height: 1.3;
    }

    .artist-name {
        font-size: 0.9rem;
        white-space: normal;
    }

    .spotify-open-btn {
        padding: 10px 16px;
        font-size: 0.8rem;
        align-self: flex-start;
    }

    .spotify-terminal-header .title {
        font-size: 0.7rem;
    }
}