/* ==========================================================================
   Dark theme (md/JAZYK-A-VZHLED.md)
   ==========================================================================
   Applies only with <html data-theme="dark"> (set from the `rb_theme` cookie, see lib/i18n/Theme.php and the inline
   script in project/Page.phtml). Same idea as the dark mode of the Wopro account, but in ReklamaBot's own colours:
   deep slate-blue surfaces, the pink accent kept, a little brighter so it reads on dark.

   1. Tokens: almost the whole app paints from the variables in acc.css, so redefining them does most of the work.
   2. Patches: the few places with a hard-coded light colour. Every selector starts with [data-theme="dark"], which
      outranks the original rule regardless of load order (global files load alphabetically, groups after them).

   Kept light on purpose: previews of content as it will look outside the app (article preview frame in articles.css,
   post previews of the social networks), the canvas of the image editor and the video monitor (neutral, so the
   colours of the content are not affected by the surroundings).
   ========================================================================== */

:root {
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --primary: #f4476a;
    --primary-hover: #f76584;
    --primary-light: rgba(244, 71, 106, 0.14);
    --primary-border: rgba(244, 71, 106, 0.38);
    --primary-ghost-hover: rgba(244, 71, 106, 0.24);
    --primary-ghost-border: rgba(244, 71, 106, 0.34);
    --primary-strong: #ff8fa6;

    --bg: #0b1120;
    --bg-card: #131b2e;
    --bg-section: #131b2e;
    --bg-input: #0f1729;
    --bg-hover: #1c2740;

    --text: #e6ebf3;
    --text-secondary: #a9b5c8;
    --text-muted: #7b889e;
    --text-inverse: #ffffff;

    --border: #26324a;
    --border-focus: rgba(244, 71, 106, 0.6);

    --success-bg: rgba(16, 185, 129, 0.14);
    --success-border: rgba(16, 185, 129, 0.35);
    --error-bg: rgba(239, 68, 68, 0.15);
    --error-border: rgba(239, 68, 68, 0.38);
    --warning-bg: rgba(245, 158, 11, 0.14);
    --warning-border: rgba(245, 158, 11, 0.35);
    --info-bg: rgba(59, 130, 246, 0.15);
    --info-border: rgba(59, 130, 246, 0.38);

    --success-text: #34d399;
    --warning-text: #fbbf24;
    --error-text: #f87171;
    --info-text: #60a5fa;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 8px -1px rgba(0, 0, 0, 0.45), 0 2px 4px -2px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 10px 18px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 20px 28px -5px rgba(0, 0, 0, 0.55), 0 8px 10px -6px rgba(0, 0, 0, 0.35);
    --shadow-card: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

/* Editors (editor-theme.css defines these on the editor roots, not on :root). */
[data-theme="dark"] .ve,
[data-theme="dark"] .studio-editor-main {
    --ve-panel-2: #1a2438;
    --ve-panel-3: #26324a;
    --ve-lane: #1a2438;
    --ve-tick: #334155;
    --ve-tick-big: #64748b;
}

/* ---------- Chrome: top bar, bottom bar ---------- */

[data-theme="dark"] .topbar {
    background: rgba(19, 27, 46, 0.92);
}

@media (max-width: 768px) {
    [data-theme="dark"] .bottom-nav {
        background: rgba(19, 27, 46, 0.96);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    }
}

/* ---------- Status text that was hard-coded in darker shades ---------- */

[data-theme="dark"] .alert-error { color: var(--error-text); }
[data-theme="dark"] .alert-success { color: var(--success-text); }
[data-theme="dark"] .topbar-apps-badge { color: var(--warning-text); }
[data-theme="dark"] .topbar-apps-badge--date { color: var(--success-text); }

[data-theme="dark"] .video-klip-varovani {
    background: var(--warning-bg);
    color: var(--warning-text);
}

/* ---------- Surfaces with a hard-coded white ---------- */

[data-theme="dark"] .kal-den-cislo,
[data-theme="dark"] .save-dropdown,
[data-theme="dark"] .stu-listy-vpravo,
[data-theme="dark"] .stu-tool .tooltip,
[data-theme="dark"] .ve-hlaska,
[data-theme="dark"] .ve select.form-input option {
    background: var(--bg-card);
    color: var(--text);
}

[data-theme="dark"] .kal-den.je-dnes .kal-den-cislo {
    background: var(--primary);
    color: #fff;
}

[data-theme="dark"] .ve-btn--hrat {
    background: var(--text);
    color: var(--bg);
}

[data-theme="dark"] img.img-nedostupny {
    background: var(--bg-hover) !important;
}

/* Dialog tabs (post dialog): grey track with a white active tab. */
[data-theme="dark"] .dialog-tabs .tab {
    background: var(--bg-hover);
}

[data-theme="dark"] .dialog-tabs .tab.active,
[data-theme="dark"] .dialog-tabs .tab:not(.active):hover {
    background: var(--bg-card);
}

/* Translucent white buttons and labels floating over images. */
[data-theme="dark"] .post-drop-akce,
[data-theme="dark"] .media-dlazdice-vyber,
[data-theme="dark"] .stu-zvetsit,
[data-theme="dark"] .stu-nahled-sipka {
    background: rgba(19, 27, 46, 0.9);
    color: var(--text);
}

[data-theme="dark"] .stu-zvetsit:focus-visible {
    background: var(--bg-card);
}

/* Transparency checkerboard behind media. */
[data-theme="dark"] .media-sachovnice {
    background-color: #1c2740;
}

/* Grey stage around the image editor canvas: a neutral dark grey (the canvas itself stays as is). */
[data-theme="dark"] .stu-scena {
    background: #1d2129;
}

[data-theme="dark"] .stu-scena .stu-scena-listy {
    background: rgba(19, 27, 46, 0.92);
}
