/* 
 * Finance & Tools Hub - UI V3
 * Theme: Corporate Fintech (Navy/Gold/White) + Responsive Mega Menu
 */

:root {
    /* Brand Colors - Professional Fintech */
    --primary-color: #0F172A;
    /* Deep Navy/Charcoal */
    --primary-light: #1E293B;
    --secondary-color: #D97706;
    /* Dark Gold/Amber for accents */
    --secondary-light: #F59E0B;

    /* Category Accents (Subtle) */
    --finance-accent: #0F172A;
    --fitness-accent: #059669;
    /* Emerald */
    --math-accent: #4F46E5;
    /* Indigo */
    --other-accent: #EA580C;
    /* Orange */

    /* Functional Colors */
    --text-color: #111827;
    --text-light: #64748B;
    --bg-color: #F8FAFC;
    /* Cool Gray */
    --card-bg: #FFFFFF;
    --input-bg: #F1F5F9;
    --border-color: #E2E8F0;

    /* Spacing & Layout */
    --container-width: 1280px;
    --border-radius: 12px;
    /* Sharper, more corporate */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Typography */
h1,
h2,
h3,
h4,
h5 {
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: -0.025em;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s;
}

a:hover {
    color: var(--secondary-color);
}

/* Layout Containers */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header & Navigation V3 */
header {
    background-color: #fff;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: -0.05em;
    z-index: 1002;
    /* Retained from original .logo */
}

.logo-img {
    /* height: 40px; */
    width: auto;
    display: block;
}

@media (max-width: 768px) {
    .logo-img {
        /* height: 32px; */
    }
}

.logo span {
    color: var(--secondary-color);
    font-size: 1.8rem;
    line-height: 1;
}

/* Desktop Navigation */
.nav-desktop {
    display: none;
    /* Mobile first hidden */
}

@media (min-width: 992px) {
    .nav-desktop {
        display: flex;
        gap: 2rem;
        height: 100%;
        align-items: center;
    }

    .nav-item {
        position: relative;
        height: 100%;
        display: flex;
        align-items: center;
    }

    .nav-link {
        color: var(--text-color);
        font-weight: 600;
        padding: 0 0.5rem;
        cursor: pointer;
        height: 100%;
        display: flex;
        align-items: center;
        border-bottom: 3px solid transparent;
        transition: border-color 0.2s;
    }

    .nav-item:hover .nav-link {
        color: var(--primary-color);
        border-bottom-color: var(--secondary-color);
    }

    .dropdown-menu {
        position: absolute;
        top: 100%;
        /* Below header */
        left: 50%;
        transform: translateX(-50%) translateY(10px);
        background: #fff;
        min-width: 260px;
        box-shadow: var(--shadow-hover);
        border-radius: var(--border-radius);
        border: 1px solid var(--border-color);
        padding: 0.5rem 0;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    /* Mega menu width adjustments if needed */
    .dropdown-menu.wide {
        min-width: 600px;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .nav-item:hover .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }

    .dropdown-item {
        display: block;
        padding: 0.75rem 1.5rem;
        color: var(--text-light);
        font-size: 0.95rem;
        font-weight: 500;
        border-left: 3px solid transparent;
    }

    .dropdown-item:hover {
        background-color: var(--bg-color);
        color: var(--primary-color);
        border-left-color: var(--secondary-color);
    }
}

/* Mobile Menu Toggle */
.mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1002;
    color: var(--primary-color);
    width: 40px;
    height: 40px;
}

@media (min-width: 992px) {
    .mobile-toggle {
        display: none;
    }
}

/* Mobile Navigation */
.nav-mobile {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    background: #fff;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 9999;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.nav-mobile.open {
    transform: translateX(0);
}

.mobile-nav-item {
    margin-bottom: 1.5rem;
}

.mobile-nav-link {
    display: block;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.mobile-sub-menu {
    padding-left: 1rem;
    border-left: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-sub-menu a {
    display: block;
    color: var(--text-light);
    font-size: 0.95rem;
    padding: 0.2rem 0;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeIn 0.6s ease-out forwards;
}

.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

/* Home Grid V3 */
.category-badges {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.5rem 1.5rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.badge:hover,
.badge.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Component Styles Reused & Polished from V2 */
.calculator-container {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 3rem;
    border: 1px solid var(--border-color);
}

@media (min-width: 992px) {
    .calculator-container {
        flex-direction: row;
    }
}

.calc-left {
    padding: 2rem;
    flex: 3;
    border-right: 1px solid var(--border-color);
}

.calc-right {
    padding: 2.5rem;
    flex: 2;
    background-color: #F8FAFC;
    display: flex;
    flex-direction: column;
    position: relative;
    /* For pseudo-element */
    min-height: 400px;
    /* Ensure visual balance */
}

/* Add 'Results' Label automatically */
/* .calc-right::before rule moved to bottom of file to reflect latest design */


/* Mobile adjustments for calc */
@media (max-width: 768px) {

    .calc-left,
    .calc-right {
        padding: 1.5rem;
        border-right: none;
    }

    .calculator-container {
        margin-bottom: 2rem;
    }
}

.styled-input {
    width: 100%;
    padding: 1rem 1.25rem;
    /* More generous padding */
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--primary-color);
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    /* Smooth rounded corners */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    /* Subtle inner depth */
}

/* Remove internal padding for file upload or date inputs if needed */
.styled-input[type="date"] {
    padding-right: 1rem;
}

.styled-input:hover {
    background-color: #fcfcfc;
    border-color: #94A3B8;
    /* Darker grey on hover */
}

.styled-input:focus {
    background-color: #fff;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.15);
    /* Nice focus ring */
    outline: none;
    transform: translateY(-1px);
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: #fff;
    padding: 4rem 0;
    margin-top: auto;
}

footer a {
    color: #94A3B8;
}

footer a:hover {
    color: #fff;
}

/* Feature Cards V3 Polish */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 2rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--border-color);
    transition: background 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.feature-card:hover::before {
    background: var(--secondary-color);
}

.feature-card.finance:hover::before {
    background: var(--finance-accent);
}

.feature-card.fitness:hover::before {
    background: var(--fitness-accent);
}

.feature-card.math:hover::before {
    background: var(--math-accent);
}

.feature-card.other:hover::before {
    background: var(--other-accent);
}

.card-category-label {
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 700;
    letter-spacing: 0.05em;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.95rem;
    color: var(--text-light);
    flex: 1;
}

/* Feature Btn - Primary Action Style */
.feature-btn {
    margin-top: 1.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: white !important;
    /* Force text white */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--secondary-color), #EA580C);
    /* Gradient */
    padding: 1rem 2rem;
    border-radius: 50px;
    /* Pill shape */
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(217, 119, 6, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-btn::after {
    content: '→';
    transition: transform 0.2s;
    font-size: 1.2em;
}

.feature-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(217, 119, 6, 0.4);
    filter: brightness(1.1);
}

.feature-btn:active {
    transform: translateY(0);
}

.feature-card:hover .feature-btn::after {
    transform: translateX(4px);
}

/* FAQs and Related Calcs Styles */
.faq-container {
    margin-top: 5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.faq-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: border-color 0.2s;
}

.faq-item:hover {
    border-color: var(--primary-light);
}

.faq-item summary {
    padding: 1.2rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    list-style: none;
    /* Hide default triangle */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-light);
}

.faq-item details[open] summary::after {
    content: '-';
}

.faq-item p {
    padding: 0 1.2rem 1.2rem 1.2rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-top: 0;
}

/* Related Calculators - Specific Style */
.related-calcs {
    margin-top: 5rem;
    padding: 4rem 0;
    background-color: #F8FAFC;
    /* Light gray section background */
    border-top: 1px solid var(--border-color);
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.related-calcs h3 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 1.8rem;
    color: var(--primary-color);
}

.related-calcs .related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Specialized Card for Related Section */
.related-card {
    background: #fff;
    border-radius: 16px;
    /* softer radius */
    padding: 2rem;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    /* very subtle shadow */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    align-items: center;
    text-align: center;
}

.related-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.related-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    text-align: center;
    /* Override specific h3 alignment if needed */
    color: var(--primary-color);
}

