/* =============================================================================
   Theming layer (light theme) — MyCapital
   -----------------------------------------------------------------------------
   The app ships DARK by default (the existing style.css hardcodes the dark
   palette). This file adds a light theme WITHOUT touching the compiled SCSS:

     * design tokens are declared as CSS custom properties on :root (dark values,
       for reference/reuse) and overridden under html[data-theme="light"];
     * light-theme rules are scoped under [data-theme="light"] so the dark theme
       is never affected.

   It is loaded LAST (after style.css + ui-only-fixes.css) so its overrides win
   at equal specificity; deep/high-specificity component selectors are mirrored
   with the [data-theme="light"] prefix (which adds an attribute's worth of
   specificity) where needed.

   The theme is applied by setting data-theme="light" on <html> (see the
   early-apply script in _BaseLayout; toggled via [data-theme-toggle]).
   First pass: app shell. Deep components are migrated iteratively.
   ============================================================================ */

:root {
    --app-bg: #24252b;
    --surface: #2c2d34;
    --surface-2: #36373d;
    --surface-input: #2c2c33;
    --border: #47484c;
    --text: #ffffff;
    --text-muted: #89898d;
    --accent: #2d77ab;
}

html[data-theme="light"] {
    --app-bg: #eef1f5;
    --surface: #ffffff;
    --surface-2: #f3f5f8;
    --surface-input: #ffffff;
    --border: #dde1e7;
    --text: #1f2633;
    --text-muted: #6b7280;
    --accent: #2d77ab;
    color-scheme: light;
}

/* ---- Brand logo (theme-aware lockup) --------------------------------------- */
/* New MyCapital lockup, swapped by theme: dark theme (dark header) shows the
   cream/gold lockup; light theme shows the dark-ink lockup. Mirrors the
   theme-toggle icon show/hide pattern. */
.mc-logo-light { display: none; }
html[data-theme="light"] .mc-logo-dark { display: none; }
html[data-theme="light"] .mc-logo-light { display: inline-block; }

/* ---- Theme toggle button (header) ------------------------------------------ */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    cursor: pointer;
}

.theme-toggle-btn .theme-ico { width: 18px; height: 18px; display: block; }
.theme-toggle-btn .theme-ico-sun { display: none; }
html[data-theme="light"] .theme-toggle-btn .theme-ico-moon { display: none; }
html[data-theme="light"] .theme-toggle-btn .theme-ico-sun { display: block; }

/* =============================================================================
   LIGHT THEME — app shell overrides
   ============================================================================ */
html[data-theme="light"] body {
    background: var(--app-bg);
    color: var(--text);
}

/* Header + sidebar intentionally STAY DARK in light theme (dark navigation
   chrome + light content — a standard, professional light-theme pattern). This
   keeps the white MyCapital logo + header/sidenav text legible without needing a
   separate light-mode logo asset. Only the content area goes light. */

/* Widgets / cards / popups */
html[data-theme="light"] .widget,
html[data-theme="light"] .table-widget,
html[data-theme="light"] .custom-card,
html[data-theme="light"] .profile-card,
html[data-theme="light"] .popup-modal,
html[data-theme="light"] .notification-modal {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

/* Headings / section titles / body copy */
html[data-theme="light"] .section-title,
html[data-theme="light"] h1,
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] h4,
html[data-theme="light"] h5,
html[data-theme="light"] .text-l,
html[data-theme="light"] .text-wrap .text-l {
    color: var(--text);
}

html[data-theme="light"] .text-base,
html[data-theme="light"] .label-1,
html[data-theme="light"] .label-2 {
    color: var(--text-muted);
}

/* Page title ("PORTFELJ" etc.) + any remaining light-on-light copy in content. */
html[data-theme="light"] .main-layout .page-title-frame .title,
html[data-theme="light"] .main-layout .page-title-frame h2,
html[data-theme="light"] .main-layout .text-wrap .text-base {
    color: var(--text);
}

/* Tables (generic .table-widget) */
html[data-theme="light"] .main-layout .table-widget table thead td {
    background: var(--surface-2);
    color: var(--text-muted);
}

html[data-theme="light"] .main-layout .table-widget table tbody td,
html[data-theme="light"] .main-layout .table-widget table .t-inner {
    color: var(--text);
}

/* Keep the gain/loss (green/red) numbers coloured in light theme. The generic
   .t-inner { color: var(--text) } override above is more specific than the base
   .green/.red rules (site.css, no !important), so without this the Nerealizirano /
   Rezultat % values go dark. Darker shades than the dark-theme #7BD47C/#E35858 for
   contrast on white. Covers positions AND transactions (same .table-widget table). */
