/* ==========================================================================
   MabrookTech Daylight Editorial / Apple Liquid Glass Theme Override
   for Smart Calculator Suite (index.html + dynamic JS modes)
   ========================================================================== */

:root {
    --mt-ink: #1D1D1F;
    --mt-ink-secondary: #515154;
    --mt-cobalt: #0F4C81;
    --mt-cobalt-bright: #0066CC;
    --mt-teal: #0F766E;
    --mt-glass: rgba(255, 255, 255, 0.84);
    --mt-glass-strong: rgba(255, 255, 255, 0.94);
    --mt-border: rgba(29, 29, 31, 0.09);
    --mt-border-strong: rgba(29, 29, 31, 0.15);
    --mt-shadow-glass:
        inset 0 1px 0 rgba(255, 255, 255, 0.96),
        0 18px 40px -22px rgba(15, 23, 42, 0.14),
        0 2px 8px rgba(15, 23, 42, 0.04);
}

/* Base typography alignment (active in both light & dark modes) */
body {
    font-family: 'Inter Tight', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4,
.logo h1,
#mode-name {
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
}

/* --------------------------------------------------------------------------
   Light Theme (MabrookTech Daylight Editorial Default)
   -------------------------------------------------------------------------- */
body.light-theme {
    --bg-color: #F5F5F7;
    --sidebar-bg: rgba(255, 255, 255, 0.84);
    --card-bg: rgba(255, 255, 255, 0.84);
    --accent-color: #0F4C81;
    --accent-gradient: linear-gradient(135deg, #0F4C81 0%, #0F766E 100%);
    --text-primary: #1D1D1F;
    --text-secondary: #515154;
    --border-color: rgba(29, 29, 31, 0.09);
    --glass-blur: blur(22px) saturate(180%);
    --glass-border: 1px solid rgba(29, 29, 31, 0.09);

    color-scheme: light;
    color: #1D1D1F;
    background:
        radial-gradient(64% 58% at 10% 12%, rgba(15, 76, 129, 0.11), transparent 62%),
        radial-gradient(56% 52% at 90% 18%, rgba(15, 118, 110, 0.10), transparent 58%),
        radial-gradient(52% 48% at 58% 88%, rgba(125, 211, 252, 0.18), transparent 60%),
        #F5F5F7;
    background-attachment: fixed;
}

/* Sidebar */
body.light-theme .sidebar {
    background: var(--mt-glass);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    backdrop-filter: blur(22px) saturate(180%);
    border-right: 1px solid var(--mt-border);
    box-shadow: 4px 0 28px -18px rgba(15, 23, 42, 0.10);
}

body.light-theme .logo {
    margin-bottom: 1.5rem;
}

body.light-theme .logo h1 {
    background: linear-gradient(135deg, #0F4C81 0%, #0F766E 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-theme .nav-links li {
    color: #515154;
    font-weight: 500;
}

body.light-theme .nav-links li:hover {
    color: #1D1D1F;
    background: rgba(15, 76, 129, 0.06);
}

body.light-theme .nav-links li.active {
    color: #0F4C81;
    font-weight: 600;
    background: linear-gradient(90deg, rgba(15, 76, 129, 0.12), rgba(15, 118, 110, 0.06));
    border-left-color: #0F4C81;
}

body.light-theme .sidebar-footer button {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--mt-border);
    color: #1D1D1F;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

body.light-theme .sidebar-footer button:hover {
    background: #FFFFFF;
    border-color: rgba(15, 76, 129, 0.24);
    box-shadow: 0 6px 14px rgba(15, 76, 129, 0.12);
}

/* Header & Clock */
body.light-theme #mode-name {
    color: #1D1D1F;
}

body.light-theme #clock {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    background: var(--mt-glass);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid var(--mt-border);
    color: #515154;
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

/* Main Calculator Glass Panel */
body.light-theme .glass-panel {
    background: var(--mt-glass);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    backdrop-filter: blur(22px) saturate(180%);
    border: 1px solid rgba(29, 29, 31, 0.09);
    box-shadow: var(--mt-shadow-glass);
}

body.light-theme #calc-display {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(245, 245, 247, 0.45));
    border-bottom: 1px solid var(--mt-border);
    border-radius: 24px 24px 0 0;
}