.related-card .feature-btn {
    margin-top: 1.5rem;
    justify-content: center;
    background-color: var(--input-bg);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.related-card:hover .feature-btn {
    background-color: #FEF3C7;
    /* Amber-100 */
    color: var(--secondary-color);
}

/* Mobile Tweaks */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .faq-container {
        margin-top: 3rem;
    }

    .related-calcs {
        padding: 3rem 0;
    }

    /* Mobile Input & Layout Enhancements */
    .styled-input {
        padding: 1.5rem 1.5rem;
        /* MAXIMIZED padding for touch */
        font-size: 1.25rem;
        /* Big, clear font */
        border-width: 2px;
        /* Thicker border for clarity */
        border-color: #CBD5E1;
        /* Distinct border color */
        height: auto;
    }

    .calc-right {
        padding: 2rem 1.5rem;
        min-height: auto;
        border-top: 1px solid var(--border-color);
        background-color: #fff;
        box-shadow: none;
        /* Remove inner shadow on mobile */
    }

    /* Ensure summary items stack on mobile if not already */
    .result-summary .summary-item {
        margin-bottom: 1.5rem;
    }
}

/* Result Section Professional Polish - Global */
.calc-right {
    box-shadow: inset 3px 0 10px -5px rgba(0, 0, 0, 0.05);
    background-color: #F8FAFC;
    /* Ensure subtle contrast */
    justify-content: center;
    /* Center content vertically if few results */
}

