/* Base CSS Custom Properties - Default Theme */
:root {
    /* Brand Colors */
    --brand-primary: #5f00f4;
    --brand-secondary: #8921e9;
    --brand-accent: #be98e8;
    
    /* Background Colors */
    --main-background: linear-gradient(to right bottom, #1b1b1b, #1b1b1b, #1b1b1b, #1b1b1b, #1b1b1b, #1d1c22, #1e1c29, #201d30, #241e40, #291d50, #2f1c60, #37186f);
    
    /* Text Colors */
    --main-color: 255, 255, 255;
    --text-muted: rgba(255, 255, 255, 0.4);
    
    /* Interactive Elements */
    --pulse-color: #5e00f4f0;
    --button-bg: black;
    --button-text: white;
    
    /* Layout */
    --header-height: 6rem;
    --footer-height: 6rem;
    --max-content-width: 768px;
    --content-padding: 2.5rem;
    
    /* Typography */
    --font-family: "Urbanist", serif;
    --font-size-base: 18px;
    --font-size-title: clamp(1.75rem, 3vw, 2.25rem);
    --font-size-beta: 12px;
    --font-size-content: 1rem;
    --font-size-meta: 0.8rem;
    --font-size-status: 24px;
    
    /* Transitions & Animations */
    --transition-base: all 0.3s;
    --animation-pulse: pulse 1.5s infinite ease-in-out;
}

/* Light theme override */
@media only screen and (prefers-color-scheme: light) {
    :root {
        --main-background: linear-gradient(to right bottom, #1b1b1b, #1b1b1b, #1b1b1b, #1b1b1b, #1b1b1b, #1d1c22, #1e1c29, #201d30, #241e40, #291d50, #2f1c60, #37186f);
        --main-color: 255, 255, 255;
        --text-muted: rgba(255, 255, 255, 0.4);
    }
}

/* Dark theme (default, but explicit) */
@media only screen and (prefers-color-scheme: dark) {
    :root {
        --main-background: linear-gradient(to right bottom, #1b1b1b, #1b1b1b, #1b1b1b, #1b1b1b, #1b1b1b, #1d1c22, #1e1c29, #201d30, #241e40, #291d50, #2f1c60, #37186f);
        --main-color: 255, 255, 255;
        --text-muted: rgba(255, 255, 255, 0.4);
    }
}

[data-theme="kpmg"] {
    --brand-primary: #4a90e2;
    --brand-secondary: #50e3c2;
    --brand-accent: #7cc7e8;
    --main-background: linear-gradient(to right bottom, #1a1a2e, #16213e, #0f3460, #16537e, #2f6690);
    --pulse-color: #4a90e2f0;

    /* Normal */
    --pico-primary-background: #FFFFFF;
    --pico-primary-border: #FFFFFF;
    --pico-primary-inverse: #00338d;
    --pico-border-radius: 2rem;

    /* Hover/Focus */
    --pico-primary-hover-background: #ffffff;
    --pico-primary-hover-border: #ffffff;
}

[data-theme="spotify"] {
    --brand-primary: #1db954;
    --brand-secondary: #1ed760;
    --brand-accent: #1fdf64;
    --main-background: linear-gradient(to right bottom, #0d0d0d, #121212, #191414, #1e1e1e, #232323);
    --pulse-color: #1db954f0;
    
    /* PicoCSS Button Variables */
    --pico-primary-background: #0f7a30;
    --pico-primary-border: #0f7a30;
    --pico-primary-inverse: #000000;
    --pico-primary-hover-background: #1db954;
    --pico-primary-hover-border: #1db954;
}

[data-theme="discord"] {
    --brand-primary: #5865f2;
    --brand-secondary: #7289da;
    --brand-accent: #99adf4;
    --main-background: linear-gradient(to right bottom, #2c2f33, #36393f, #40444b, #4f545c, #5c6370);
    --pulse-color: #5865f2f0;
    
    /* PicoCSS Button Variables */
    --pico-primary-background: #3c45a5;
    --pico-primary-border: #3c45a5;
    --pico-primary-inverse: #ffffff;
    --pico-primary-hover-background: #5865f2;
    --pico-primary-hover-border: #5865f2;
}

[data-theme="monochrome"] {
    --brand-primary: #000000;
    --brand-secondary: #333333;
    --brand-accent: #666666;
    --main-background: linear-gradient(to right bottom, #ffffff, #f8f9fa, #f1f3f4, #e8eaed, #dadce0);
    --main-color: 0, 0, 0; /* Black text for light background */
    --text-muted: rgba(0, 0, 0, 0.4);
    --pulse-color: #000000f0;
    --footer-background: #ffffff;
    
    /* PicoCSS Button Variables */
    --pico-primary-background: #666666;
    --pico-primary-border: #666666;
    --pico-primary-inverse: #ffffff;
    --pico-primary-hover-background: #000000;
    --pico-primary-hover-border: #000000;
}

/* Hide scrollbars */
* {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

*::-webkit-scrollbar {
    display: none;
}

/* Base styles */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: var(--main-background);
    color: rgba(var(--main-color));
    display: flex;
    flex-direction: column;
    font-family: var(--font-family);
    font-optical-sizing: auto;
    font-weight: 500;
    font-style: normal;
    font-size: var(--font-size-base);
    min-height: 100dvh;
}

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

.app-title {
    align-items: flex-end;
    backdrop-filter: blur(7px);
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 12px 0;
    position: sticky;
    text-align: center;
    z-index: 2;
    width: 100%;
}

.app-title span:not(.beta) {
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: var(--font-size-title);
    font-weight: 700;
    margin-bottom: 0;
}

.app-title span.beta {
    color: var(--brand-primary);
    font-weight: 700;
    font-size: var(--font-size-beta);
    padding-bottom: 4px;
    text-transform: uppercase;
}

body > header {
    height: var(--header-height);
    position: fixed;
    left: 0;
    right: 0;
    backdrop-filter: blur(7px);
    z-index: 2;
}

body > main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: calc(100% - var(--header-height));
    overflow: auto;
}

body > main > section[data-translations] {
    flex: 1 1 auto;
    overflow: auto;
}

body > main > section[data-controls] {
    flex-shrink: 0;
    margin-top: auto;
}

body > footer {
    flex-shrink: 0;
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: center;
}

body > main[data-status="connect"] > section:not([data-start]) {
    display: none;
}

body > main[data-status="connected"] > section[data-start] {
    display: none;
}

section[data-start] {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;

    p {
        color: rgba(var(--main-color));
        font-size: 1.3rem;
        line-height: 1.4rem;
    }

    button {
        margin-top: 2rem;
    }
}

section[data-translations] {
    padding: 0 var(--content-padding);
    max-width: var(--max-content-width);
    margin: 0 auto;
    flex: 1;
    overflow: auto;
}

section[data-translations] ul {
    display: flex;
    flex-direction: column;
    padding-top: var(--header-height);
}

section[data-translations] ul li {
    position: relative;
    padding-left: -2rem;
    list-style: none;
    margin-bottom: 0;
}

section[data-translations] ul li p {
    line-height: 1.5;
    margin-top: 1rem;
    font-size: var(--font-size-content);
    padding-left: 1rem;
}

section[data-translations] ul li p img {
    max-height: 13px;
}

section[data-translations] ul li i {
    content: "";
    position: absolute;
    width: 2rem;
    height: 2rem;
    border-radius: 1rem;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
    top: 0;
    left: -3rem;
}

section[data-translations] ul li span {
    display: block;
    line-height: 2.25rem;
    color: var(--brand-accent);
    font-size: var(--font-size-meta);
    font-weight: 700;
    padding-left: 1rem;
}

section[data-translations] ul li:before {
    content: "";
    position: absolute;
    left: -2rem;
    top: 0;
    height: 100%;
    background-color: var(--text-muted);
    width: 0.1rem;
}

section[data-translations] ul li[data-current] p {
    color: rgba(var(--main-color));
}

section[data-translations] ul li[data-current] i {
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
    width: 3rem;
    height: 3rem;
    left: -3.5rem;
    top: -.5rem;
    border-radius: 1.5rem;
}

section[data-translations] ul li[data-current] i:before {
    content: "";
    position: absolute;
    width: 4rem;
    height: 4rem;
    background-color: var(--pulse-color);
    border-radius: 100%;
    left: -.5rem;
    top: -.5rem;
    z-index: 0;
    animation: var(--animation-pulse);
}

section[data-translations] ul li[data-current] i:after {
    content: "";
    background: url('/sound.png');
    background-size: 50%;
    background-position: center;
    background-blend-mode: overlay;
    background-repeat: no-repeat;
    position: absolute;
    z-index: 10;
    width: 3rem;
    height: 3rem;
    filter: invert(100%);
}

section[data-translations] ul li[data-status] p {
    display: inline-block;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary));
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: var(--font-size-status);
    font-weight: 700;
    margin-top: -3px;
    line-height: 1.15;
    text-align: center;
    width: 100%;
}

section[data-translations] ul li[data-status] i {
    display: none;
}

section[data-translations] ul li[data-status]:before {
    display: none;
}

section[data-translations] ul li:not([data-current]):has(+ li[data-current]) p {
    margin-bottom: 3rem;
}

section[data-translations] ul li[data-current] ~ li:not([data-status]) {
    opacity: 0.2;
}

section[data-controls] {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    padding-top: 2rem;
}

section[data-controls] button {
    border: 0;
    border-radius: 100%;
    background-color: var(--button-bg);
    cursor: pointer;
    color: var(--button-text);
    height: clamp(50px, 3vw + 16px, 80px);
    width: clamp(50px, 3vw + 16px, 80px);
    transition: var(--transition-base);
    line-height: 1;
    display: grid;
    place-items: center;
    padding: 14px;
    position: relative;
}

section[data-controls] button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    height: 50%;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    filter: invert(1);
}

section[data-controls] button[data-sound][data-muted="true"]::after {
    background-image: url("/mute.png");
}

section[data-controls] button[data-sound][data-muted="false"]::after {
    background-image: url("/sound.png");
}

section[data-controls] button[data-play][data-paused="true"]::after {
    background-image: url("/play.png");
}

section[data-controls] button[data-play][data-paused="false"]::after {
    background-image: url("/pause.png");
}

section[data-controls] button[data-fast-forward]::after {
    background-image: url("/forward.png");
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.3;
    }
    100% {
        transform: scale(1);
        opacity: 0.7;
    }
}