/*
Theme Name: NexaCalculator Theme
Theme URI: https://nexacalculator.com/
Author: Custom Themes
Description: Professional 2-Column Layout with stacked Calculator UI, Full-Width App-Style Utilities, and metric boxes.
Version: 9.8
License: GNU General Public License v2 or later
Tags: custom-layout, calculator, responsive, ad-optimized
Text Domain: nexacalculator
*/

/* --- THEME SYSTEM (Professional Light Mode) --- */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --gradient-start: #3b82f6;
    --gradient-end: #1d4ed8;
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-summary: #f1f5f9;
    --text-main: #0f172a;
    --text-sub: #64748b;
    --border: #e2e8f0;
    --ring: rgba(37, 99, 235, 0.2);
    --danger: #dc2626; 
    --success: #10b981;
    
    --container-max: 1280px;
    --sidebar-width: 300px;

    /* Pagefind search UI variables — merged here to avoid duplicate :root */
    --pagefind-ui-scale: 1;
    --pagefind-ui-primary: #2563eb;
    --pagefind-ui-text: #0f172a;
    --pagefind-ui-background: #ffffff;
    --pagefind-ui-border: #e2e8f0;
    --pagefind-ui-tag: #f1f5f9;
    --pagefind-ui-font: 'Inter', sans-serif;
}

/* --- BASE STYLES --- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; }
html { width: 100%; }
body { width: 100%; overflow-x: clip; font-family: 'Inter', sans-serif; background-color: var(--bg-body); color: var(--text-main); line-height: 1.6; font-size: 16px; display: flex; flex-direction: column; min-height: 100vh; }
a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; }
html[dir="rtl"] { direction: rtl; }
html[dir="rtl"] .chevron-down { margin-right: 5px; margin-left: 0; }
html[dir="rtl"] .input-icon { left: auto; right: 14px; }
.input-field { padding: 12px 14px 12px 34px; }

/* --- THE MASTER CONTAINER --- */
.container { max-width: var(--container-max); margin: 0 auto; padding: 0 24px; width: 100%; }
.container-wide { max-width: var(--container-max); margin: 0 auto; padding: 0 24px; }

/* --- HEADER --- */
header { position: fixed; width: 100%; background: var(--bg-surface); border-bottom: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,0.05); top: 0; z-index: 1000; }
.header-main { height: 72px; display: flex; align-items: center; border-bottom: 1px solid var(--border); }
.header-flex { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 40px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: var(--text-main); letter-spacing: -0.02em;}
.brand svg { height: 28px; width: 28px; color: var(--primary); }