/* Result Item Container - The key to 'Label on separate line' */
.result-summary .summary-item {
    display: flex;
    flex-direction: column;
    /* CRITICAL: Stacks Label on top of Value */
    gap: 0.25rem;
    /* Space between label and value */
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border-left: 3px solid transparent;
    /* Ready for hover */
    transition: all 0.2s ease;
}

.result-summary .summary-item:hover {
    background-color: #fff;
    border-left-color: var(--secondary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* Scientific & Fraction Fixes */
.scientific-calc-wrapper {
    max-width: 400px;
    margin: 0 auto 3rem auto;
    background: #fff;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.sci-display {
    width: 100%;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    font-size: 2rem;
    text-align: right;
    background-color: #F8FAFC;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--primary-color);
    font-family: monospace;
    overflow-x: auto;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.sci-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.sci-btn {
    padding: 1rem 0;
    font-size: 1.25rem;
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    color: var(--primary-color);
}

.sci-btn:hover {
    background: #F1F5F9;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.sci-btn.op {
    background: #EFF6FF;
    color: var(--math-accent);
    border-color: #DBEAFE;
}

.sci-btn.eq {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
    grid-column: span 2;
}

/* Fraction Inputs Override */
.input-group-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    /* responsive */
}

.input-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100px !important;
    /* Force wider width */
}

.input-column .styled-input {
    text-align: center;
    padding: 0.75rem !important;
    /* adjust padding for smaller boxes */
    font-size: 1.25rem;
}

/* Label Styling within Result Item */
.summary-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-light);
    font-weight: 600;
    letter-spacing: 0.05em;
    order: 1;
    /* Ensure label is first */
}

/* Value Styling within Result Item */
.summary-value {
    font-size: 1.75rem;
    /* Big, clear value */
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Inter', sans-serif;
    /* Ensure number font is clean */
    order: 2;
    /* Ensure value is second */
    line-height: 1.2;
}

/* Total/Final Result Highlight */
.summary-value.total {
    font-size: 2.5rem;
    color: var(--secondary-color);
    /* Highlight color */
    background: linear-gradient(135deg, var(--secondary-color), #EA580C);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    /* Gradient Text */
}

/* Result Section Header - Removed to avoid duplication with HTML */