/* --- 1. Core Variables & Base --- */
* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden; /* This is the "magic" fix for horizontal scrolling */
    width: 100%;
    position: relative;
}
:root {
    --navy: #001F3F;      
    --blue: #007bff;      
    --bg-light: #f9fbff;  
    --text-main: #222;    
    --text-sub: #6c757d;  
    --border: #e2e8f0;    
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-main);
    margin: 0;
    background-color: #ffffff;
}

/* --- 2. Header & 3-Bar Menu --- */
.site-header {
    background-color: #fff;
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between; 
    align-items: center;
    box-sizing: border-box;
    width: 100%; /* Ensure it spans full width */
}

.logo a {
    font-size: 1.4rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--navy);
}

.logo-sub {
    font-size: 0.7rem;
    color: var(--text-sub);
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    gap: 25px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
}

/* Hamburger Icon */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
}

.menu-toggle .bar {
    width: 25px;
    height: 3px;
    background-color: var(--navy);
    border-radius: 2px;
}

/* --- 3. Main Layout Structure (YOUR ORIGINAL FORMAT) --- */
#contentout {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 40px;
    padding: 20px;
    box-sizing: border-box;
}

#content {
    flex: 1;
    min-width: 0;
}

#right {
    flex: 0 0 280px;
    width: 280px;
    max-width: 100%; /* Add this to ensure it never exceeds screen width */
}

/* --- 4. Calculator Card & Results --- */
.calculator-container {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: clamp(15px, 5vw, 30px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.panel {
    margin-bottom: 25px;
}

h1 {
    color: var(--navy);
    font-size: 1.75rem;
    margin-top: 0;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--navy);
}

small {
    display: block;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-sub);
    margin-top: 2px;
    line-height: 1.3;
}

.results-box {
    background-color: var(--bg-light);
    border-left: 5px solid var(--navy);
    padding: 20px;
    margin-top: 25px;
    border-radius: 0 12px 12px 0;
}

.res-highlight {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--navy);
}

/* --- 5. Inputs & "Calculate" Navy Button --- */
input[type="text"], input[type="tel"], input[type="number"], select {
    font-size: 16px; /* Prevents iOS auto-zoom */
    max-width: 100%;
    padding: 12px;
    margin: 8px 0 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-sizing: border-box;
}

.primary-btn, #bluebtn {
    width: 100%;
    background-color: var(--navy);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: block;
}

.primary-btn:hover, #bluebtn:hover { background-color: var(--blue); }

.primary-btn small {
    display: inline;
    color: #eee;
    margin-left: 10px;
    font-weight: normal;
}

/* --- 6. Sidebar Navigation (Professional List Style) --- */
#octitle {
    background-color: var(--violet); /* Solid Background */
    color: #ffffff !important;      /* Force White Text for Readability */
    padding: 12px 15px;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
    text-transform: uppercase;
}

#ocother {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    font-size: 0; /* Keeps pipes hidden */
    overflow: hidden;
}

#ocother a {
    display: block;
    font-size: 1rem;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-main); /* Start with main text color */
    background: transparent;
    border-bottom: 1px solid var(--border);
    transition: all 0.2s ease-in-out;
    font-weight: 500;
}

/* Remove border from the last item */
#ocother a:last-child {
    border-bottom: none;
}

#ocother a:hover {
    color: var(--blue); /* Letters turn Blue */
    background: var(--bg-light); /* Very subtle tint */
    text-decoration: underline; /* Professional underline */
    text-underline-offset: 4px; /* Better spacing for the underline */
    padding-left: 20px; /* Subtle "nudge" effect on hover */
}

/* --- 7. Responsive Mobile Overrides --- */
@media (max-width: 850px) {
    .menu-toggle { display: flex; } /* Show 3 bars */

    .nav-links {
        display: none; 
        position: absolute;
        top: 65px;
        left: 0;
        width: 100%;
        background: white;
        flex-direction: column;
        border-bottom: 1px solid var(--border);
        z-index: 1001;
    }

    .nav-links.active { display: flex; }

    .nav-links a {
        padding: 15px;
        border-top: 1px solid var(--border);
    }

#contentout { 
        flex-direction: column; 
        padding: 10px; /* Reduce padding on mobile so the card fills the screen */
        gap: 20px;
    }

    #right { 
        width: 100%; 
        order: 2; 
    }

    /* Fix the Calculator Card on Mobile */
    .calculator-container {
        border-radius: 0; /* Optional: square edges look more "app-like" on mobile */
        border-left: none;
        border-right: none;
    }
}
/* --- 8. Page Header (Bold Title Section) --- */
.page-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.page-header h1 {
    font-size: 2.2rem;
    color: var(--navy);
    font-weight: 800;
    margin-bottom: 10px;
}

.page-header .subtitle {
    color: var(--text-sub);
    font-size: 1.1rem;
    line-height: 1.5;
}
/* --- 9. Mobile Content Fit Fixes --- */
img, video, canvas, svg {
    max-width: 100%;
    height: auto;
}

/* Ensure the calculator container doesn't overflow */
.calculator-container {
    width: 100%;
    box-sizing: border-box; /* Forces padding to stay inside the width */
}

/* Prevent the formula from breaking the layout */
.explanation-section div {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}
.search-results-popup {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    z-index: 999;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: none;
    max-height: 300px;
    overflow-y: auto;
    border-radius: 0 0 8px 8px;
}

.search-item a {
    display: block;
    padding: 10px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #eee;
}

.search-item a:hover {
    background: #f9f9f9;
    color: #007bff;
}