/* --- GLOBAL HEADER SETTINGS --- */
.global-settings { 
    display: flex; 
    gap: 10px; 
}
.header-select {
    background-color: #fceeed;
    color: #121212;
    border: 1px solid #f2e1e3;
    padding: 6px 25px 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    background-position: right 8px top 50%;
    background-size: 10px;
}
.header-select:hover {
    border-color: #d98a94;
}

/* --- UNIVERSAL VARIABLES & RESET --- */
:root { 
    --primary: #121212; /* Technocorp Deep Charcoal */
    --bg: #fdf8f9; /* Very subtle pink tint for the whole page */
    --card: #ffffff; 
    --text: #333333; 
    --border: #f2e1e3; /* Soft pink border */
    --hover: #fceeed; /* Technocorp Pale Pink */
}
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background-color: var(--bg); 
    color: var(--text); 
    margin: 0; 
    padding: 0; 
}

/* Add this small fix to ensure the export button stays visible on hover */
.btn-export:hover { background: #333333; }

/* --- NAVIGATION BAR --- */
.navbar { background-color: var(--card); padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 4px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 100; }
.nav-brand a { text-decoration: none; font-size: 1.2rem; font-weight: bold; color: var(--primary); }
.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { text-decoration: none; color: var(--text); font-weight: 500; }
.nav-links a:hover { color: var(--primary); }
.dropdown { position: relative; display: inline-block; }
.dropbtn { background: none; border: none; font-size: 1rem; font-weight: 500; color: var(--text); cursor: pointer; padding: 0; font-family: inherit; }
.dropdown-content { display: none; position: absolute; right: 0; top: 100%; background-color: var(--card); min-width: 200px; box-shadow: 0 8px 16px rgba(0,0,0,0.1); border-radius: 8px; overflow: visible; z-index: 1; }
.dropdown-content a { color: var(--text); padding: 12px 16px; text-decoration: none; display: block; border-bottom: 1px solid var(--border); }
.dropdown:hover .dropdown-content { display: block; }

/* --- NESTED FLYOUT MENU --- */
.nested-dropdown { position: relative; }
.nested-dropbtn { display: flex !important; justify-content: space-between; align-items: center; cursor: pointer; }
.nested-dropdown-content { 
    display: none; 
    position: absolute; 
    left: 100%; /* Makes it open to the right side */
    top: 0; 
    background-color: var(--card); 
    min-width: 220px; 
    box-shadow: 0 8px 16px rgba(0,0,0,0.1); 
    border-radius: 8px; 
    overflow: hidden; 
    z-index: 2; 
    border: 1px solid var(--border);
}
.nested-dropdown:hover .nested-dropdown-content { display: block; }
.nested-dropdown-content a { color: var(--text); padding: 12px 16px; text-decoration: none; display: block; border-bottom: 1px solid var(--border); }
.nested-dropdown-content a:hover { background-color: #f8fafc; color: var(--primary); }

/* --- CALCULATOR CONTAINERS & GRIDS --- */
.container { max-width: 1000px; margin: 40px auto; background: var(--card); padding: 30px; border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.input-section { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
.summary-section { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 30px; }

/* --- INPUTS & CARDS --- */
.input-group label { display: block; font-weight: 600; margin-bottom: 8px; color: #475569; }
.slider-row { display: flex; align-items: center; gap: 10px; position: relative; }
.input-wrapper { position: relative; width: 140px; }
.input-wrapper input { width: 100%; padding: 8px 25px 8px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 15px; box-sizing: border-box; }
input.has-prefix { padding-left: 25px; }
.input-wrapper .suffix { position: absolute; right: 10px; top: 55%; transform: translateY(-50%); color: #64748b; font-weight: bold; pointer-events: none; }
.input-wrapper .prefix { position: absolute; left: 10px; top: 45%; transform: translateY(-50%); color: #64748b; font-weight: bold; pointer-events: none; }
input[type="range"] { flex-grow: 1; cursor: pointer; }

.card { background: #f1f5f9; padding: 20px; border-radius: 8px; text-align: center; border: 1px solid var(--border); }
.card h4 { margin: 0 0 10px 0; color: #64748b; font-size: 14px; text-transform: uppercase; }
.card .value { font-size: 22px; font-weight: bold; color: var(--primary); }

/* --- HOMEPAGE SPECIFIC STYLES --- */
.hero { text-align: center; padding: 60px 20px 40px; }
.hero h1 { color: var(--primary); font-size: 2.5rem; margin-bottom: 10px; }
.hero p { color: #4a3639; font-size: 1.1rem; max-width: 600px; margin: 0 auto; } /* Warmer dark tone */

.tools-grid { max-width: 1000px; margin: 0 auto 60px; padding: 0 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 25px; }

.tool-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 30px; text-decoration: none; color: inherit; transition: all 0.3s ease; display: block; box-shadow: 0 4px 6px rgba(0,0,0,0.02); }
/* Added a soft dusty rose glow on hover! */
.tool-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(217, 138, 148, 0.15); border-color: #d98a94; } 
.tool-card h3 { color: var(--primary); margin-top: 0; font-size: 1.4rem; margin-bottom: 10px;}
.tool-card p { color: #5a4b4d; margin: 0; line-height: 1.5; }

/* The "Live" Badges updated to Pale Pink & Dusty Rose */
.status-badge { display: inline-block; background: #fceeed; color: #d98a94; border: 1px solid #f2e1e3; font-size: 0.75rem; padding: 4px 8px; border-radius: 4px; font-weight: bold; margin-bottom: 15px; }

/* --- EMI CALCULATOR SPECIFIC STYLES --- */

/* Top Controls & Export Button */
.top-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }
.toggle-group { display: flex; gap: 15px; background: #f1f5f9; padding: 10px; border-radius: 6px; border: 1px solid var(--border); }
.toggle-group label { cursor: pointer; font-weight: 500; font-size: 14px; }

.btn-export { background: var(--primary); color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-weight: bold; transition: background 0.3s; }
.btn-export:hover { background: #1d4ed8; }

/* EMI Bar Chart Wrapper */
.chart-container { position: relative; width: 100%; height: 400px; margin-bottom: 40px; display: block; }
@media (max-width: 600px) {
    .chart-container { height: 300px; margin-bottom: 20px; }
}

/* Amortization Table */
.table-container { overflow-x: auto; margin-top: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--card); }
th, td { border: 1px solid var(--border); padding: 12px; text-align: center; }
th { background-color: var(--primary); color: white; position: sticky; top: 0; z-index: 10; }
.year-row { background-color: #f8fafc; font-weight: bold; cursor: pointer; transition: background 0.2s; }
.year-row:hover { background-color: #e2e8f0; }
.year-row td:first-child::after { content: ' ▼'; font-size: 10px; color: #64748b; }
.month-row { background-color: #ffffff; font-size: 13px; color: #475569; }
.hidden { display: none; }

/* --- FIXES FOR INPUTS & DROPDOWNS --- */

/* 1. Hide number input arrows to prevent overlap */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
input[type=number] {
    -moz-appearance: textfield; /* Firefox */
}

/* 2. Style Dropdowns to perfectly match text inputs */
select {
    width: 100%;
    padding: 8px 30px 8px 8px; /* Extra right padding for the arrow */
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 15px;
    box-sizing: border-box;
    background-color: var(--card);
    color: var(--text);
    font-family: inherit;
    appearance: none; /* Removes old Windows/Mac default styling */
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%2364748b" viewBox="0 0 16 16"><path d="M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 12px;
    cursor: pointer;
}
select:focus { outline: none; border-color: #121212; }

/* --- MENSURATION VISUALIZER LAYOUT --- */
.geometry-workspace { display: flex; gap: 30px; align-items: stretch; margin-bottom: 30px; }
.geometry-controls { flex: 1; display: flex; flex-direction: column; gap: 20px; }
.geometry-visualizer { flex: 1; background: #ffffff; border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; min-height: 350px; position: relative; }
.geometry-visualizer svg { max-width: 100%; max-height: 200px; margin-bottom: 20px; }

/* Visualizer dynamic labels */
.vis-labels { text-align: center; width: 100%; }
.vis-labels .badge { display: inline-block; background: #fceeed; color: #121212; padding: 4px 10px; border-radius: 4px; font-size: 13px; font-weight: bold; margin: 5px; border: 1px solid #d98a94; }

@media (max-width: 768px) {
    .geometry-workspace { flex-direction: column; }
    .geometry-visualizer { min-height: 250px; }
}

/* --- ADVERTISEMENT PLACEHOLDERS --- */
.page-wrapper {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

.main-content-area {
    flex: 1;
    max-width: 1100px; /* Keeps your calculators the perfect size */
}

/* The Ad Boxes */
.ad-space {
    background-color: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Top Leaderboard (Standard 728x90) */
.ad-top {
    width: 100%;
    max-width: 728px;
    height: 90px;
    margin: 0 auto 20px auto;
}

/* Side Skyscrapers (Standard 160x600) */
.ad-side {
    width: 160px;
    height: 600px;
    flex-shrink: 0;
    position: sticky;
    top: 100px; /* Keeps the ad on screen when scrolling */
}

/* Hide side ads on mobile/tablets so they don't break the screen */
@media (max-width: 1200px) {
    .ad-side { display: none; }
}