body.light-theme .previous-calc {
    color: #515154;
}

body.light-theme .current-input {
    color: #1D1D1F;
    font-family: 'Outfit', 'Inter Tight', sans-serif;
    font-variant-numeric: tabular-nums;
}

/* Crisp Keypad Buttons */
body.light-theme .calc-btn {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(29, 29, 31, 0.09);
    color: #1D1D1F;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 3px 10px -4px rgba(15, 23, 42, 0.10);
}

body.light-theme .calc-btn:hover {
    background: #FFFFFF;
    border-color: rgba(15, 76, 129, 0.24);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 8px 18px -6px rgba(15, 76, 129, 0.16);
}

body.light-theme .calc-btn.operator {
    background: rgba(15, 76, 129, 0.09);
    border-color: rgba(15, 76, 129, 0.14);
    color: #0F4C81;
    font-weight: 600;
}

body.light-theme .calc-btn.operator:hover {
    background: rgba(15, 76, 129, 0.16);
    border-color: rgba(15, 76, 129, 0.28);
}

body.light-theme .calc-btn.clear {
    background: rgba(180, 35, 24, 0.08);
    border-color: rgba(180, 35, 24, 0.16);
    color: #B42318;
    font-weight: 600;
}

body.light-theme .calc-btn.clear:hover {
    background: rgba(180, 35, 24, 0.14);
    border-color: rgba(180, 35, 24, 0.28);
}

