/* Light/dark theme tokens. js/theme.js sets data-theme on <html>; without JS the light theme applies. */
:root {
    --page-bg: #eeeeee;
    --card-bg: #ffffff;
    --text: #222222;
    --muted: #6c757d;
    --link: #7a6290;
    --link-hover: #5f4a73;
    --border: #d6d6d6;
    --input-bg: #ffffff;
}
:root[data-theme="dark"] {
    --page-bg: #121214;
    --card-bg: #1e1e22;
    --text: #e8e6ec;
    --muted: #a8a4b0;
    --link: #b49bc8;
    --link-hover: #d6c8e2;
    --border: #3a3842;
    --input-bg: #2a2930;
}

/* -- theme switch button (upper right on every page) -- */
.theme-toggle {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1100;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    color: var(--text);
    cursor: pointer;
    transition: transform 0.15s ease;
}
.theme-toggle:hover { transform: scale(1.08); }
.theme-toggle:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
/* On the galaxy background of the main store the icon stays white, like the page's other light details. */
body:not(.plain-page) .theme-toggle { color: #ffffff; filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.5)); }

/* -- plain pages (checkout, downloads) -- */
body.plain-page {
    background: var(--page-bg);
    color: var(--text);
}
body.plain-page a { color: var(--link); }
body.plain-page a:hover { color: var(--link-hover); }
.surface {
    background: var(--card-bg);
    color: var(--text);
}
:root[data-theme="dark"] .text-muted { color: var(--muted) !important; }
:root[data-theme="dark"] .form-control {
    background-color: var(--input-bg);
    border-color: var(--border);
    color: var(--text);
}
:root[data-theme="dark"] .form-control::placeholder { color: var(--muted); }
:root[data-theme="dark"] .btn-outline-secondary { color: var(--text); border-color: var(--border); }
:root[data-theme="dark"] .btn-outline-primary { color: var(--link); border-color: var(--link); }
:root[data-theme="dark"] .btn-outline-primary:hover { color: #fff; background-color: #8f77a6; border-color: #8f77a6; }
/* PayPal's buttons and its inline card form are drawn for light backgrounds, so they
   sit on a white panel. The panel applies in both themes (invisible on the white light
   card) so switching themes doesn't change the buttons' width or height. */
#paypal-buttons {
    background: #ffffff;
    border-radius: 12px;
    padding: 14px 14px 4px;
}

/* -- main store: only the song modal changes (same see-through, black instead of white) -- */
:root[data-theme="dark"] #track-modal {
    --bs-modal-bg: #2e2e348f;
    --bs-modal-color: #ffffff;
}
:root[data-theme="dark"] #track-modal .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
/* Text boxes on About, Imprint and Privacy: same see-through dark gray as the modal. */
:root[data-theme="dark"] .about {
    background-color: #2e2e348f;
}
:root[data-theme="dark"] .about.text-black { color: #ffffff !important; }
/* Keep notifications clear of the theme button. */
.toast-container { margin-top: 48px; }
/* Main store background: a see-through dark layer over the galaxy image. */
:root[data-theme="dark"] body:not(.plain-page) {
    background-image: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)), url("../images/galaxybright.gif");
}
