/*
    Vzhled Day / Night / Auto
    - část 1: přepínač vzhledu (ručně psané)
    - část 2: tmavá varianta ze stávajících stylů (GENEROVANÉ skriptem – ručně neupravovat, viz theme_gen.py)
    - část 3: ruční úpravy tmavé varianty (hlavička, pozadí, jQuery UI, přepsání inline stylů ...)
    Tmavá varianta platí, když je na <html> atribut data-theme="dark" (nastavuje js/vendor/theme.js a func/func_theme.php).
*/

/* ---- přepínač vzhledu ---- */
#theme_switch { display: inline-flex; vertical-align: middle; margin-left: 8px; border: 1px solid #e5007d; border-radius: 6px; overflow: hidden; background: #fff; }
#theme_switch button { margin: 0; padding: 6px 9px; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; color: #e5007d !important; line-height: 0; cursor: pointer; font-size: 0; }
#theme_switch button + button { border-left: 1px solid #f3c1dc !important; }
#theme_switch button svg { display: block; width: 16px; height: 16px; fill: currentColor; }
#theme_switch button:hover { background: #fdeaf4 !important; }
#theme_switch button[aria-pressed="true"] { background: #e5007d !important; color: #fff !important; }
@media print { #theme_switch { display: none; } }

html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

/* ===================================================================================== */
/* ============ část 2: GENEROVANO ze stávajících stylů (theme_gen.py) =============== */
/* ===================================================================================== */
/* ==== z styl.css (58 pravidel) ==== */
html[data-theme="dark"] body { background: #1a1a1a; color: #acacac; }
html[data-theme="dark"] h1 { color: #ededed; }
html[data-theme="dark"] h2,
html[data-theme="dark"] h2 a { color: #ff6bbc; }
html[data-theme="dark"] h3 { color: #ededed; }
html[data-theme="dark"] a { color: #f188bb; }
html[data-theme="dark"] a:hover { color: #ff6bbc; }
html[data-theme="dark"] table.club_overview { color: #ededed; background-color: #1a1a1a; }
html[data-theme="dark"] td.black,
html[data-theme="dark"] table.club_overview tr th.black { color: #a5a090; }
html[data-theme="dark"] textarea.editor_simple { background-color: #1a1a1a; color: #ededed; }
html[data-theme="dark"] p.alerts_block { color: #ff7a7a; }
html[data-theme="dark"] #central { color: #d1d1d1; }
html[data-theme="dark"] #login_box { border: 1px solid #484848; background: #1a1a1a; }
html[data-theme="dark"] #login_box .login_input { border: 1px solid #3b3b3b; }
html[data-theme="dark"] #menu a { border-left: 1px solid #632c44; }
html[data-theme="dark"] #menu a.emp { color: #ededed; }
html[data-theme="dark"] #left h2,
html[data-theme="dark"] #right h2 { border-bottom: 1px solid #3b3b3b; border-top: 1px solid #3b3b3b; color: #dadada; }
html[data-theme="dark"] .highlighted { color: #ff6bbc; }
html[data-theme="dark"] .alert_red { color: #ff7a7a; }
html[data-theme="dark"] .alert_red a { color: #ff7a7a; }
html[data-theme="dark"] .alert_red a:hover { color: #ffbd7a; }
html[data-theme="dark"] .alert_orange { color: #ffbd7a; }
html[data-theme="dark"] .alert_orange a { color: #ffbd7a; }
html[data-theme="dark"] .alert_yellow { color: #f08ab7; }
html[data-theme="dark"] .alert_yellow a:hover { color: #ffbd7a; }
html[data-theme="dark"] .alert_normal a:hover { color: #ffbd7a; }
html[data-theme="dark"] #central form { background-color: #29121e; }
html[data-theme="dark"] .emp_red,
html[data-theme="dark"] form_error { color: #ff7a7a; }
html[data-theme="dark"] .emp_yellow { color: #f08ab7; }
html[data-theme="dark"] .emp_green { color: #4ce64c; }
html[data-theme="dark"] .emp_bold_green { color: #4ce64c; }
html[data-theme="dark"] .emp_bold_red { color: #ff7a7a; }
html[data-theme="dark"] .emp_bold_orange { color: #ffbd7a; }
html[data-theme="dark"] .emp_bold_yellow { color: #f08ab7; }
html[data-theme="dark"] .emp_bold_white { color: #c8c8c8; }
html[data-theme="dark"] table.reg_form tr td span.emp_bold_yellow { color: #f08ab7; }
html[data-theme="dark"] table.admin_view,
html[data-theme="dark"] table.calendar { background: #29121e; border: 1px solid #5e2a41; }
html[data-theme="dark"] table.admin_view td,
html[data-theme="dark"] table.calendar td { color: #d1d1d1; border-right: 1px solid #5e2a41; }
html[data-theme="dark"] tr.admin_view_odd,
html[data-theme="dark"] tr.calendar_header { background: #2f1321; }
html[data-theme="dark"] table.pager { border: 1px solid #4d2338; }
html[data-theme="dark"] #lang_switch select { background-color: #1a1a1a; color: #d1d1d1; }
html[data-theme="dark"] #lang_switch select:focus { outline: 2px solid #4d2338; }
html[data-theme="dark"] .gallery_box { border: 1px solid #4d2338; }
html[data-theme="dark"] .gallery_box h2,
html[data-theme="dark"] .gallery_box h2 a { background: #2f1321; border-bottom: 1px solid #4d2338; color: #ff6bbc; }
html[data-theme="dark"] .active_thumb { border: 1px solid #333333; }
html[data-theme="dark"] div.filter { background-color: #29121e; }
html[data-theme="dark"] div.admin_item { background: #1a1a1a; border: 1px solid #5e2a41; }
html[data-theme="dark"] #central div#flash-messages div.flash-message { border: 2px solid #333333; }
html[data-theme="dark"] #central div#flash-messages div.flash-success { background-color: #164b16; color: #33ff33; }
html[data-theme="dark"] #central div#flash-messages div.flash-error { background-color: #4b1616; color: #ff3333; }
html[data-theme="dark"] #central div#flash-messages div.flash-info { background-color: #4b4b16; color: #ffff33; }
html[data-theme="dark"] .debug-error { border: 1px solid #333333; }
html[data-theme="dark"] #im-contact-list { border: 1px solid #5e2a41; }
html[data-theme="dark"] .im-message-window { border: 1px solid #5e2a41; background: #1a1a1a; }
html[data-theme="dark"] .im-content { background: #1a1a1a; }
html[data-theme="dark"] .im-message-date { color: #bebebe; }
html[data-theme="dark"] .im-message-content { color: #ededed; }
html[data-theme="dark"] .im-message-content.own { color: #f189b8; }
html[data-theme="dark"] div.nicEdit-main { background-color: #1a1a1a; }

/* ==== z styl_admin.css (4 pravidel) ==== */
html[data-theme="dark"] body { background: #1a1a1a; }
html[data-theme="dark"] #header { background-color: #1a1a1a; }
html[data-theme="dark"] #main { background-color: #1a1a1a; }
html[data-theme="dark"] table.pager { background-color: #29121e; }

/* ==== z forms.css (56 pravidel) ==== */
html[data-theme="dark"] .reg-form { color: #d1d1d1; }
html[data-theme="dark"] .reg-form h1 { color: #dadada; }
html[data-theme="dark"] .reg-form .rf-info { background: #2b0c1d; color: #c8c8c8; }
html[data-theme="dark"] .reg-form .rf-info a { color: #ff6bbc; }
html[data-theme="dark"] .reg-form .rf-info-error { background: #2b1010; color: #dd5555; }
html[data-theme="dark"] .reg-form .rf-card { border: 1px solid #492c3c; background: #1a1a1a; }
html[data-theme="dark"] .reg-form .rf-card h2 { border-bottom: 1px solid #4d2338; color: #ff6bbc; }
html[data-theme="dark"] .reg-form .rf-field > label,
html[data-theme="dark"] .reg-form .rf-label { color: #c8c8c8; }
html[data-theme="dark"] .reg-form .rf-star { color: #ff6bbc; }
html[data-theme="dark"] .reg-form input[type="text"],
html[data-theme="dark"] .reg-form input[type="email"],
html[data-theme="dark"] .reg-form input[type="tel"],
html[data-theme="dark"] .reg-form input[type="url"],
html[data-theme="dark"] .reg-form input[type="password"],
html[data-theme="dark"] .reg-form input[type="date"],
html[data-theme="dark"] .reg-form select,
html[data-theme="dark"] .reg-form textarea { border: 1px solid #453a41; background: #1a1a1a; color: #dadada; }
html[data-theme="dark"] .reg-form .rf-triple label { color: #b5b5b5; }
html[data-theme="dark"] .reg-form .rf-chip span { border: 1px solid #453a41; background: #1a1a1a; }
html[data-theme="dark"] .reg-form .rf-hint { color: #acacac; }
html[data-theme="dark"] .reg-form .rf-error { color: #e88b8b; }
html[data-theme="dark"] .reg-form .rf-has-error input[type="text"],
html[data-theme="dark"] .reg-form .rf-has-error input[type="email"],
html[data-theme="dark"] .reg-form .rf-has-error input[type="tel"],
html[data-theme="dark"] .reg-form .rf-has-error input[type="password"],
html[data-theme="dark"] .reg-form .rf-has-error input[type="date"],
html[data-theme="dark"] .reg-form .rf-has-error select,
html[data-theme="dark"] .reg-form .rf-has-error textarea { background: #2a0c0c; }
html[data-theme="dark"] .reg-form .rf-group.rf-has-error .rf-chip span { border-color: #602f2f; }
html[data-theme="dark"] .reg-form .rf-more summary { color: #ff6bbc; }
html[data-theme="dark"] .reg-form .rf-toggle { border: 1px solid #453a41; background: #1a1a1a; color: #ff6bbc; }
html[data-theme="dark"] .reg-form .rf-consent { background: #2b0c1d; }
html[data-theme="dark"] .reg-form .rf-consent a { color: #ff6bbc; }
html[data-theme="dark"] .reg-form .rf-cancel { color: #ff6bbc; }
html[data-theme="dark"] .reg-form .rf-remove { border: 1px solid #453a41; background: #1a1a1a; color: #a2a2a2; }
html[data-theme="dark"] .reg-form .rf-remove:hover { color: #e89292; }
html[data-theme="dark"] .reg-form .rf-add { color: #ff6bbc; }
html[data-theme="dark"] .reg-form .rf-vies-btn { background: #1a1a1a; color: #ff6bbc; }
html[data-theme="dark"] .reg-form .rf-vies-btn:hover { background: #2b0c1d; }
html[data-theme="dark"] .reg-form .rf-vies-ok { color: #6ac86f; }
html[data-theme="dark"] .reg-form .rf-vies-bad { color: #e88b8b; }
html[data-theme="dark"] .reg-form .rf-vies-warn { color: #ffd433; }
html[data-theme="dark"] .reg-form .rf-vies-wait { color: #b5b5b5; }
html[data-theme="dark"] .reg-form .inv-vat { border: 1px solid #453a41; background: #21181c; }
html[data-theme="dark"] .reg-form .inv-vat-title { color: #b5b5b5; }
html[data-theme="dark"] .reg-form .inv-vat-sub { color: #b5b5b5; }
html[data-theme="dark"] .reg-form .inv-vat-ok { border-color: #3b5544; background: #17251b; }
html[data-theme="dark"] .reg-form .inv-vat-ok p:first-child { color: #57db81; }
html[data-theme="dark"] .reg-form .inv-vat-bad { border-color: #563131; background: #291111; }
html[data-theme="dark"] .reg-form .inv-vat-bad p:first-child { color: #e88b8b; }
html[data-theme="dark"] .reg-form .inv-vat-warn { border-color: #625631; background: #2f260e; }
html[data-theme="dark"] .reg-form .inv-vat-wait { color: #b5b5b5; }
html[data-theme="dark"] .reg-form .inv-vat-advice { background: #34290f; color: #ffbc33; }
html[data-theme="dark"] .reg-form .inv-chips button { border: 1px solid #453a41; background: #1a1a1a; color: #bebebe; }
html[data-theme="dark"] .reg-form .inv-chips button:hover { color: #ff6bbc; }
html[data-theme="dark"] .reg-form .inv-cur,
html[data-theme="dark"] .reg-form .inv-conv { color: #a2a2a2; }
html[data-theme="dark"] .reg-form .inv-summary { background: #21181c; }
html[data-theme="dark"] .reg-form .inv-summary dt { color: #bebebe; }
html[data-theme="dark"] .reg-form .inv-summary .inv-strong dt,
html[data-theme="dark"] .reg-form .inv-summary .inv-strong dd { color: #dadada; }
html[data-theme="dark"] .reg-form .inv-table th { border-bottom: 2px solid #472f3c; color: #b5b5b5; }
html[data-theme="dark"] .reg-form .inv-table td { border-bottom: 1px solid #422f3b; }
html[data-theme="dark"] .reg-form .inv-table .inv-empty { color: #acacac; }
html[data-theme="dark"] .reg-form .inv-warn { color: #f6954c; }
html[data-theme="dark"] .reg-form .inv-provider .inv-edit { color: #ff6bbc; }
html[data-theme="dark"] .reg-form .rf-card h3 { color: #d1d1d1; }
html[data-theme="dark"] .reg-form .rf-btn { background: #1a1a1a; color: #ff6bbc; }
html[data-theme="dark"] .reg-form .rf-btn:hover { background: #2b0d1c; }
html[data-theme="dark"] .reg-form .rf-ok { color: #57db81; }
html[data-theme="dark"] .reg-form .notify-page img[alt="QR"] { border: 1px solid #472f3c; background: #1a1a1a; }

/* ==== z calendar.css (23 pravidel) ==== */
html[data-theme="dark"] .cal { color: #d6d6d6; }
html[data-theme="dark"] .cal-toolbar { background: #1a1a1a; }
html[data-theme="dark"] .cal-period label { color: #bebebe; }
html[data-theme="dark"] .cal-period input[type="date"] { border: 1px solid #453a41; background: #1a1a1a; color: #dadada; }
html[data-theme="dark"] .cal-btn { background: #1a1a1a; }
html[data-theme="dark"] .cal-btn:hover { background: #2b0d1c; }
html[data-theme="dark"] .cal-legend { color: #bebebe; }
html[data-theme="dark"] .cal-week { background: #1a1a1a; }
html[data-theme="dark"] .cal-week-title { background: #2a101e; }
html[data-theme="dark"] .cal-day { border-left: 1px solid #422f3b; background: #1a1a1a; }
html[data-theme="dark"] .cal-day.cal-weekend { background: #22151d; }
html[data-theme="dark"] .cal-day.cal-outside { background: #1b1b1b; }
html[data-theme="dark"] .cal-open-btn.is-open,
html[data-theme="dark"] .cal-open-label.is-open { background: #19281d; color: #57db81; border-color: #334c3a; }
html[data-theme="dark"] .cal-open-btn.is-closed,
html[data-theme="dark"] .cal-open-label.is-closed { background: #212121; color: #b5b5b5; border-color: #3e3e3e; }
html[data-theme="dark"] .cal-name { color: #dddddd !important; }
html[data-theme="dark"] .cal-icon { color: #bebebe !important; }
html[data-theme="dark"] .cal-icon:hover { color: #ededed !important; }
html[data-theme="dark"] .cal-menu { background: #1a1a1a; border: 1px solid #463841; }
html[data-theme="dark"] .cal-menu-title { color: #b5b5b5; }
html[data-theme="dark"] .cal-menu-item { color: #dadada; }
html[data-theme="dark"] .cal-menu-item:hover,
html[data-theme="dark"] .cal-menu-item:focus { background: #2a101e; }
html[data-theme="dark"] .cal-menu-item.is-current { background: #221a1e; }
@media (max-width: 760px) {
  html[data-theme="dark"] .cal-day { border-top: 1px solid #422f3b; }
}

/* ==== z buttons.css (3 pravidel) ==== */
html[data-theme="dark"] .admin_left_menu { border: 1px solid #4f2a3d !important; }
html[data-theme="dark"] #menu a:hover { background-color: rgba(26,26,26,0.18); }
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="tel"],
html[data-theme="dark"] input[type="url"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] textarea,
html[data-theme="dark"] select { background-color: #1a1a1a; }

/* ==== z responsive.css (1 pravidel) ==== */
@media screen and (max-width: 820px) {
  html[data-theme="dark"] #header { background: #1a1a1a none; }
  html[data-theme="dark"] #menu a { border-bottom: 1px solid #632c44; }
  html[data-theme="dark"] #main { background: #1a1a1a none; }
  html[data-theme="dark"] #footer { background: #1a1a1a none; }
}


/* ===================================================================================== */
/* ====================== část 3: ruční úpravy tmavé varianty ========================== */
/* ===================================================================================== */

/* původní univerzální pravidlo "* { border: thin solid #fff }" – bílé okraje by na tmavém pozadí svítily */
:where(html[data-theme="dark"]) * { border-color: #17171c; }

html[data-theme="dark"] body { background: #0e0e11; color: #b9b9c4; }
html[data-theme="dark"] #main { background: #17171c !important; }
html[data-theme="dark"] #footer { background: #17171c !important; border-top: 1px solid #2c2c35; color: #8f8f9b; }
html[data-theme="dark"] #central, html[data-theme="dark"] #left, html[data-theme="dark"] #right { color: #cfcfd8; }

/* hlavička: světlá grafika (logo na světlém podkladu) se invertuje, odstín zůstává (růžové logo zůstane růžové) */
html[data-theme="dark"] #header { background-color: #17171c; }
@media screen and (min-width: 821px) {
    html[data-theme="dark"] #header { background-image: none !important; position: relative; }
    html[data-theme="dark"] #header::before { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: url("../img/header_bg.png") no-repeat left top; z-index: 0; }
    html[data-theme="dark"] #header > * { position: relative; z-index: 1; }
}
html[data-theme="dark"] #header::before { filter: invert(.92) hue-rotate(180deg) brightness(1.05); }

/* pole formulářů a výběry */
html[data-theme="dark"] input[type="text"], html[data-theme="dark"] input[type="password"], html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="tel"], html[data-theme="dark"] input[type="number"], html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="search"], html[data-theme="dark"] input[type="url"], html[data-theme="dark"] input:not([type]),
html[data-theme="dark"] select, html[data-theme="dark"] textarea { background-color: #1f1f26; color: #e6e6ec; border-color: #6b2a4d; }
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: #7d7d8a; }
html[data-theme="dark"] input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px #2a2030 inset !important; -webkit-text-fill-color: #e6e6ec !important; }
html[data-theme="dark"] option { background: #1f1f26; color: #e6e6ec; }

/* přepínač jazyků má barvy přímo v elementu (inline styl) */
html[data-theme="dark"] #lang_switch select { background-color: #1f1f26 !important; color: #e6e6ec !important; border-color: #e5007d !important; }
html[data-theme="dark"] #theme_switch { background: #1f1f26; }
html[data-theme="dark"] #theme_switch button + button { border-left-color: #4a2338 !important; }
html[data-theme="dark"] #theme_switch button:hover { background: #2d1a25 !important; }

/* přihlašovací box a menu */
html[data-theme="dark"] #login_box { background: #1c1c22; border-color: #3a3a46; color: #cfcfd8; }
html[data-theme="dark"] #menu { background-color: #e5007d; }

/* jQuery UI (datepicker, dialogy, autocomplete) */
html[data-theme="dark"] .ui-widget, html[data-theme="dark"] .ui-widget-content { background: #1c1c22; color: #dcdce4; border-color: #3a3a46; }
html[data-theme="dark"] .ui-widget-header { background: #2a2a33; color: #f0f0f4; border-color: #3a3a46; }
html[data-theme="dark"] .ui-widget-content a { color: #ff6bbc; }
html[data-theme="dark"] .ui-state-default, html[data-theme="dark"] .ui-widget-content .ui-state-default, html[data-theme="dark"] .ui-widget-header .ui-state-default { background: #25252d; color: #dcdce4; border-color: #3a3a46; }
html[data-theme="dark"] .ui-state-hover, html[data-theme="dark"] .ui-state-focus, html[data-theme="dark"] .ui-widget-content .ui-state-hover { background: #34343f; color: #fff; border-color: #55556a; }
html[data-theme="dark"] .ui-state-active, html[data-theme="dark"] .ui-widget-content .ui-state-active { background: #e5007d; color: #fff; border-color: #b10061; }
html[data-theme="dark"] .ui-state-highlight, html[data-theme="dark"] .ui-widget-content .ui-state-highlight { background: #3d2a12; color: #ffd8a0; border-color: #6a4a1c; }
html[data-theme="dark"] .ui-datepicker td span, html[data-theme="dark"] .ui-datepicker td a { color: #dcdce4; }
html[data-theme="dark"] .ui-datepicker .ui-state-disabled span { color: #6d6d7a; }
html[data-theme="dark"] .ui-widget-overlay { background: #000; opacity: .6; }
html[data-theme="dark"] .ui-menu .ui-menu-item { color: #dcdce4; }

/* barevné buňky přehledů (zůstávají výrazné, text na nich tmavý) */
html[data-theme="dark"] td.red, html[data-theme="dark"] td.yellow, html[data-theme="dark"] td.orange, html[data-theme="dark"] td.green { color: #000; }

/* obrázky: mírné zeslabení, aby světlé grafiky nesvítily (ploché logo / foto) */
html[data-theme="dark"] #central img:not([src*="emoji"]):not([alt="QR"]):not(.country-flag):not([src*="flag"]) { filter: brightness(.9); }

/* posuvníky a výběr textu */
html[data-theme="dark"] ::selection { background: #7a0f4b; color: #fff; }
html[data-theme="dark"] hr { border-color: #2c2c35; }
html[data-theme="dark"] code, html[data-theme="dark"] pre { background: #1f1f26; color: #e0e0e8; }

/* proměnné používané tlačítky a kalendářem */
html[data-theme="dark"] { --btn-pink-light: #3a1428; --btn-border: #6b2a4d; }
html[data-theme="dark"] .cal { --cal-border: #4a2338; color: #d6d6de; }
/* karty angažmá v kalendáři: barvu pozadí nastavuje PHP jako světlou proměnnou --bg, v tmavém vzhledu se barva stavu jen přimíchá */
html[data-theme="dark"] .cal-chip { background: #25252d; background: color-mix(in srgb, var(--c) 22%, #1c1c22); }
html[data-theme="dark"] .cal-chip .cal-name { color: #f1f1f5 !important; }