.search-container { flex: 1; max-width: 500px; position: relative; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-sub); width: 18px; height: 18px; pointer-events: none;}
html[dir="rtl"] .search-icon { left: auto; right: 14px; }
.search-input { width: 100%; padding: 10px 16px 10px 42px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-body); font-size: 0.9375rem; color: var(--text-main); }
html[dir="rtl"] .search-input { padding: 10px 42px 10px 16px; }
.search-input:focus { outline: none; background: var(--bg-surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

.nav-actions { display: flex; gap: 16px; align-items: center; }
.btn-primary { background: var(--primary); color: #ffffff; height: 42px; padding: 0 20px; border-radius: 6px; font-weight: 600; display: flex; align-items: center; justify-content: center; border: none; cursor: pointer; transition: 0.2s; white-space: nowrap;}
.btn-primary:hover { background: var(--primary-hover); }

/* --- HEADER SUB-NAVIGATION --- */
.header-sub { background: var(--bg-surface); height: 48px; display: flex; align-items: center; overflow-x: auto; scrollbar-width: none; }
.header-sub::-webkit-scrollbar { display: none; }
.cat-list { display: flex; gap: 32px; height: 100%; align-items: center; white-space: nowrap; }
.cat-item { font-size: 0.875rem; font-weight: 500; color: var(--text-sub); height: 100%; display: flex; align-items: center; border-bottom: 2px solid transparent; transition: 0.2s; }
.cat-item:hover, .cat-item.active { color: var(--primary); border-bottom-color: var(--primary); }

/* --- MOBILE SIDEBAR MENU STYLES --- */
.mobile-menu-btn { display: none; background: transparent; border: none; color: var(--text-main); cursor: pointer; padding: 4px; align-items: center; justify-content: center; }
.mobile-menu-btn svg { width: 28px; height: 28px; }

.mobile-sidebar { position: fixed; top: 0; right: -320px; left: auto; width: 280px; height: 100vh; background: var(--bg-surface); z-index: 2000; box-shadow: -4px 0 25px rgba(0,0,0,0.1); transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; }
.mobile-sidebar.active { right: 0; }
.mobile-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.5); z-index: 1999; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.mobile-overlay.active { opacity: 1; pointer-events: auto; }

.mobile-sidebar-header { height: 72px; display: flex; justify-content: space-between; align-items: center; padding: 0 24px; border-bottom: 1px solid var(--border); }
.mobile-sidebar-content { padding: 24px; overflow-y: auto; }
.mobile-nav-btn { display: block; background: var(--primary); color: white; text-align: center; padding: 12px; border-radius: 8px; font-weight: 700; margin-bottom: 32px; }
.mobile-nav-title { font-size: 0.85rem; text-transform: uppercase; color: var(--text-sub); font-weight: 700; margin-bottom: 16px; letter-spacing: 0.05em; }
.mobile-cat-links a { display: block; padding: 12px 0; color: var(--text-main); font-weight: 500; border-bottom: 1px solid var(--border); }
.mobile-cat-links a:last-child { border-bottom: none; }

/* --- MAIN CONTENT & TYPOGRAPHY --- */
.main-wrapper { padding-top: 120px; padding-bottom: 64px; flex: 1; }
.breadcrumbs-section { margin-bottom: 12px; font-size: 0.85rem; color: var(--text-sub); }
.breadcrumbs-section a { color: var(--text-sub); }
.breadcrumbs-section a:hover { color: var(--primary); }

.nexa-2col-layout { display: flex; gap: 40px; align-items: flex-start; margin-top: 32px; }
.nexa-main-col { flex: 1; min-width: 300px; }
.nexa-sidebar-col { width: var(--sidebar-width); flex-shrink: 0; position: sticky; top: 140px; display: flex; flex-direction: column; gap: 24px; align-self: flex-start; }

.gutenberg-content p { margin-bottom: 24px; color: var(--text-main); line-height: 1.7; }
.gutenberg-content h2, .gutenberg-content h3 { margin-top: 40px; margin-bottom: 16px; color: var(--text-main); }
.gutenberg-content ul { margin-bottom: 24px; padding-left: 20px; list-style: disc; }
.gutenberg-content a { color: var(--primary); text-decoration: none; font-weight: 500; border-bottom: 1px solid transparent; transition: border-color 0.2s ease, color 0.2s ease; }
.gutenberg-content a:hover { color: var(--primary-hover); border-bottom-color: var(--primary-hover); }

/* =======================================================================
   THE CALCULATOR UI (BASE FRAMEWORK)
   ======================================================================= */
/* overflow:clip instead of overflow:hidden — prevents ad units placed adjacent to
   the calculator from being clipped by the parent, which kills ad viewability scores. */
.calc-interface { display: flex; flex-direction: column; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; overflow: clip; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03); }

.input-panel { padding: 32px 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
@media (min-width: 768px) {
    .strict-2col { grid-template-columns: repeat(2, 1fr) !important; }
}
.input-group { margin-bottom: 0; }
.input-group.full-span { grid-column: 1 / -1; }

.input-label { display: block; font-size: 0.9rem; font-weight: 600; color: var(--text-main); margin-bottom: 8px; }

/* Standard Inputs */
.input-field-wrap { position: relative; display: flex; align-items: center; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-surface); transition: 0.2s; padding-left: 12px; }
.input-field-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.input-icon { color: var(--text-sub); font-weight: 500; margin-right: 8px; pointer-events: none; }
.input-field { width: 100%; flex: 1; padding: 12px 0; border: none; background: transparent; font-family: inherit; font-size: 1rem; color: var(--text-main); }
.input-field:focus { outline: none; }
select.input-field { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }

/* =======================================================================
   PREMIUM INLINE ADDON UI (Compound & Mixed Inputs)
   ======================================================================= */
.inline-addon-wrap { padding-right: 0 !important; display: flex; align-items: center; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 6px; transition: 0.2s; overflow: hidden; width: 100%; }
.inline-addon-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.inline-input { padding-left: 16px !important; flex: 1 !important; background: transparent !important; border: none !important; box-shadow: none !important; outline: none !important; min-width: 0; }
.inline-select { flex: none !important; width: 80px !important; border: none !important; background-color: transparent !important; padding-left: 8px !important; padding-right: 28px !important; font-weight: 700 !important; color: var(--primary) !important; margin: 0 !important; height: auto; text-align: right !important; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%232563eb'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") !important; background-position: right 10px center !important; background-repeat: no-repeat !important; background-size: 14px !important; }
.inline-select:focus { outline: none; box-shadow: none !important; }
.inline-text { flex: none !important; border: none !important; background-color: transparent !important; padding: 0 16px !important; font-weight: 700 !important; color: var(--text-sub) !important; display: flex; align-items: center; justify-content: center; height: 100%; }

/* Compound Divider & OR Toggle UI */
.compound-divider { width: 1px; height: 24px; background-color: var(--border); flex-shrink: 0; margin: 0 4px; }
.input-header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.input-header-flex .input-label { margin-bottom: 0 !important; }
.or-toggle-pill { display: flex; background: var(--bg-summary); border-radius: 6px; padding: 2px; }
.or-btn { padding: 4px 10px; font-size: 0.75rem; font-weight: 600; color: var(--text-sub); background: transparent; border: none; border-radius: 4px; cursor: pointer; transition: 0.2s; }
.or-btn.active { background: var(--bg-surface); color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.or-group { display: none; width: 100%; }
.or-group.active { display: block; }

/* =======================================================================
   CALCULATE CTA BAR
   Rendered by [nexa_calculator show_cta="true"] — sits between the
   input panel and the result container. Primary action is always
   btn-calculate; btn-reset is optional via show_reset="true".
   ======================================================================= */
.calc-cta-bar {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-calculate {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: #ffffff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    letter-spacing: 0.01em;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
/* Subtle shimmer sweep on hover */
.btn-calculate::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.18) 50%, transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.4s ease;
}
.btn-calculate:hover::after  { transform: translateX(100%); }
.btn-calculate:hover         { opacity: 0.93; box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45); transform: translateY(-1px); }
.btn-calculate:active        { transform: translateY(0); box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3); }
.btn-calculate:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

/* Loading state — add class="is-loading" via JS if calculation is async */
.btn-calculate.is-loading { pointer-events: none; opacity: 0.75; }
.btn-calculate.is-loading span { visibility: hidden; }
.btn-calculate.is-loading::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: nexa-spin 0.6s linear infinite;
}
@keyframes nexa-spin { to { transform: rotate(360deg); } }

.btn-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: transparent;
    color: var(--text-sub);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-reset:hover         { color: var(--text-main); border-color: var(--text-sub); background: var(--bg-body); }
.btn-reset:active        { background: var(--bg-summary); }
.btn-reset:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

@media (max-width: 600px) {
    .calc-cta-bar   { padding: 0 16px 20px; gap: 10px; }
    .btn-calculate  { padding: 13px 20px; font-size: 0.95rem; }
    .btn-reset      { padding: 13px 14px; }
    .btn-reset span { display: none; }  /* icon-only on very small screens */
    .btn-reset svg  { margin: 0; }
}

/* Hide CTA bar in print — it's an interactive element */
@media print { .calc-cta-bar { display: none !important; } }

/* =======================================================================
   PREMIUM RESULTS UI STYLING
   ======================================================================= */