html[data-theme="light"] .main-layout .table-widget table td .green {
    color: #1a7f4f !important;
}
html[data-theme="light"] .main-layout .table-widget table td .red {
    color: #c0392b !important;
}

html[data-theme="light"] .main-layout .table-widget table tr {
    border-color: var(--border);
}

/* Inputs / selects */
html[data-theme="light"] .input-1,
html[data-theme="light"] .input-2,
html[data-theme="light"] .input-3,
html[data-theme="light"] .select-1,
html[data-theme="light"] .dk-select .dk-selected {
    background: var(--surface-input);
    color: var(--text);
    border-color: var(--border);
}

html[data-theme="light"] .dk-select-options {
    background: var(--surface);
    border-color: var(--border);
}

/* Divider line */
html[data-theme="light"] .line {
    background-color: var(--border);
}

/* =============================================================================
   LIGHT THEME — second pass (sidebar, values, selects, scrollbars)
   ============================================================================ */

/* Sidebar nav: WHITE panel with GREY labels + icons (active item = accent). The
   base icons are white SVGs (some stroke-, some fill-based), so recolour them
   with filter: brightness(0) + opacity -> grey, which works regardless of how
   each icon is drawn; the active item keeps its accent colour. */
html[data-theme="light"] .sidenav .nav-wrap,
html[data-theme="light"] .sidenav .sidenav-block {
    background: var(--surface);
    box-shadow: inset -1px 0 0 var(--border);
}

html[data-theme="light"] .sidenav .main-nav a,
html[data-theme="light"] .sidenav .sidenav-block a {
    color: #6b7280;
    opacity: 1;
}

html[data-theme="light"] .sidenav .main-nav a:hover,
html[data-theme="light"] .sidenav .main-nav .active a {
    color: var(--accent);
}

html[data-theme="light"] .sidenav .main-nav li:not(.active) svg,
html[data-theme="light"] .sidenav .sidenav-block svg {
    filter: brightness(0);
    opacity: 0.5;
}

/* Active nav icon -> accent blue. The icons are <use> refs into icons.svg, whose
   symbols hardcode their fills, so stroke/fill CSS can't recolour them. Use a
   colorize filter (works on the rendered pixels regardless of internal fills)
   to tint the active icon to ~accent blue. */
html[data-theme="light"] .sidenav .main-nav .active svg {
    filter: brightness(0) saturate(100%) invert(39%) sepia(21%) saturate(1748%) hue-rotate(172deg) brightness(93%) contrast(88%);
    opacity: 1;
}

/* Portfolio value tiles ("0,00 EUR") were white-on-white (deep .text-l rule). */
html[data-theme="light"] .main-layout .text-l { color: var(--text) !important; }

/* Custom selects (Dropkick) incl. the portfolio picker. The portfelj sheet sets
   `.custom-select.select-1 .dk-selected { background:#36373D }` at equal-or-greater
   specificity, so match that selector and use !important to win. */
html[data-theme="light"] .custom-select.select-1,
html[data-theme="light"] .select-1 { color: var(--text) !important; }

html[data-theme="light"] .custom-select.select-1 .dk-selected,
html[data-theme="light"] .select-1 .dk-selected {
    background-color: var(--surface-input) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 6px;
}

html[data-theme="light"] .custom-select.select-1 .dk-select-options,
html[data-theme="light"] .select-1 .dk-select-options,
html[data-theme="light"] .dk-select-options {
    background: var(--app-bg) !important;   /* blend the panel (incl. its closed white strip) with the page bg */
    border-color: var(--border) !important;
}

html[data-theme="light"] .custom-select.select-1 .dk-option,
html[data-theme="light"] .dk-option { color: var(--text) !important; }

html[data-theme="light"] .custom-select.select-1 .dk-option-highlight,
html[data-theme="light"] .dk-option.dk-option-highlight,
html[data-theme="light"] .dk-option:hover { background: var(--surface-2) !important; }

/* Light scrollbars inside content scroll frames (the dark track read as a white
   bar on the light surface). */
html[data-theme="light"] .table-frame,
html[data-theme="light"] .positions-table-frame,
html[data-theme="light"] .optiscroll {
    scrollbar-color: #c3c9d2 #eef1f5;
}
html[data-theme="light"] .table-frame::-webkit-scrollbar,
html[data-theme="light"] .positions-table-frame::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
html[data-theme="light"] .table-frame::-webkit-scrollbar-track,
html[data-theme="light"] .positions-table-frame::-webkit-scrollbar-track {
    background: #eef1f5;
}
html[data-theme="light"] .table-frame::-webkit-scrollbar-thumb,
html[data-theme="light"] .positions-table-frame::-webkit-scrollbar-thumb {
    background: #c3c9d2;
    border-radius: 6px;
}