body.light-theme .calc-btn.equals {
    background: linear-gradient(135deg, #0F4C81 0%, #0F766E 100%);
    border: 1px solid rgba(15, 76, 129, 0.25);
    color: #FFFFFF;
    box-shadow: 0 8px 20px -6px rgba(15, 76, 129, 0.45);
}

body.light-theme .calc-btn.equals:hover {
    filter: brightness(1.06);
    box-shadow: 0 12px 26px -6px rgba(15, 118, 110, 0.45);
}

/* Inputs, Selects & Sub-mode Controls (Graphing, Unit, Currency, Finance, Health, Programming) */
body.light-theme .glass-input,
body.light-theme .glass-select {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(29, 29, 31, 0.14);
    color: #1D1D1F;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

body.light-theme .glass-input::placeholder {
    color: #6E6E73;
}

body.light-theme .glass-input:focus,
body.light-theme .glass-select:focus {
    outline: none;
    background: #FFFFFF;
    border-color: #0F4C81;
    box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.14);
}

body.light-theme .glass-select option {
    background: #FFFFFF;
    color: #1D1D1F;
}

body.light-theme #plot-btn {
    background: linear-gradient(135deg, #0F4C81 0%, #0F766E 100%);
    color: #FFFFFF;
    box-shadow: 0 6px 16px -4px rgba(15, 76, 129, 0.35);
}

body.light-theme .graph-canvas-container {
    background: rgba(255, 255, 255, 0.90);
    border: 1px solid var(--mt-border);
}

body.light-theme .currency-flag-box {
    background: #F5F5F7;
    border: 1px solid var(--mt-border);
}

body.light-theme .currency-swap {
    color: #0F4C81;
}

body.light-theme .pill-btn,
body.light-theme .small-pill {
    background: rgba(255, 255, 255, 0.90);
    border: 1px solid var(--mt-border);
    color: #515154;
}

body.light-theme .pill-btn:hover,
body.light-theme .small-pill:hover {
    background: #0F4C81;
    border-color: #0F4C81;
    color: #FFFFFF;
}

body.light-theme .small-pill.active {
    background: #0F4C81;
    border-color: #0F4C81;
    color: #FFFFFF;
}

body.light-theme .finance-tabs {
    background: rgba(29, 29, 31, 0.05);
    border: 1px solid var(--mt-border);
}

body.light-theme .tab-btn {
    color: #515154;
}

body.light-theme .tab-btn:hover {
    color: #1D1D1F;
}

body.light-theme .tab-btn.active {
    background: linear-gradient(135deg, #0F4C81 0%, #0F766E 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(15, 76, 129, 0.25);
}

body.light-theme .glass-panel-inner {
    background: rgba(255, 255, 255, 0.72) !important;
    border: 1px solid var(--mt-border);
}

body.light-theme .finance-input-group label {
    color: #515154;
    font-weight: 500;
}

body.light-theme .finance-result-card {
    background: linear-gradient(135deg, rgba(15, 76, 129, 0.07), rgba(15, 118, 110, 0.07));
    border: 1px solid rgba(15, 76, 129, 0.18);
    color: #1D1D1F;
}

body.light-theme .result-val {
    color: #0F4C81;
}

/* Programming Mode Overrides (overrides inline dark backgrounds from JS template) */
body.light-theme .prog-bases {
    background: rgba(245, 245, 247, 0.92) !important;
    border: 1px solid rgba(29, 29, 31, 0.10) !important;
}

body.light-theme .base-row {
    color: #515154;
}

body.light-theme .base-row span {
    color: #1D1D1F;
}

body.light-theme .base-row.active {
    background: rgba(15, 76, 129, 0.11);
    color: #0F4C81;
    border-left-color: #0F4C81;
}

body.light-theme .base-row.active span {
    color: #0F4C81;
}

body.light-theme #bit-length {
    background: rgba(15, 76, 129, 0.10) !important;
    color: #0F4C81 !important;
    border: 1px solid rgba(15, 76, 129, 0.18) !important;
}

/* History Slide-over Panel */
body.light-theme .history-panel {
    background: rgba(255, 255, 255, 0.90);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    backdrop-filter: blur(22px) saturate(180%);
    border-left: 1px solid var(--mt-border);
    box-shadow: -12px 0 36px -18px rgba(15, 23, 42, 0.18);
}

body.light-theme .history-header h3 {
    color: #1D1D1F;
}

body.light-theme .history-header button {
    color: #0F4C81;
}

body.light-theme .history-item {
    background: rgba(245, 245, 247, 0.85);
    border: 1px solid var(--mt-border);
}

body.light-theme .history-res {
    color: #0F4C81;
}

body.light-theme .empty-msg {
    color: #515154;
}

/* SEO & Informational Cards */
body.light-theme .app-info-section {
    background: var(--mt-glass);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    backdrop-filter: blur(22px) saturate(180%);
    border: 1px solid var(--mt-border);
    box-shadow: var(--mt-shadow-glass);
}

body.light-theme .info-card {
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid var(--mt-border);
    box-shadow: 0 6px 18px -10px rgba(15, 23, 42, 0.08);
}

body.light-theme .info-card:hover {
    background: #FFFFFF;
    border-color: rgba(15, 118, 110, 0.35);
    box-shadow: 0 14px 28px -14px rgba(15, 76, 129, 0.16);
}

body.light-theme .info-card h3 {
    color: #0F4C81;
}

body.light-theme .info-card p,
body.light-theme .info-list {
    color: #515154;
}

body.light-theme .info-card code {
    background: rgba(15, 76, 129, 0.08);
    color: #0F4C81;
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
}

body.light-theme .seo-footer {
    border-top: 1px solid var(--mt-border);
}

body.light-theme .seo-footer h4 {
    color: #1D1D1F;
}

body.light-theme .seo-footer p {
    color: #515154;
}

/* Light Scrollbar */
body.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(29, 29, 31, 0.16);
}

body.light-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(29, 29, 31, 0.30);
}

/* --------------------------------------------------------------------------
   Synchronized Cross-Tool & Main-Site Navigation (Light + Dark Compatible)
   -------------------------------------------------------------------------- */