.nexa-result-container { background: var(--bg-surface); border-top: 1px solid var(--border); padding: 40px 32px; }

/* =======================================================================
   RESULT PANEL STATE MACHINE
   .calc-interface starts without has-results.
   Calculator script adds has-results after first calculation.
   core.js then handles animation, count-up, and mobile scroll.
   ======================================================================= */

/* Empty state — shown before any calculation */
.calc-interface:not(.has-results) .nexa-result-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 32px 24px;
}

/* Hide all actual result content until calculated */
.calc-interface:not(.has-results) .nexa-result-container .main-result-hero,
.calc-interface:not(.has-results) .nexa-result-container .breakdown-grid,
.calc-interface:not(.has-results) .nexa-result-container .nexa-insight,
.calc-interface:not(.has-results) .nexa-result-container .nexa-chart-container,
.calc-interface:not(.has-results) .nexa-result-container .nexa-scale-bar {
    display: none !important;
}

/* Empty state placeholder — add this element inside .nexa-result-container:
   <div class="nexa-empty-state">Enter your values above to see results</div>
   It shows before calculation and hides after. */
.nexa-empty-state {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--text-sub);
    font-weight: 500;
}
.nexa-empty-state svg {
    flex-shrink: 0;
    opacity: 0.4;
}
.calc-interface.has-results .nexa-empty-state {
    display: none;
}

/* Entry animation — fires once when results-entered class is added by core.js */
.nexa-result-container {
    opacity: 1;
    transform: translateY(0);
}
.nexa-result-container.results-entered {
    animation: nexa-results-enter 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes nexa-results-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Count-up targets — prevent layout shift while animating */
.count-up {
    display: inline-block;
    min-width: 2ch;
    font-variant-numeric: tabular-nums;
}

/* Hero Result */
.main-result-hero { text-align: center; margin-bottom: 40px; padding-bottom: 32px; border-bottom: 1px dashed var(--border); }
.main-result-hero .result-box-label { font-size: 0.95rem; font-weight: 700; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 8px; }
.main-result-hero .result-box-value { font-size: 3.5rem; font-weight: 800; color: var(--primary); line-height: 1.1; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; word-break: break-word; }
.main-result-hero .currency-code { font-size: 1.5rem; font-weight: 700; color: var(--primary); opacity: 0.8; margin-top: 8px; }

/* Result Grid Systems */
.breakdown-grid { display: grid; gap: 16px; width: 100%; }
.grid-2-col { grid-template-columns: repeat(2, 1fr); }
.grid-3-col { grid-template-columns: repeat(3, 1fr); }

.breakdown-item { background: var(--bg-body); border: 1px solid var(--border); border-radius: 12px; padding: 24px 20px; display: flex; flex-direction: column; transition: 0.2s; min-width: 0; }
.breakdown-item:hover { border-color: var(--primary); background: var(--bg-surface); box-shadow: 0 4px 12px rgba(0,0,0,0.03); transform: translateY(-2px); }
.breakdown-label { font-size: 0.85rem; font-weight: 700; color: var(--text-sub); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 0.03em; }
.breakdown-label svg { width: 18px; height: 18px; color: var(--primary); flex-shrink: 0; }
.breakdown-value { font-size: 1.75rem; font-weight: 800; color: var(--text-main); line-height: 1.2; word-wrap: break-word; overflow-wrap: break-word; word-break: break-word; hyphens: auto; }
.breakdown-value .currency-symbol { font-size: 1.1rem; color: var(--text-sub); margin-left: 6px; font-weight: 600; }

@media (max-width: 850px) { .grid-3-col { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
    .nexa-result-container { padding: 32px 20px; }
    .main-result-hero .result-box-value { font-size: 2.5rem; }
    .main-result-hero .currency-code { font-size: 1.25rem; }
    .grid-2-col, .grid-3-col { grid-template-columns: 1fr; } 
}

/* =======================================================================
   UTILITY ACTION BAR
   ======================================================================= */
.calc-action-bar { padding: 16px; background: var(--bg-summary); border-top: 1px solid var(--border); display: block; }
.calculator-utilities { display: flex; gap: 10px; flex-wrap: wrap; width: 100%; }
.btn-utility { flex: 1 1 150px; background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-sub); padding: 12px 14px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.85rem; font-weight: 600; transition: 0.2s; white-space: nowrap; position: relative; }
.util-text { display: inline-block; }
.btn-utility svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-utility:hover { border-color: var(--primary); color: var(--primary); box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1); }

/* =======================================================================
   CHART CONTAINER
   Standard wrapper for Chart.js canvases. Handles responsive sizing and
   spacing consistently across all calculators. Usage:
     <div class="nexa-chart-container">
       <canvas id="my-chart"></canvas>
     </div>
   Optional modifier: nexa-chart-container--tall (taller aspect ratio)
   Optional modifier: nexa-chart-container--square (1:1 for donut/pie)
   ======================================================================= */
.nexa-chart-container {
    width: 100%;
    margin: 32px 0 0;
    padding: 24px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 12px;
    position: relative;
}
.nexa-chart-container canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 320px;
    display: block;
}
.nexa-chart-container--tall canvas  { max-height: 420px; }
.nexa-chart-container--square canvas { max-height: 280px; }

/* Chart title — optional <p class="nexa-chart-title"> above canvas */
.nexa-chart-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 16px;
}

/* =======================================================================
   INSIGHT / CONTEXTUAL RESULT BLOCKS
   Per-calculator scripts set the class variant and text content.
   Core theme provides the visual language — calculator owns the logic.

   Usage in calculator script:
     const el = document.getElementById('my-insight');
     el.className = 'nexa-insight is-positive';
     el.innerHTML = '<strong>Healthy range.</strong> Your result is within...';
     el.style.display = '';   // or remove display:none from HTML

   Variants: is-positive (green), is-warning (amber),
             is-negative (red), is-neutral (grey/blue)
   ======================================================================= */