/* =============================================================================
   LIGHT THEME — third pass (light header text/icons + chart controls)
   The header stays LIGHT, so its white text/icons (designed for a dark bar) must
   be recoloured to dark/grey.
   ============================================================================ */
html[data-theme="light"] #page-header .header-options p,
html[data-theme="light"] #page-header .header-options p strong,
html[data-theme="light"] #page-header .header-nav a,
html[data-theme="light"] .header-nav .header-platform-link > a {
    color: var(--text);
}

html[data-theme="light"] .header-nav .header-platform-link > a {
    border-color: var(--border);
}

/* Header icons (notification bell, theme toggle) -> muted grey. */
html[data-theme="light"] #page-header .header-nav svg {
    stroke: var(--text-muted);
    fill: var(--text-muted);
}
html[data-theme="light"] #page-header .theme-toggle-btn .theme-ico-sun {
    stroke: var(--text-muted);
    fill: none;
}

/* NAV chart controls: period picks (1d/1t/1m/6m/1g/Sve) + expand icon. */
html[data-theme="light"] .picks .pick {
    color: var(--text) !important;              /* was rgba(255,255,255,.7) -> invisible on white */
    border-color: var(--border) !important;
}
html[data-theme="light"] .picks .pick.active {
    color: #fff !important;
}
html[data-theme="light"] .nav-chart-expand-btn,
html[data-theme="light"] .nav-chart-expand-btn svg {
    color: var(--text-muted);
    stroke: var(--text-muted);
    fill: var(--text-muted);
}

/* =============================================================================
   LIGHT THEME — legibility: bolder + darker table & sidebar text
   ============================================================================ */
/* Tables: bolder cells + headers, and a darker (not teal/faint) header colour. */
html[data-theme="light"] .main-layout .table-widget table tbody td,
html[data-theme="light"] .main-layout .table-widget table tbody .t-inner,
html[data-theme="light"] .main-layout .table-widget table thead td,
html[data-theme="light"] .main-layout .table-widget table .sorter {
    font-weight: 700;
}

html[data-theme="light"] .main-layout .table-widget table thead td,
html[data-theme="light"] .main-layout .table-widget table thead .sorter {
    color: #3a4150 !important;
}

/* Sidebar labels: bolder + slightly darker grey so the small (9px) nav text reads. */
html[data-theme="light"] .sidenav .main-nav a,
html[data-theme="light"] .sidenav .sidenav-block a {
    font-weight: 700;
    color: #565e6b;
}

/* =============================================================================
   LIGHT THEME — Transakcije / Promet controls (date filters, pagination)
   ============================================================================ */
