/*
 * Dark Mode theme — override stylesheet.
 *
 * Dark canvas, slim Navy header strip, lifted dark cards, white-tinted
 * headlines, brand Green primary action. Structurally mirrors
 * theme-vacation-bay and theme-professional-blue so the three feel like
 * one product painted in different palettes.
 */

/*--------------------------------------------------------------------------
 * 1. Body canvas — true dark.
 *------------------------------------------------------------------------*/
body.theme-dark-mode,
body.theme-dark-mode .status.message {
    color: var(--text-color);
}
body.theme-dark-mode {
    background: var(--background-backdrop);
    background-image: none;
}

/*--------------------------------------------------------------------------
 * 2. Header strip — solid Navy with a subtle lift on the bottom edge.
 *------------------------------------------------------------------------*/
body.theme-dark-mode div.head {
    background: linear-gradient(90deg, #1c1f24 0%, #0f1014 100%);
}
body.theme-dark-mode.vertical-menu div.head {
    background: linear-gradient(180deg, #1c1f24 0%, #15171b 100%);
}

body.theme-dark-mode div.header-branding,
body.theme-dark-mode.vertical-menu div.header-branding {
    background-color: transparent;
}

body.theme-dark-mode .header-navigation .dropbtn,
body.theme-dark-mode .header-navigation .top-link-button,
body.theme-dark-mode .header-navigation .top-link-button a,
body.theme-dark-mode .top-link-generic {
    color: var(--text-color);
    background-color: transparent;
}
body.theme-dark-mode .top-link-button:hover,
body.theme-dark-mode .header-navigation .dropdown:hover .dropbtn {
    background-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark-mode a.dropdown.access-feature-internal {
    background-color: #2a2c31;
}
body.theme-dark-mode a.dropdown.access-feature-admin {
    background-color: #1f2125;
}

/*--------------------------------------------------------------------------
 * 3. Dropdown panels — lifted dark surface.
 *------------------------------------------------------------------------*/
body.theme-dark-mode .header-navigation .dropdown-content {
    background-color: #2a2c31;
    border: 1px solid #3a3d44;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
body.theme-dark-mode .dropdown-content a {
    color: var(--text-color);
}
body.theme-dark-mode .dropdown-content a:hover {
    background-color: #3a3d44 !important;
}

/*--------------------------------------------------------------------------
 * 4. Headline hierarchy — White h1/h2, slightly muted h3.
 *------------------------------------------------------------------------*/
body.theme-dark-mode h1,
body.theme-dark-mode h2,
body.theme-dark-mode h3,
body.theme-dark-mode h4,
body.theme-dark-mode h5 {
    color: var(--text-color);
}

/*--------------------------------------------------------------------------
 * 5. Cards — lifted dark surfaces with hairline border.
 *------------------------------------------------------------------------*/
body.theme-dark-mode .content,
body.theme-dark-mode .content-section,
body.theme-dark-mode .modal-content {
    background-color: var(--background-color);
    border: 1px solid #2e3137;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* common.css hard-codes div.section-2 to a tan rgb(215,215,190); restate. */
body.theme-dark-mode div.section-2 {
    background: var(--background-color);
    border: 1px solid #2e3137;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/*--------------------------------------------------------------------------
 * 6. Tables / smart-table headers — pull from variables now, not hardcoded.
 *------------------------------------------------------------------------*/
body.theme-dark-mode #sleeve-weights-table .smart-table-cell,
body.theme-dark-mode #smart-table-unallocated-cash .smart-table-cell,
body.theme-dark-mode .smart-table-header-row,
body.theme-dark-mode .smart-table-header-row .smart-table-cell {
    background-color: var(--smart-table-header);
    color: var(--text-color);
}

body.theme-dark-mode .text-dark {
    color: var(--text-color) !important;
}

/*--------------------------------------------------------------------------
 * 7. Inputs
 *------------------------------------------------------------------------*/
body.theme-dark-mode input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]),
body.theme-dark-mode select,
body.theme-dark-mode textarea,
body.theme-dark-mode button:not(.btn) {
    background-color: var(--background-secondary);
    color: var(--text-color);
    border: 1px solid #3a3d44;
}
body.theme-dark-mode input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):focus,
body.theme-dark-mode select:focus,
body.theme-dark-mode textarea:focus {
    outline: none;
    border-color: var(--color-1);
    box-shadow: 0 0 0 2px rgba(110, 190, 74, 0.25);
}
/*--------------------------------------------------------------------------
 * 8. Misc surfaces
 *------------------------------------------------------------------------*/
body.theme-dark-mode .linked-popup,
body.theme-dark-mode .modal-footer,
body.theme-dark-mode .jq-dropdown .jq-dropdown-menu,
body.theme-dark-mode .jq-dropdown .jq-dropdown-panel {
    background-color: #2a2c31;
    color: var(--text-color);
    border-color: #3a3d44;
}

body.theme-dark-mode .client-billing-row,
body.theme-dark-mode .portfolio-rebal {
    background-color: var(--background-color);
}

body.theme-dark-mode label.btn.select span {
    color: var(--text-color);
}

body.theme-dark-mode {
    scrollbar-color: #4a4d54 #1f2125;
}

body.theme-dark-mode canvas.smart-chart {
    background-color: unset;
}
body.theme-dark-mode .dropdown-menu {
    background-color: #2a2c31;
}
/* Bootstrap's .dropdown-item has color:#212529 hardcoded; against the
 * dark .dropdown-menu surface that's near-invisible (#212529 on #2a2c31).
 * Pull the item text up to the theme's --text-color. */
body.theme-dark-mode .dropdown-menu .dropdown-item {
    color: var(--text-color);
}
body.theme-dark-mode .dropdown-menu a.dropdown-item.disabled {
    color: var(--text-secondary);
}
body.theme-dark-mode .note-editor.note-frame {
    background-color: var(--background-secondary);
}

/* footer.css hard-codes div.footer color: white — keep it readable on dark. */
body.theme-dark-mode div.footer,
body.theme-dark-mode div.footer a {
    color: var(--text-secondary);
}

/*--------------------------------------------------------------------------
 * 9. Plugin-specific surfaces (RSJ etc.)
 *------------------------------------------------------------------------*/
body.theme-dark-mode .rsj-data-controls {
    background-color: var(--background-color);
    border-color: #3a3d44;
}
body.theme-dark-mode .rsj-journal-date .rsj-journal-item:nth-child(2n) {
    background-color: #25272c;
}
body.theme-dark-mode .rsj-journal-date .rsj-journal-item:nth-child(2n+1) {
    background-color: #1f2125;
}
body.theme-dark-mode .rsj-journal-date.number-column {
    color: rgb(192,192,192);
}
body.theme-dark-mode .rsj-journal-date-text,
body.theme-dark-mode .rsj-journal-item > * {
    border-color: #3a3d44;
}
body.theme-dark-mode .rsj-journal-item-ticker a {
    color: rgb(224,224,224);
}
body.theme-dark-mode .rsj-journal-item.invalid-item,
body.theme-dark-mode .rsj-journal-date .rsj-journal-item:nth-child(2n).invalid-item {
    background-color: #3a3d44;
    color: rgb(160,160,160);
}
body.theme-dark-mode .rsj-journal-item.invalid-item .rsj-journal-item-ticker a,
body.theme-dark-mode .rsj-journal-item.invalid-item .rsj-journal-item-ticker b,
body.theme-dark-mode .rsj-journal-item.invalid-item .rsj-journal-item-ppo {
    color: rgb(160,160,160) !important;
}
body.theme-dark-mode .rsj-journal-item.invalid-item .rsj-journal-item-histogram {
    background-color: #4a4d54 !important;
}

body.theme-dark-mode .screener .screener-selections {
    background-color: var(--background-color);
    border: 1px solid #3a3d44;
    border-radius: 4px;
    padding: 0.75em;
    margin-bottom: 0.5em;
}
body.theme-dark-mode .screener .screener-selections > label > span {
    color: var(--text-secondary);
}
body.theme-dark-mode .screener hr {
    border-color: #3a3d44;
}

body.theme-dark-mode .div-report-inputs {
    background: var(--background-color);
    border-color: #3a3d44;
}

body.theme-dark-mode #ppo-report-popup .ppo-report-chart-technicals-holder {
    border-color: #3a3d44;
}
body.theme-dark-mode #ppo-report-popup .btn-light {
    background-color: var(--background-secondary);
    color: var(--text-color);
    border-color: #3a3d44;
}