.nexa-insight {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 10px;
    border-left: 4px solid;
    margin: 24px 0 0;
    font-size: 0.95rem;
    line-height: 1.6;
    font-weight: 500;
}
.nexa-insight strong { font-weight: 700; display: block; margin-bottom: 2px; }
.nexa-insight svg { flex-shrink: 0; margin-top: 1px; }

.nexa-insight.is-positive {
    background: #f0fdf4;
    border-color: #22c55e;
    color: #166534;
}
.nexa-insight.is-positive svg { color: #22c55e; }

.nexa-insight.is-warning {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}
.nexa-insight.is-warning svg { color: #f59e0b; }

.nexa-insight.is-negative {
    background: #fef2f2;
    border-color: #ef4444;
    color: #991b1b;
}
.nexa-insight.is-negative svg { color: #ef4444; }

.nexa-insight.is-neutral {
    background: #eff6ff;
    border-color: var(--primary);
    color: #1e40af;
}
.nexa-insight.is-neutral svg { color: var(--primary); }

/* =======================================================================
   SCALE / GAUGE BAR
   A horizontal range bar with a labeled marker showing where the user's
   result falls. Pure CSS positioning — JS moves the marker via left: X%.

   Minimal HTML structure:
     <div class="nexa-scale-bar">
       <div class="nexa-scale-fill" style="width:60%"></div>
       <div class="nexa-scale-marker" id="my-marker">
         <span class="nexa-scale-marker-label">24.1</span>
       </div>
       <div class="nexa-scale-labels">
         <span>Underweight</span><span>Normal</span>
         <span>Overweight</span><span>Obese</span>
       </div>
     </div>

   JS helper in core.js:
     window.nexaSetScaleMarker(value, min, max, 'my-marker');

   For multi-zone bars, add children with class nexa-scale-zone and
   use the modifier classes: zone-green, zone-amber, zone-red, zone-blue
   ======================================================================= */
.nexa-scale-bar {
    position: relative;
    margin: 28px 0 0;
    padding-bottom: 28px; /* room for labels */
}
.nexa-scale-track {
    height: 10px;
    border-radius: 99px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    position: relative;
    overflow: visible;
    display: flex;
}
/* Multi-zone variant — fill the track with colored zones */
.nexa-scale-zone {
    flex: 1;
    height: 100%;
}
.nexa-scale-zone:first-child { border-radius: 99px 0 0 99px; }
.nexa-scale-zone:last-child  { border-radius: 0 99px 99px 0; }
.nexa-scale-zone.zone-green  { background: #bbf7d0; }
.nexa-scale-zone.zone-amber  { background: #fde68a; }
.nexa-scale-zone.zone-red    { background: #fecaca; }
.nexa-scale-zone.zone-blue   { background: #bfdbfe; }

/* Simple single-fill variant */
.nexa-scale-fill {
    height: 10px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* The position marker — moved by nexaSetScaleMarker() via left: % */
.nexa-scale-marker {
    position: absolute;
    top: -5px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: left 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 2;
}
.nexa-scale-marker-pin {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}
.nexa-scale-marker-label {
    position: absolute;
    top: -28px;
    background: var(--text-main);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
}
.nexa-scale-marker-label::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--text-main);
}

/* Scale zone labels below the bar */
.nexa-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-sub);
    font-weight: 600;
}

/* --- SIDEBAR WIDGETS --- */
.sidebar-widget { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.02); }
/* h2 used for correct heading order (page has h1, sidebar headings must be h2).
   Visual size is controlled here — semantically correct, visually compact. */
.sidebar-widget h2.sidebar-widget-title { color: var(--text-main); margin: 0 0 16px; font-size: 1.05rem; border-bottom: 1px solid var(--border); padding-bottom: 12px; font-weight: 700; }
/* Keep legacy h4 rule in case any third-party widgets output h4 */
.sidebar-widget h4 { color: var(--text-main); margin-bottom: 16px; font-size: 1.05rem; border-bottom: 1px solid var(--border); padding-bottom: 12px; font-weight: 700; }
.sidebar-link-list li { margin-bottom: 12px; }
.sidebar-link-list a { color: var(--text-sub); font-size: 0.95rem; font-weight: 500; }
.sidebar-link-list a:hover { color: var(--primary); }

/* --- HOME PAGE & HERO --- */
.hero-section { text-align: center; padding: 80px 20px 60px; max-width: 800px; margin: 0 auto; }
.hero-section h1 { font-size: 3rem; font-weight: 800; letter-spacing: -0.03em; color: var(--text-main); margin-bottom: 16px; line-height: 1.1; }
.hero-section p { font-size: 1.15rem; color: var(--text-sub); line-height: 1.6; margin-bottom: 40px; }
.hero-search-form { position: relative; }
.hero-search-input { width: 100%; padding: 16px 20px 16px 52px; font-size: 1.05rem; border: 1px solid var(--border); border-radius: 50px; background: var(--bg-surface); color: var(--text-main); transition: 0.2s; box-shadow: 0 4px 12px rgba(0,0,0,0.03);}
.hero-search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.hero-search-form .search-icon { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--text-sub); pointer-events: none; }

/* 検 NEW SLEEK CATEGORY GRID & CARDS (CWV Optimized) 検 */
.home-category-grid, .compact-grid { 
    display: grid !important; 
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important; 
    gap: 20px !important; 
    width: 100% !important;
    padding-bottom: 60px; 
}

/* Home Cards (Centered) */
.cat-card { 
    background: var(--bg-surface); 
    border: 1px solid var(--border); 
    border-radius: 10px; 
    padding: 20px; 
    text-align: center; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 12px; 
    height: 100%; 
    width: 100% !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; 
    box-shadow: 0 1px 4px rgba(0,0,0,0.03); 
}
.cat-card:hover { 
    transform: translateY(-3px); 
    border-color: var(--primary); 
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.08); 
}

/* Category Archive Cards (Left-Aligned, Premium Look) */
.compact-card { 
    background: var(--bg-surface); 
    border: 1px solid var(--border); 
    border-radius: 10px; 
    padding: 20px; 
    text-align: left; 
    display: flex; 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 12px; 
    height: 100%; 
    width: 100% !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; 
    box-shadow: 0 1px 4px rgba(0,0,0,0.03); 
}
.compact-card:hover { 
    transform: translateY(-3px); 
    border-color: var(--primary); 
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.08); 
}