/* Date filter inputs (were dark #36373D). */
html[data-theme="light"] .filter-date input {
    background-color: var(--surface-input) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

/* Pagination (simplePagination). The SERVED style.css renders the pill as
   `.simple-pagination ul { #313137 }` and the prev/next arrows as its first/last
   <li> circles ({ #313137 }); numbers/arrows are white spans/links. Retheme all. */
html[data-theme="light"] .simple-pagination ul {
    background-color: var(--surface);
}
html[data-theme="light"] .simple-pagination ul li:first-child,
html[data-theme="light"] .simple-pagination ul li:last-child {
    background-color: var(--surface-2) !important;   /* arrow circles (were #313137) */
}
html[data-theme="light"] .simple-pagination ul span,
html[data-theme="light"] .simple-pagination ul a {
    color: var(--text-muted) !important;
}
html[data-theme="light"] .simple-pagination ul li:hover a,
html[data-theme="light"] .simple-pagination ul li.active span:not(.prev):not(.next) {
    color: var(--text) !important;
}

/* Rows-per-page selector ("Redova po stranici: 10"). */
html[data-theme="light"] .page-size-select {
    background-color: var(--surface-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
}
html[data-theme="light"] .page-size-label { color: var(--text-muted); }

/* The filter widget has a decorative dark JPG (portfelja-bg.jpg) top-right that
   only reads on the dark theme (and the general .widget { background } override
   wiped it anyway). Replace it with a subtle CSS radial glow so the motif stays
   present — and visible — on the light surface. */
html[data-theme="light"] .main-layout .filter-widget {
    background-color: var(--surface);
    background-image: radial-gradient(circle at 100% 0%, rgba(45, 119, 171, 0) 0 150px, rgba(45, 119, 171, 0.16) 150px 153px, rgba(45, 119, 171, 0) 153px 225px, rgba(45, 119, 171, 0.13) 225px 228px, rgba(45, 119, 171, 0) 228px 300px, rgba(45, 119, 171, 0.10) 300px 303px, rgba(45, 119, 171, 0) 303px);
    background-repeat: no-repeat;
    background-position: 100% 0%;
    background-size: auto;
}

/* =============================================================================
   LIGHT THEME — darken faint helper / empty-state / placeholder text
   (e.g. the Promet search hint, "Nema prometa…" notice, input placeholders were
   too light — #b7b8bf / #89898d — to read on the white surface).
   ============================================================================ */
html[data-theme="light"] .traffic-filter-help,
html[data-theme="light"] .traffic-notice,
html[data-theme="light"] .form-text,
html[data-theme="light"] .form-txt-2,
html[data-theme="light"] .text-muted {
    color: var(--text-muted) !important;
}

html[data-theme="light"] .traffic-filter-help .traffic-info-badge {
    border-color: var(--text-muted);
    color: var(--text-muted);
}

html[data-theme="light"] .input-1::placeholder,
html[data-theme="light"] .input-2::placeholder,
html[data-theme="light"] .input-3::placeholder,
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
    color: #9aa1ab;
    opacity: 1;
}

/* The last 4 columns carry a dark highlight band (#313238) meant for the dark theme.
   On light it reads as an odd darker stripe down the right side of the table, so drop it
   entirely (match the row surface). The header stays shaded (thead override above) so the
   column titles are still clearly distinguished. */
html[data-theme="light"] .main-layout .table-widget table tbody td:nth-last-child(-n+4) .t-inner {
    background-color: transparent;
}

/* =============================================================================
   LIGHT THEME — Settings (Postavke): ALL copy near-black
   -----------------------------------------------------------------------------
   Every text element in the settings panels (tabs + the col-1 content: password
   change / 2FA / passkeys) is forced to near-black. Buttons keep their own
   colours (they don't use these text tags), and the blue .widget-support cards
   in col-2 keep white text (handled below).
   ============================================================================ */
html[data-theme="light"] .main-layout.style-2 .widget-nav li a,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 h3,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 h4,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 h5,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 h6,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 p,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 label,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 .label-1,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 .label-2,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 .support-status,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 .password-policy-list,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 .password-policy-list li,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 .highlight-txt,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 .widget-info span,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 .widget-title-2,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 .input-2,
html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 input {
    color: #16202e !important;
}

html[data-theme="light"] .main-layout.style-2 .layout-col.col-1 input::placeholder {
    color: #555b66 !important;
    opacity: 1;
}

/* The PWA-install + support cards (col-2) are blue gradients (.widget-support);
   keep their text white. */
html[data-theme="light"] .widget-support h4,
html[data-theme="light"] .widget-support h5,
html[data-theme="light"] .widget-support p,
html[data-theme="light"] .widget-support label,
html[data-theme="light"] .widget-support .support-status,
html[data-theme="light"] .widget-support textarea {
    color: #fff !important;
}
html[data-theme="light"] .widget-support textarea::placeholder {
    color: rgba(255, 255, 255, 0.75);
}

/* =============================================================================
   LIGHT THEME — modals / popups (2FA, confirm dialogs, notifications)
   ============================================================================ */
html[data-theme="light"] .popup-box .popup-modal {
    background-color: var(--surface);              /* was #35373d; blue top accent (:before) kept */
}
html[data-theme="light"] .popup-box h4 { color: var(--text); }
html[data-theme="light"] .popup-box h5,
html[data-theme="light"] .popup-box .text-1,
html[data-theme="light"] .popup-box .form-txt-2 { color: var(--text-muted); }
html[data-theme="light"] .popup-box .form-txt-2 span { color: var(--text); }

html[data-theme="light"] .popup-box .close-popup { background: var(--surface-2); }
html[data-theme="light"] .popup-box .close-popup svg { fill: var(--text-muted); }

html[data-theme="light"] .popup-box .input-3 {
    background: var(--surface-input);
    color: var(--text);
    border-color: var(--border);
}
html[data-theme="light"] .popup-box .twofa-manual-key,
html[data-theme="light"] .popup-box .twofa-message { color: var(--text); }

/* Notifications popup (header bell). */
html[data-theme="light"] .notification-modal .title,
html[data-theme="light"] .notification-modal .notifications-list .date,
html[data-theme="light"] .notification-modal .notifications-list .content {
    color: var(--text);
}
html[data-theme="light"] .notification-modal .notifications-list .date {
    color: var(--text-muted);
}

/* =============================================================================
   LIGHT THEME — IPO page (Ipo.cshtml inline .ipo-* classes, built for dark)
   ============================================================================ */
html[data-theme="light"] .ipo-card {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: 0 1px 3px rgba(16, 32, 46, 0.06);
}
html[data-theme="light"] .ipo-card .ipo-ticker,
html[data-theme="light"] .ipo-param .v {
    color: var(--text);
}
html[data-theme="light"] .ipo-card .ipo-name,
html[data-theme="light"] .ipo-desc,
html[data-theme="light"] .ipo-param .k,
html[data-theme="light"] .ipo-mifid-note {
    color: var(--text-muted);
}
/* DEBUG scaffold bar (stub previews). */
html[data-theme="light"] .ipo-debug a {
    color: var(--text-muted);
    border-color: var(--border);
}
html[data-theme="light"] .ipo-debug a.on {
    color: var(--text);
}
/* Status badges already use translucent coloured pills -> fine on the light
   surface; .ipo-docs links keep their accent blue. */

/* IPO subscribe form (IpoSubscribe.cshtml inline .ipo-* panels/fields). */
html[data-theme="light"] .ipo-panel,
html[data-theme="light"] .ipo-slip-card {
    background: var(--surface);
    border-color: var(--border);
}
html[data-theme="light"] .ipo-panel h4,
html[data-theme="light"] .ipo-kv .v,
html[data-theme="light"] .ipo-section-label,
html[data-theme="light"] .ipo-slip-title,
html[data-theme="light"] .ipo-radio,
html[data-theme="light"] .ipo-info {
    color: var(--text);
}
html[data-theme="light"] .ipo-kv {
    border-bottom-color: var(--border);
}
html[data-theme="light"] .ipo-kv .k,
html[data-theme="light"] .ipo-field > label,
html[data-theme="light"] .ipo-sign-note,
html[data-theme="light"] .ipo-slip-empty {
    color: var(--text-muted);
}
html[data-theme="light"] .ipo-radio {
    border-color: var(--border);
}
html[data-theme="light"] .ipo-radio:hover {
    background: var(--surface-2);
}
html[data-theme="light"] .ipo-slip-empty {
    border-color: var(--border);
}
/* .ipo-radio:has(input:checked) (blue), .ipo-error (red), .ipo-info bg kept. */

/* Subscription-received note: was near-black (inherited) -> invisible on the
   dark IPO page. White on dark; dark on light (per request). */
.ipo-confirm .ipo-desc { color: #ffffff; }
html[data-theme="light"] .ipo-confirm .ipo-desc { color: #16202e !important; }


/* =============================================================================
   Smooth theme fade — pie-charts-widget decorative art
   The widget paints a dark JPG (portfelja-bg.jpg) as a background-image, which is
   NOT animatable, so toggling light -> dark snapped the art back in instantly
   ("odmah na crno"). Move the art onto an ::before overlay and cross-fade its
   opacity instead (0 on light). z-index keeps it behind the chart + legend.
   ========================================================================== */
.main-layout .pie-charts-widget { position: relative; z-index: 0; background-image: none; }
.main-layout .pie-charts-widget::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    border-radius: inherit;
    background-image: url("/img/bg/portfelja-bg.jpg");
    background-repeat: no-repeat;
    background-position: 130% 80%;
    background-size: 600px;
    opacity: 1;
}
html[data-theme="light"] .main-layout .pie-charts-widget::before { opacity: 0; }
html.theme-anim .main-layout .pie-charts-widget::before { transition: opacity .4s ease; }

/* The portfolio picker read as a stark white chip with a near-white (var(--border)
   = #dde1e7) edge on the light page, so the outline looked like a "weird white
   border". Firm the border to a defined grey so it reads as an intentional input. */
/* The portfolio picker read as a stark white chip on the grey page -> "weird white
   border". Dropkick copies the original classes onto the wrapper (confirmed in
   dropkick.js: addClass(elem, select.className)), so the DOM is:
     div.dk-select.custom-select.select-1.portfolio-title-select  (wrapper)
       > div.dk-selected                                          (visible box)
   Paint BOTH layers the same subtle grey so no white frame shows through, with one
   soft border on the inner box. High specificity + !important to beat theme.css:216. */
html[data-theme="light"] .main-layout .portfolio-title-select.dk-select {
    background-color: var(--app-bg) !important;
}
html[data-theme="light"] .main-layout .portfolio-title-select.dk-select .dk-selected,
html[data-theme="light"] .main-layout .custom-select.portfolio-title-select .dk-selected {
    background-color: var(--app-bg) !important;   /* exact page background so the picker fully blends */
    border: 1px solid #cdd3dc !important;
}