.sidebar-top-nav {
    padding: 0 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.sidebar-back-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 0.78rem;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

body.light-theme .sidebar-back-pill {
    background: rgba(15, 76, 129, 0.08);
    border: 1px solid rgba(15, 76, 129, 0.16);
    color: #0F4C81;
}

body.light-theme .sidebar-back-pill:hover {
    background: #0F4C81;
    border-color: #0F4C81;
    color: #FFFFFF;
}

body:not(.light-theme) .sidebar-back-pill {
    background: rgba(88, 166, 255, 0.12);
    border: 1px solid rgba(147, 197, 253, 0.22);
    color: #93c5fd;
}

body:not(.light-theme) .sidebar-back-pill:hover {
    background: rgba(88, 166, 255, 0.24);
    color: #ffffff;
}

.sidebar-back-pill.secondary {
    font-weight: 500;
}

body.light-theme .sidebar-back-pill.secondary {
    background: rgba(15, 118, 110, 0.07);
    border-color: rgba(15, 118, 110, 0.16);
    color: #0F766E;
}

body.light-theme .sidebar-back-pill.secondary:hover {
    background: #0F766E;
    border-color: #0F766E;
    color: #FFFFFF;
}

.sidebar-ecosystem {
    margin: 1rem 1.25rem 0.5rem;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

body.light-theme .sidebar-ecosystem {
    border-top-color: var(--mt-border);
}

.sidebar-eco-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 0.45rem 0.25rem;
    color: var(--text-secondary);
}

.sidebar-eco-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

body.light-theme .sidebar-eco-link:hover {
    background: rgba(15, 76, 129, 0.07);
    color: #0F4C81;
}

body:not(.light-theme) .sidebar-eco-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f0f6fc;
}

/* Main Header Synchronized Cross-Tool Bar */
.content header.main-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.9rem;
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.ecosystem-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    padding: 0.35rem;
    border-radius: 9999px;
    width: fit-content;
    max-width: 100%;
}

body.light-theme .ecosystem-bar {
    background: rgba(255, 255, 255, 0.78);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    backdrop-filter: blur(22px) saturate(180%);
    border: 1px solid var(--mt-border);
    box-shadow: 0 4px 16px -8px rgba(15, 23, 42, 0.10);
}

body:not(.light-theme) .ecosystem-bar {
    background: rgba(22, 27, 34, 0.72);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.eco-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.38rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

body.light-theme .eco-pill {
    color: #515154;
}

body.light-theme .eco-pill:hover {
    background: rgba(15, 76, 129, 0.08);
    color: #0F4C81;
}

body.light-theme .eco-pill.active {
    background: linear-gradient(135deg, #0F4C81 0%, #0F766E 100%);
    color: #FFFFFF;
    font-weight: 600;
    box-shadow: 0 4px 12px -2px rgba(15, 76, 129, 0.32);
}

body.light-theme .eco-pill.cta {
    background: rgba(15, 118, 110, 0.10);
    color: #0F766E;
    font-weight: 600;
}

body.light-theme .eco-pill.cta:hover {
    background: #0F766E;
    color: #FFFFFF;
}

body:not(.light-theme) .eco-pill {
    color: #8b949e;
}

body:not(.light-theme) .eco-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f0f6fc;
}

body:not(.light-theme) .eco-pill.active {
    background: linear-gradient(135deg, #58a6ff, #bc85ff);
    color: #ffffff;
    font-weight: 600;
}

body:not(.light-theme) .eco-pill.cta {
    background: rgba(88, 166, 255, 0.14);
    color: #58a6ff;
    font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .sidebar-top-nav,
    .sidebar-ecosystem {
        display: none;
    }
}

@media (max-width: 768px) {
    body.light-theme .sidebar {
        background: rgba(255, 255, 255, 0.90);
        -webkit-backdrop-filter: blur(22px) saturate(180%);
        backdrop-filter: blur(22px) saturate(180%);
        border-right: none;
        border-top: 1px solid var(--mt-border);
        box-shadow: 0 -8px 24px -10px rgba(15, 23, 42, 0.12);
    }

    .ecosystem-bar {
        border-radius: 16px;
        width: 100%;
    }
}