.cat-card-icon { 
    width: 40px; 
    height: 40px; 
    background: var(--bg-summary); 
    border-radius: 10px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: var(--primary); 
    transition: background 0.2s ease, color 0.2s ease; 
    flex-shrink: 0; 
}
.cat-card:hover .cat-card-icon, .compact-card:hover .cat-card-icon { 
    background: var(--primary); 
    color: #ffffff; 
}
.cat-card-icon svg { width: 20px; height: 20px; stroke-width: 2; }

.cat-card h3, .compact-card h3 { 
    font-size: 1.05rem; 
    font-weight: 700; 
    color: var(--text-main); 
    margin: 0; 
    line-height: 1.3; 
}

.compact-card p { 
    font-size: 0.9rem; 
    color: var(--text-sub); 
    margin: 0; 
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; 
    overflow: hidden; 
    line-height: 1.5; 
}

.compact-card > :last-child, .compact-card .card-footer { 
    margin-top: auto; 
    padding-top: 10px; 
    font-weight: 600; 
    color: var(--primary); 
    font-size: 0.9rem; 
    display: flex; 
    align-items: center; 
    gap: 4px; 
    text-decoration: none; 
    width: 100%; 
}
.compact-card > :last-child:hover { color: var(--primary-hover); }

/* --- SIMPLE PAGE TEMPLATE (About / Legal / Policy pages) --- */
.simple-page-card {
    max-width: 850px;
    margin: 20px auto 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px 48px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

@media (max-width: 600px) {
    .simple-page-card {
        padding: 24px 20px;
    }
}

/* --- FOOTER --- */
footer { background: var(--bg-surface); border-top: 1px solid var(--border); padding: 80px 0 40px; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 2.5fr 1fr; gap: 60px; margin-bottom: 60px; align-items: start; }
.footer-col h4 { font-size: 0.95rem; font-weight: 700; color: var(--text-main); margin-bottom: 24px; }
.footer-links.multi-col { column-count: 3; column-gap: 20px; }
.footer-links li { margin-bottom: 18px; }
.footer-links a { display: flex; align-items: center; gap: 8px; color: var(--text-sub); font-size: 0.9375rem; transition: color 0.2s; line-height: 1.6; }
.footer-links a:hover { color: var(--primary); }
.cat-icon { width: 18px; height: 18px; stroke-width: 2; color: var(--primary); opacity: 1; transition: 0.2s; flex-shrink: 0; }
.footer-brand .logo { font-weight: 800; font-size: 1.25rem; color: var(--text-main); display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.footer-brand .logo svg { color: var(--primary); width: 24px; height: 24px; }
.footer-disclaimer { font-size: 0.875rem; color: var(--text-sub); line-height: 1.6; margin-bottom: 24px; padding-right: 40px; }

.social-icons { display: flex; gap: 16px; margin-top: 24px; }
.social-icon-link { color: var(--text-sub); transition: all 0.2s; }
.social-icon-link:hover { color: var(--primary); transform: translateY(-3px); }
.social-icon-link svg { width: 22px; height: 22px; }

.footer-bottom { border-top: 1px solid var(--border); padding-top: 32px; display: flex; justify-content: flex-start; gap: 30px; align-items: center; color: var(--text-sub); font-size: 0.875rem; }

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 1024px) {
    .nexa-2col-layout { display: block; width: 100%; }
    .nexa-main-col { width: 100%; display: block; margin-bottom: 40px; }
    
    .nexa-sidebar-col { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 24px; position: static; }
    
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 40px; } 
    .footer-links.multi-col { column-count: 2; }
}

@media (max-width: 900px) {
    .main-wrapper { padding-top: 96px; } 
    .nexa-2col-layout { margin-top: 20px; }

    .container { padding: 0 16px; }
    input, select, textarea, .input-field, .search-input { font-size: 16px !important; }
    button, a { touch-action: manipulation; }

    .hero-section { padding: 40px 0; }
    .hero-section h1 { font-size: 2.25rem; }
    
    .brand { font-size: 0; overflow: hidden; width: 36px; justify-content: center; flex-shrink: 0; }
    .brand svg { margin: 0; height: 36px; width: 36px; }
    .header-flex { gap: 12px; justify-content: space-between; }
    
    .search-container { flex: 1; max-width: none; position: relative; margin: 0; display: block; }
    .search-input { display: block; height: 42px; font-size: 16px !important; padding: 0 42px 0 38px !important; border-radius: 6px; }
    
    .search-input::placeholder { opacity: 0; } 
    .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-sub); z-index: 5; }
    
    .header-search-btn { display: flex; } 
    .brand-text, .nav-actions, .header-sub { display: none; } 
    .mobile-menu-btn { display: flex; flex-shrink: 0; }
}

@media (max-width: 600px) { 
    .main-wrapper { padding-top: 88px; }
    .nexa-2col-layout { margin-top: 8px; }
    .page-header { margin-bottom: 20px !important; padding-bottom: 16px !important; }

    .footer-grid { grid-template-columns: 1fr; } 
    .footer-links.multi-col { column-count: 2; } 
    .footer-bottom { flex-direction: column; gap: 20px; }
    
    .nexa-sidebar-col { grid-template-columns: 1fr; }
    .home-category-grid, .compact-grid { grid-template-columns: 1fr !important; gap: 16px !important; }
    
    .input-panel { grid-template-columns: 1fr; }
    .calc-action-bar { padding: 12px; }
    .calculator-utilities { justify-content: space-between; gap: 6px; flex-wrap: nowrap; }
    .btn-utility { flex: 1; justify-content: center; padding: 12px 0; min-width: 0; }
    .util-text { display: none; }
    .btn-utility svg { margin: 0; width: 20px; height: 20px; }
    .nexa-chart-container { padding: 16px; }
    .nexa-chart-container canvas { max-height: 220px; }
    .nexa-insight { padding: 14px 16px; font-size: 0.9rem; }
    .nexa-scale-labels { font-size: 0.72rem; }

    /* padding-bottom: 60px standard. If you add a sticky bottom ad bar (.ad-sticky-bottom),
       increase this to 80px to prevent content being hidden behind the fixed unit. */
    footer { padding: 60px 0 60px; } 
}

