/*
 * Theme colours (020-012). Loaded after app.css.
 *
 * Maps the existing styles onto the theme variables output in the page head
 * (foundation/settings/theme.php). Every var() falls back to the colour the
 * Hub used before, so with the VenWorx defaults nothing changes except the
 * automatic text contrast on primary / accent fills.
 */

/* ---- Text on primary / accent fills: dark or light, whichever reads better ---- */
.nav-item:hover,
.sidebar-theme-button:hover { color: var(--app-accent-text, #fff); }
.nav-item.active,
.icon-button:hover,
.avatar,
.profile-menu a:hover,
.profile-avatar-large,
.primary-button,
.text-button { color: var(--app-primary-text, #fff); }
.primary-button:hover,
.text-button:hover { color: var(--app-accent-text, #fff); }

/* ---- Primary / accent used as text on light backgrounds: readable shade ----
   (Icons on the dark tiles keep the exact colour; it reads well there.) */
.eyebrow,
.app-card-open,
.notification-mark-all,
.notification-more,
.placeholder-list a span,
.foundation-company-summary .panel-header h3,
.foundation-multi-select-actions button,
:is(.modal-eyebrow, .foundation-modal-eyebrow),
:is(.modal-title-variable, .foundation-modal-title-variable),
:is(.modal-detail-item, .foundation-modal-detail-item) a,
:is(.modal-manage-menu-list, .foundation-modal-manage-menu-list) a:hover,
:is(.modal-manage-menu-list, .foundation-modal-manage-menu-list) a:focus-visible,
.modal-action-menu-button:hover,
.modal-action-menu-button:focus-visible { color: var(--app-primary-ink, var(--app-primary)); }
.app-card-open:hover,
.notification-mark-all:hover,
:is(.modal-detail-item, .foundation-modal-detail-item) a:hover,
.foundation-detail-grid a,
.foundation-detail-grid span,
.foundation-detail-grid small,
.foundation-dependent-header h3,
.foundation-empty strong,
.foundation-clean-details a,
.permission-group h4,
.app-status-notice,
.module-status-notice,
.foundation-filter-grid label,
.date span { color: var(--app-accent-ink, var(--app-accent)); }

/* ---- Sidebar ---- */
.sidebar {
    background: var(--sidebar-bg, #101c23);
    color: var(--sidebar-text, #fff);
    border-right-color: var(--sidebar-line, #263840);
}
.brand { border-bottom-color: var(--sidebar-line, rgba(255, 255, 255, .08)); }
.brand-text strong { color: var(--sidebar-text, #fff); }
.nav-item { color: var(--sidebar-muted, #b7c6cc); }
.nav-section-label { color: var(--sidebar-label, #72868d); }
@media (min-width: 801px) { .sidebar-collapsed .nav-section-label { background: var(--sidebar-line, rgba(255, 255, 255, .1)); color: transparent; } } /* 020-038: full menu on phones */
.nav-divider { background: var(--sidebar-line, rgba(255, 255, 255, .1)); }
.sidebar-footer { border-top-color: var(--sidebar-line, rgba(255, 255, 255, .08)); }
.sidebar-theme-button {
    background: var(--sidebar-control, #13252d);
    border-color: var(--sidebar-control-border, #314850);
    color: var(--sidebar-muted, #b7c6cc);
}
.sidebar-theme-button:hover { background: var(--app-accent); border-color: var(--app-accent); }

/* ---- Header ---- */
.topbar {
    background: var(--header-bg, #13232b);
    border-bottom-color: var(--header-line, #29404a);
}
.page-heading h1 { color: var(--header-text, #fff); }
.topbar .eyebrow { color: var(--header-primary-ink, var(--app-primary)); }
.topbar .eyebrow-caret { color: var(--header-primary-ink, var(--app-primary)); }
.topbar .icon-button {
    background: var(--header-control, #1c3038);
    border-color: var(--header-control-border, #314850);
    color: var(--header-soft, #d9e4e7);
}
.topbar .icon-button:hover {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: var(--app-primary-text, #fff);
}
.topbar .notification-button.has-unread,
.topbar .notification-button.has-unread:hover {
    background: var(--header-control, #1c3038);
    border-color: var(--header-control-border, #314850);
    color: #f4c542;
}
.notification-badge { border-color: var(--header-bg, #13232b); }
.profile-button {
    background: var(--header-control, #1b3038);
    border-color: var(--header-control-border, #38515b);
    color: var(--header-text, #fff);
}
.profile-button:hover { background: var(--header-bg, #101c23); border-color: var(--app-accent); }
.profile-copy strong { color: var(--header-text, #fff); }
.profile-copy small { color: var(--header-muted, #a7bac1); }

/* ---- Sign-in card and other public pages: the sidebar / logo colour ---- */
.brand-surface {
    background: var(--brand-surface, #101c23);
    color: var(--brand-surface-text, #fff);
}
.brand-surface h1,
.brand-surface h2,
.brand-surface label { color: var(--brand-surface-text, #fff); }
.brand-surface .brand-surface-muted { color: var(--brand-surface-muted, #b7c6cc); }
.brand-surface a { color: var(--brand-surface-link, var(--app-primary)); }

/* ---- Program Settings: theme preview ---- */
.theme-layout { display: block; }
.theme-preset-row { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-preset { gap: 8px; font-size: 13px; padding: 8px 12px; }
.theme-preset-swatch { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, .15); display: inline-block; }
.theme-same-row { display: flex !important; gap: 7px; align-items: center; margin-top: 8px !important; font-weight: 600 !important; cursor: pointer; }
.theme-contrast-hint { color: #61777f; }
.theme-contrast-hint.theme-contrast-warning { color: #a33d36; font-weight: 600; }
.theme-preview { border: 1px solid #dce6e8; border-radius: 12px; overflow: hidden; font-size: 12px; box-shadow: 0 6px 18px rgba(20, 40, 50, .08); }
.theme-preview-header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--header-bg, #13232b); color: var(--header-text, #fff); border-bottom: 1px solid var(--header-line, #29404a); }
.theme-preview-header strong { flex: 1; font-size: 14px; }
.theme-preview-eyebrow { color: var(--header-primary-ink, var(--app-primary)); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.theme-preview-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; background: var(--header-control, #1c3038); border: 1px solid var(--header-control-border, #314850); color: var(--header-soft, #d9e4e7); }
.theme-preview-body { display: grid; grid-template-columns: 120px 1fr; min-height: 190px; }
.theme-preview-sidebar { background: var(--sidebar-bg, #101c23); padding: 10px 8px; display: flex; flex-direction: column; gap: 4px; }
.theme-preview-sidebar img { max-width: 100%; max-height: 34px; object-fit: contain; margin: 2px auto 8px; display: block; }
.theme-preview-nav { padding: 6px 8px; border-radius: 6px; color: var(--sidebar-muted, #b7c6cc); font-weight: 600; }
.theme-preview-nav.active { background: var(--app-primary); color: var(--app-primary-text, #fff); }
.theme-preview-label { padding: 8px 8px 2px; color: var(--sidebar-label, #72868d); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.theme-preview-content { background: #dce4e7; padding: 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; }
.theme-preview-appname { color: var(--sidebar-text, #fff); font-weight: 800; font-size: 11px; text-align: center; margin: -4px 0 6px; overflow-wrap: anywhere; }
.theme-preview-footer { margin-top: auto; color: #61777f; font-size: 10px; overflow-wrap: anywhere; }
.theme-preview-footer[hidden] { display: none; }
.theme-preview-link { color: var(--app-primary-ink, var(--app-primary)); font-weight: 700; }
.theme-preview-button { background: var(--app-primary); color: var(--app-primary-text, #fff); padding: 7px 12px; border-radius: 7px; font-weight: 700; }
.theme-preview-button--accent { background: var(--app-accent); color: var(--app-accent-text, #fff); }


/* ---- Header drop-downs (App switcher, Profile menu): the header colours ---- */
:is(.app-switcher-menu, .profile-menu) {
    background: var(--header-bg, #14262e);
    border-color: var(--header-control-border, #38515b);
}
.app-switcher-title { color: var(--header-label, #9eb1b8); }
.app-switcher-item,
.app-switcher-admin { color: var(--header-text, #e3edef); }
.app-switcher-home { color: var(--header-soft, #dfe9ec); }
.app-switcher-item small,
.app-switcher-admin small { color: var(--header-muted, #91a7ae); }
.app-switcher-item:hover,
.app-switcher-admin:hover,
.app-switcher-home:hover { background: var(--header-hover, #203e47); color: var(--header-text, #fff); }
.app-switcher-item.active { background: var(--header-selected, #203e47); }
.app-switcher-icon {
    background: var(--header-control, #1d353f);
    color: var(--header-primary-ink, var(--app-primary));
}
.app-switcher-admin-icon,
.app-switcher-home-icon { color: var(--header-accent-ink, var(--app-accent)) !important; }
:is(.app-switcher-divider, .profile-menu div) { background: var(--header-line, #344c54); }
.profile-menu a { color: var(--header-soft, #dce7ea); }
/* Hover stays the primary fill with its contrast text (rule near the top). */
.profile-menu a:hover { background: var(--app-primary); }

/* ---- Sidebar Colour Preview menu: the sidebar colours ---- */
.sidebar-theme-menu {
    background: var(--sidebar-bg, #14262e);
    border-color: var(--sidebar-control-border, #38515b);
}
.sidebar-theme-menu .theme-option { color: var(--sidebar-text, #e3edef); }
.sidebar-theme-menu .theme-option small { color: var(--sidebar-muted, #8ea5ad); }
.sidebar-theme-menu .theme-option:hover { background: var(--sidebar-hover, #1d353f); }
.sidebar-theme-menu .theme-option.active { background: var(--sidebar-selected, #203e47); }

/* ---- Program Settings: preview column (020-014) ----
   Settings on the left, preview on the right; the preview stays in view
   (below the sticky header) while the page scrolls. */
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; }
.settings-main { min-width: 0; }
.settings-preview-col { min-width: 0; border-left: 1px solid #e3eaec; padding-left: 28px; }
.settings-preview-sticky {
    position: sticky;
    top: calc(var(--topbar-height, 82px) + 20px);
    max-height: calc(100vh - var(--topbar-height, 82px) - 40px);
    max-height: calc(100dvh - var(--topbar-height, 82px) - 40px); /* 1.21.0: visible height on tablets/phones */
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 14px;
}
.settings-preview-head h3 { margin: 0 0 4px; font-size: 17px; color: #203740; }
.settings-preview-head small { display: block; line-height: 1.4; }
.theme-preview-signin { background: #dce4e7; border: 1px solid #dce6e8; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.theme-preview-signin-card {
    width: 180px; padding: 14px; border-radius: 10px; display: flex; flex-direction: column; gap: 7px; align-items: stretch;
    background: var(--sidebar-bg, #101c23); color: var(--sidebar-text, #fff); box-shadow: 0 6px 16px rgba(20, 40, 50, .15);
}
.theme-preview-signin-card img { max-width: 100%; max-height: 30px; object-fit: contain; align-self: center; }
.theme-preview-signin-card img[hidden], .theme-preview-sidebar img[hidden] { display: none; }
.theme-preview-signin-card strong { font-size: 13px; text-align: center; }
.theme-preview-input { height: 16px; border-radius: 4px; background: #fff; border: 1px solid #c9d7db; }
.theme-preview-signin-card .theme-preview-button { text-align: center; font-size: 11px; padding: 5px; }
@media (max-width: 1150px) {
    .settings-layout { grid-template-columns: 1fr; }
    .settings-preview-col { order: -1; border-left: 0; padding-left: 0; border-bottom: 1px solid #e3eaec; padding-bottom: 22px; }
    .settings-preview-sticky { position: static; max-height: none; overflow: visible; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
    .settings-preview-head { flex-basis: 100%; }
    .theme-preview { flex: 1 1 320px; }
}