@media print {
    /* 1. HIDE ALL WEBSITE CLUTTER */
    header, footer:not(.print-footer), .breadcrumbs-section, .nexa-sidebar-col, 
    .page-header, .calc-action-bar, .calc-cta-bar, .hero-section, 
    .gutenberg-content > p, .gutenberg-content > h1, .gutenberg-content > h2, 
    .gutenberg-content > h3, .gutenberg-content > h4, .gutenberg-content > ul, 
    .gutenberg-content > ol { 
        display: none !important; 
    }

    /* 2. PAGE SETUP */
    @page { size: A4 portrait; margin: 1.2cm; }
    body { background: white !important; color: black !important; font-size: 10pt !important; line-height: 1.4 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    
    .main-wrapper { padding: 0 !important; }
    .container { max-width: 100% !important; padding: 0 !important; margin: 0 !important; }
    .nexa-main-col { width: 100% !important; display: block !important; margin: 0 !important; }

    /* 3. DOCUMENT HEADER */
    .calc-interface::before {
        content: "CALCULATION REPORT";
        display: block;
        text-align: center;
        font-size: 16pt;
        font-weight: 800;
        letter-spacing: 3px;
        color: #000;
        padding-bottom: 12px;
        margin-bottom: 24px;
        border-bottom: 2px solid #000;
    }

    /* 4. STRIP WEBSITE BOXES */
    .calc-interface { border: none !important; box-shadow: none !important; margin: 0 !important; background: transparent !important; }
    .nexa-result-container { padding: 0 !important; border: none !important; background: transparent !important; margin-top: 20px !important; opacity: 1 !important; transform: none !important; }
    .nexa-empty-state { display: none !important; }
    .nexa-result-container.results-entered { animation: none !important; }

    /* 5. PERFECTED INPUT ALIGNMENT */
    .input-panel { 
        display: grid !important; 
        grid-template-columns: repeat(4, 1fr) !important; 
        gap: 20px 16px !important; 
        padding: 0 0 24px 0 !important; 
        border-bottom: 1px solid #000 !important;
    }
    .input-group { margin: 0 !important; break-inside: avoid; }
    .input-group.full-span { grid-column: auto !important; } 

    .input-label { font-size: 7.5pt !important; color: #555 !important; margin-bottom: 6px !important; text-transform: uppercase; font-weight: 700 !important; letter-spacing: 0.05em !important; }
    
    /* Baseline alignment for inputs and suffixes */
    .input-field-wrap, .inline-addon-wrap { 
        border: none !important; 
        border-bottom: 1px solid #aaa !important; 
        border-radius: 0 !important; 
        padding: 0 0 4px 0 !important; 
        background: transparent !important; 
        box-shadow: none !important;
        display: flex !important;
        align-items: baseline !important; /* Forces text and numbers onto the same exact line */
    }
    .input-field, .inline-input { 
        font-size: 12pt !important; 
        font-weight: 700 !important; 
        color: #000 !important; 
        padding: 0 !important; 
        height: auto !important; 
        background: transparent !important; 
        line-height: 1 !important;
    }
    .inline-text, .currency-symbol { font-size: 9pt !important; font-weight: 600 !important; color: #333 !important; background: transparent !important; padding-left: 4px !important; }
    .inline-select { padding-right: 0 !important; background-image: none !important; color: #333 !important; font-size: 9pt !important; } 

    .or-toggle-pill { display: none !important; }
    .or-group:not(.active) { display: none !important; }

    /* 6. HERO KPI OVERRIDES */
    .main-result-hero { 
        display: flex !important; 
        align-items: baseline !important; 
        justify-content: space-between !important; 
        margin: 20px 0 !important; 
        padding: 0 0 16px 0 !important; 
        border-bottom: 1px solid #ddd !important; 
        text-align: left !important; 
    }
    .main-result-hero .result-box-label { font-size: 11pt !important; color: #000 !important; font-weight: 800 !important; }
    .main-result-hero .result-box-value { font-size: 24pt !important; color: #000 !important; display: flex !important; align-items: baseline !important; gap: 8px !important; }
    
    /* Force all colored spans in the hero to be pure black/gray for print */
    .main-result-hero span { color: #000 !important; background: transparent !important; }
    .main-result-hero .currency-symbol { font-size: 12pt !important; color: #555 !important; font-weight: 600 !important; }
    .main-result-hero div span:last-child { font-size: 12pt !important; color: #555 !important; font-weight: 600 !important; border: none !important; padding: 0 !important; }

    /* 7. GRID CARDS ALIGNMENT */
    .breakdown-grid { 
        display: flex !important; 
        flex-wrap: nowrap !important; /* Force onto one single line */
        gap: 12px !important; 
        margin-bottom: 20px !important; 
    }
    .breakdown-item { 
        flex: 1 !important; 
        padding: 12px 10px !important; 
        border: 1px solid #ccc !important; 
        border-radius: 6px !important;
        background: transparent !important; 
        transform: none !important; 
    }
    .breakdown-label { font-size: 7pt !important; color: #555 !important; margin-bottom: 6px !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: clip !important; }
    .breakdown-label svg { display: none !important; } 
    .breakdown-label span { display: none !important; } /* Hides redundant mini badges in print */
    
    .breakdown-value { font-size: 12pt !important; color: #000 !important; display: flex !important; align-items: baseline !important; gap: 4px !important; flex-wrap: wrap !important; }
    .breakdown-value span { color: #555 !important; font-size: 8.5pt !important; }

    /* 8. CHART & DASHBOARD ALIGNMENT */
    .nexa-chart-container { 
        padding: 20px !important; 
        margin: 0 !important; 
        border: 1px solid #ccc !important; 
        background: transparent !important; 
        border-radius: 8px !important; 
        break-inside: avoid; 
    }
    .nexa-chart-container > div { display: flex !important; flex-wrap: nowrap !important; align-items: center !important; gap: 30px !important; }
    
    .nexa-chart-title { font-size: 9pt !important; color: #000 !important; margin-bottom: 12px !important; }
    .nexa-chart-container canvas { max-height: 160px !important; width: 160px !important; flex-shrink: 0 !important; margin: 0 auto !important; }
    
    .nexa-chart-container > div > div:nth-child(2) { border: none !important; padding: 0 !important; flex-grow: 1 !important; background: transparent !important; }
    .nexa-chart-container h3 { font-size: 11pt !important; margin-bottom: 12px !important; color: #000 !important; border-bottom: 1px solid #ddd !important; padding-bottom: 8px !important; }
    
    /* Strip web colors from summary row text */
    .nexa-chart-container span { color: #000 !important; }
    .nexa-chart-container .currency-symbol { color: #555 !important; font-size: 8pt !important; }
    
    /* Convert LIFETIME colored badges to clean print outlines */
    .nexa-chart-container span[style*="background"] {
        background: transparent !important;
        color: #555 !important;
        border: 1px solid #999 !important;
        padding: 2px 4px !important;
        border-radius: 4px !important;
        font-size: 6pt !important;
    }

    /* 9. INSIGHTS ALIGNMENT */
    .nexa-insight { 
        padding: 12px 16px !important; 
        margin-top: 20px !important; 
        border: 1px solid #ccc !important; 
        border-left: 4px solid #000 !important; 
        background: transparent !important; 
        color: #000 !important; 
        font-size: 9.5pt !important; 
        border-radius: 6px !important;
        break-inside: avoid; 
    }
    .nexa-insight svg { display: none !important; }

    /* Footer */
    .print-footer { display: block !important; margin-top: 24px !important; padding-top: 12px !important; font-size: 8pt !important; text-align: center !important; border-top: 1px solid #eee !important; color: #777 !important; break-before: auto; }
}

/* --- MODERN DYNAMIC PILL ALERT --- */
.nexa-alert-pill {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-30px) scale(0.95);
    background: #0f172a; 
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 50px; 
    font-size: 0.9rem;
    font-weight: 600;
    pointer-events: none;
    z-index: 2147483647; 
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    gap: 10px;
    width: max-content;
    max-width: 90vw;
}

.nexa-alert-pill.show {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

@media (max-width: 600px) {
    .nexa-alert-pill {
        white-space: normal;
        text-align: left;
        padding: 14px 20px;
        font-size: 0.85rem;
        line-height: 1.4;
        border-radius: 16px; 
        top: 16px;
    }
}

/* =======================================================================
   POLYLANG DROPDOWN & FLAGS (DESKTOP)
   ======================================================================= */

.lang-dropdown { 
    position: relative; 
    display: inline-block; 
}

.lang-toggle { 
    display: inline-flex; 
    align-items: center; 
    gap: 6px; 
    padding: 8px 16px; 
    border: 1px solid var(--border); 
    border-radius: 8px; 
    font-size: 0.85rem; 
    font-weight: 600; 
    color: var(--text-main); 
    background: var(--bg-surface); 
    cursor: pointer; 
    transition: all 0.2s ease; 
    text-transform: uppercase; 
}

.lang-toggle:hover { 
    border-color: var(--primary); 
    color: var(--primary); 
    box-shadow: 0 4px 12px rgba(0,0,0,0.03); 
}

.lang-menu { 
    position: absolute; 
    top: calc(100% + 8px); 
    right: 0; 
    background: var(--bg-surface); 
    border: 1px solid var(--border); 
    border-radius: 8px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.05); 
    min-width: 140px; 
    list-style: none; 
    padding: 8px 0; 
    margin: 0; 
    opacity: 0; 
    visibility: hidden; 
    transform: translateY(-10px); 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
    z-index: 1000; 
}

.lang-dropdown:hover .lang-menu,
.lang-dropdown:focus-within .lang-menu { 
    opacity: 1; 
    visibility: visible; 
    transform: translateY(0); 
}

.lang-menu li { margin: 0; }

.lang-toggle img.flag, 
.lang-menu img.flag {
    width: 18px; 
    height: auto;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.lang-menu a { 
    display: flex; 
    align-items: center;
    gap: 8px; 
    padding: 8px 20px; 
    font-size: 0.85rem; 
    font-weight: 500; 
    color: var(--text-main); 
    text-decoration: none; 
    transition: 0.2s; 
}

.lang-menu a:hover, 
.lang-menu a:focus { 
    background: var(--bg-summary); 
    color: var(--primary); 
}

/* =======================================================================
   MOBILE SIDEBAR FLOATING LANGUAGE DROPDOWN
   ======================================================================= */

#mobile-lang-dropdown:hover .lang-menu,
#mobile-lang-dropdown:focus-within .lang-menu {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
}

#mobile-lang-dropdown.open .lang-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#mobile-lang-dropdown .lang-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15); 
    z-index: 9999;
}

/* =======================================================================
   AD NETWORK CLS PROTECTION
   Reserve explicit space for each ad slot type to prevent layout shift.
   contain:layout stops ad content from affecting surrounding elements.
   Sizes are based on IAB standard units served by Mediavine & Raptive.
   ======================================================================= */
.nexa-ad-wrapper {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 32px auto;
    background: var(--bg-summary);
    border-radius: 8px;
    color: var(--text-sub);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: 100%;
    overflow: hidden;
    contain: layout;
}

/* In-content ad slot — between H2 sections */
.nexa-ad-wrapper.ad-incontent {
    min-height: 250px;
    max-width: 728px;
}

/* Sidebar ad slot — 300x600 half-page on desktop */
.nexa-ad-wrapper.ad-sidebar {
    min-height: 600px;
    max-width: 300px;
    margin: 0 auto 24px;
}

/* Mobile banner — 320x100 or 320x50 */
.nexa-ad-wrapper.ad-mobile {
    min-height: 100px;
    max-width: 320px;
}

/* Sticky bottom bar slot — mobile only */
.nexa-ad-wrapper.ad-sticky-bottom {
    min-height: 60px;
    margin: 0;
    border-radius: 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 990;
    width: 100%;
    max-width: 100%;
}

@media (max-width: 1024px) {
    /* Sidebar becomes inline on tablet — reset to banner height */
    .nexa-ad-wrapper.ad-sidebar {
        min-height: 250px;
        max-width: 100%;
    }
}

/* =======================================================================
   SEARCH BUTTON UI (ICON BUTTON DESIGN)
   ======================================================================= */

.header-search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: #ffffff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
}
.header-search-btn:hover { background: var(--primary-hover); }
.search-input { padding-right: 44px !important; }
html[dir="rtl"] .header-search-btn { right: auto; left: 5px; }
html[dir="rtl"] .search-input { padding-right: 42px !important; padding-left: 44px !important; }

.hero-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: #ffffff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%; 
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}
.hero-search-btn:hover { background: var(--primary-hover); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2); }
.hero-search-input { padding: 18px 60px 18px 60px !important; }

@media (max-width: 600px) {
    .hero-search-btn { width: 38px; height: 38px; right: 6px; }
    .hero-search-input { padding: 16px 54px 16px 50px !important; }
}

/* =======================================================================
   PAGEFIND SEARCH STYLING OVERRIDES (JAMSTACK SEARCH)
   Pagefind CSS variables are declared in the primary :root block above.
   ======================================================================= */

.nexa-hero-pagefind .pagefind-ui__form {
    position: relative !important;
    max-width: 650px !important;
    margin: 0 auto 40px auto !important;
}

.nexa-hero-pagefind .pagefind-ui__form::before {
    content: '';
    position: absolute;
    left: 24px;
    top: 21px; 
    width: 22px;
    height: 22px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E");
    background-size: cover;
    z-index: 10;
    pointer-events: none;
}

.nexa-hero-pagefind .pagefind-ui__form::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 10px; 
    width: 44px;
    height: 44px;
    background-color: var(--primary);
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-size: 20px;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 10;
    pointer-events: none; 
}

.nexa-hero-pagefind .pagefind-ui__search-input {
    width: 100% !important;
    height: 64px !important; 
    padding: 0 60px 0 60px !important;
    font-size: 1.1rem !important;
    border: 1px solid var(--border) !important;
    border-radius: 50px !important;
    background: var(--bg-surface) !important;
    color: var(--text-main) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.04) !important;
    outline: none !important;
    transition: 0.2s !important;
    font-weight: 400 !important;
    margin-bottom: 0 !important;
}

.nexa-hero-pagefind .pagefind-ui__search-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px var(--ring) !important;
}

.nexa-hero-pagefind .pagefind-ui__search-clear {
    display: none !important;
}

@media (max-width: 600px) {
    .nexa-hero-pagefind .pagefind-ui__form::before { top: 16px; }
    .nexa-hero-pagefind .pagefind-ui__form::after { width: 38px; height: 38px; right: 8px; top: 8px; background-size: 18px; }
    .nexa-hero-pagefind .pagefind-ui__search-input { height: 54px !important; padding: 0 54px 0 50px !important; font-size: 1rem !important; }
}

.pagefind-ui__message { color: var(--text-sub) !important; font-weight: 600 !important; margin-bottom: 24px !important; padding-top: 10px !important; border-top: 1px solid var(--border) !important; }

.pagefind-ui__results { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important; gap: 20px !important; padding: 0 !important; margin-top: 20px !important; }

.pagefind-ui__result { position: relative !important; background: var(--bg-surface) !important; border: 1px solid var(--border) !important; border-radius: 10px !important; padding: 20px !important; text-align: left !important; display: flex !important; flex-direction: column !important; align-items: flex-start !important; gap: 12px !important; margin: 0 !important; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease !important; box-shadow: 0 1px 4px rgba(0,0,0,0.03) !important; z-index: 1; list-style: none !important; }
.pagefind-ui__result:hover { transform: translateY(-3px) !important; border-color: var(--primary) !important; box-shadow: 0 8px 16px rgba(37, 99, 235, 0.08) !important; }

.pagefind-ui__result-inner { margin: 0 !important; display: flex !important; flex-direction: column !important; height: 100% !important; width: 100% !important; }
.pagefind-ui__result-title { margin: 0 0 8px 0 !important; }

.pagefind-ui__result-link { font-size: 1.05rem !important; font-weight: 700 !important; color: var(--text-main) !important; text-decoration: none !important; line-height: 1.3 !important; }
.pagefind-ui__result-link::after { content: '' !important; position: absolute !important; top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important; z-index: 10 !important; }

.pagefind-ui__result-excerpt { font-size: 0.9rem !important; color: var(--text-sub) !important; margin: 0 !important; line-height: 1.5 !important; display: -webkit-box !important; -webkit-line-clamp: 2 !important; -webkit-box-orient: vertical !important; overflow: hidden !important; font-weight: 400 !important; }

.pagefind-ui__result-inner::after { 
    content: var(--pf-open-tool, 'Open Tool \2192') !important; 
    margin-top: auto !important; 
    padding-top: 14px !important; 
    font-weight: 600 !important; 
    color: var(--primary) !important; 
    font-size: 0.9rem !important; 
    display: flex !important; 
    align-items: center !important; 
    gap: 4px !important; 
    transition: color 0.2s ease; 
}.pagefind-ui__result:hover .pagefind-ui__result-inner::after { color: var(--primary-hover) !important; }

.pagefind-ui__result-image { display: none !important; }
.pagefind-ui__result-tags { display: none !important; }