/* Font Import with Swap */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Light Theme (Default) */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #10b981;
    --bg-app: #f3f4f6;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    /* Kept from original, not in provided snippet but makes sense for default */
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --accent: #f59e0b;
    /* Kept from original, not in provided snippet but makes sense for default */

    --font-main: 'Inter', sans-serif;
}

[data-theme="neo"] {
    /* Neo-Bharat (Dark/Neon) */
    --primary: #ff9f1c;
    /* Electric Marigold */
    --primary-dark: #f59e0b;
    --secondary: #00ff9d;
    /* Cyber Mint */
    --bg-app: #020617;
    /* Deep Void (Slate 950) */
    --bg-sidebar: #020617;
    /* Set sidebar to app background for neo theme */
    --bg-card: rgba(30, 41, 59, 0.6);
    /* Glassmorphism Base */
    --text-main: #f8fafc;
    /* Slate 50 */
    --text-muted: #94a3b8;
    /* Slate 400 */
    --text-light: #64748b;
    /* Slate 600 for light text in neo theme */
    --border: #1e293b;
    /* Slate 800 */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 12px -2px rgba(0, 0, 0, 0.6);
    /* Adjusted for darker theme */
    --accent: #00ff9d;
    /* Use secondary for accent in neo theme */

    /* Backdrop blur for cards */
    --card-blur: 12px;
}

/* Apply Glassmorphism to Cards in Neo mode */
[data-theme="neo"] .card {
    backdrop-filter: blur(var(--card-blur));
    border: 1px solid rgba(148, 163, 184, 0.1);
}

[data-theme="neo"] .nav-btn {
    color: var(--text-muted);
}

[data-theme="neo"] .nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

[data-theme="neo"] .card p,
[data-theme="neo"] .card span,
[data-theme="neo"] .card label {
    color: var(--text-muted) !important;
}

[data-theme="neo"] .card h3,
[data-theme="neo"] .card h4,
[data-theme="neo"] .card strong,
[data-theme="neo"] .value,
[data-theme="neo"] [id^="lo-total"],
[data-theme="neo"] [id^="lo-squeeze"],
[data-theme="neo"] [id^="lo-relief"] {
    color: var(--text-main) !important;
}

/* Specific Fix for Squeeze Warning Text */
[data-theme="neo"] h3[style*="#ef4444"] {
    color: #ef4444 !important;
    /* Keep Red Warning Red */
}

[data-theme="neo"] h3[style*="#10b981"] {
    color: #10b981 !important;
    /* Keep Green Relief Green */
}

/* Fix for Summary Item Labels which might have inline styles */
[data-theme="neo"] .summary-item .label {
    color: var(--text-muted) !important;
}

[data-theme="neo"] .summary-item .value {
    color: var(--secondary) !important;
    /* Cyber Mint for values */
}

[data-theme="neo"] .nav-btn.active {
    background: rgba(255, 159, 28, 0.15);
    /* Marigold tint */
    color: var(--primary);
    border: 1px solid var(--primary);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    /* App-like feel */
}

.app-layout {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow-y: auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 40px;
}

.logo .highlight {
    color: var(--primary);
}

.nav-group {
    margin-bottom: 24px;
}

.nav-group h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 12px;
}

.nav-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 2px;
}

.nav-btn:hover {
    background: #f9fafb;
    color: var(--text-main);
}

.nav-btn.active {
    background: #eff6ff;
    color: var(--primary);
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
}

.section-header {
    margin-bottom: 30px;
}

.section-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

.section-header p {
    color: var(--text-muted);
}

.calculator-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.calculator-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

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

.calc-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 30px;
    max-width: 1100px;
    margin: 0 auto;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-sm);
    position: relative;
    /* For mobile menu button layout */
}

/* Mobile Buttons & Header */
/* Mobile Header (Hidden on Desktop) */
.mobile-header {
    display: none !important;
    visibility: hidden;
    pointer-events: none;
}

.mobile-header .logo {
    margin-bottom: 0;
    font-size: 1.2rem;
    margin-left: 45px;
    /* Leave space for hamburger */
    cursor: pointer;
}

.mobile-only-btn {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    font-size: 1.5rem;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 1001;
}

.menu-trigger {
    /* Styles for the hamburger inside the header or standing alone */
    position: relative;
    /* Default to relative for header placement */
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 5px;
}

/* Fallback for pages where trigger is fixed */
body:not(:has(.mobile-header)) .menu-trigger {
    position: fixed;
    top: 15px;
    left: 15px;
    background: var(--bg-sidebar);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#menu-close {
    font-size: 1.2rem;
    padding: 4px 8px;
    display: none;
    /* Hidden in favor of toggle */
}

/* Forms */
.input-group {
    margin-bottom: 24px;
}

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

.input-wrapper,
.std-input {
    width: 100%;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    transition: box-shadow 0.2s;
}

.input-wrapper:focus-within,
.std-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.input-wrapper input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
}

.currency,
.unit {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-right: 8px;
}

.unit {
    margin-left: 8px;
    margin-right: 0;
}

input[type="range"] {
    width: 100%;
    margin-top: 10px;
    accent-color: var(--primary);
}

/* Select */
select.std-input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

/* Summary */
.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.summary-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.summary-item .label {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.summary-item .value {
    font-weight: 600;
    font-size: 1.2rem;
}

.summary-item.total .value {
    color: var(--primary);
    font-size: 1.5rem;
}

.highlight-text {
    color: var(--primary);
}

.chart-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.donut-chart {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    position: relative;
    background: conic-gradient(var(--primary) 0%, #e5e7eb 0%);
}

.donut-chart::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 75%;
    height: 75%;
    background: white;
    border-radius: 50%;
}

.static-val {
    font-weight: 600;
    color: var(--text-main);
}

.separator {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -260px;
        /* Hidden by default on the left */
        top: 0;
        bottom: 0;
        z-index: 2000;
        transition: left 0.3s ease;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
    }

    .sidebar.active {
        left: 0;
    }

    .mobile-header {
        display: flex !important;
        visibility: visible !important;
        pointer-events: auto !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border);
        z-index: 5000;
        align-items: center;
        padding: 0 15px;
    }

    [data-theme="neo"] .mobile-header {
        background: rgba(2, 6, 23, 0.9);
        border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    }

    .mobile-only-btn {
        display: none !important;
    }

    .menu-trigger {
        display: flex !important;
        visibility: visible !important;
        pointer-events: auto !important;
        position: absolute;
        left: 15px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 5001;
    }

    .main-content {
        padding: 80px 15px 20px 15px;
        width: 100%;
        overflow-x: hidden;
    }

    .calc-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .summary-row {
        flex-direction: column;
        gap: 15px;
    }
}

/* Outlook Grid */
.outlook-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* 2 cols */
    gap: 20px;
    margin-bottom: 30px;
}

.in-group h3 {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 15px;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 10px;
}

.outlook-results {
    margin-top: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    text-align: center;
}

.sum-box span {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.sum-box h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.chart-container-large {
    position: relative;
    height: 300px;
    width: 100%;
}

@media (max-width: 768px) {
    .outlook-grid {
        grid-template-columns: 1fr;
    }
}

.action-btn {
    background-color: var(--primary);
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 14px 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    box-shadow: var(--shadow-md);
}

.action-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

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

/* Right Panel */
.right-panel {
    width: 280px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow-y: auto;
    flex-shrink: 0;
}

.rp-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.rp-header {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.ad-placeholder {
    height: 200px;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 0.9rem;
    border-radius: 4px;
    margin-bottom: 10px;
}

.tip-content {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.5;
}

.tip-highlight {
    color: var(--primary);
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}

/* Mobile Hiding */
@media (max-width: 1024px) {
    .right-panel {
        display: none;
    }
}

/* Horizontal Alignment for Smart Loan */
.horizontal-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    /* Tighter spacing */
}

.horizontal-group label {
    margin-bottom: 0;
    margin-right: 15px;
    flex: 1;
}

.horizontal-group .std-input {
    width: 140px;
    /* Fixed width for alignment */
    text-align: right;
}

/* Neo Theme Inputs */
[data-theme="neo"] .std-input,
[data-theme="neo"] .input-wrapper {
    background: rgba(2, 6, 23, 0.5);
    /* Deep dark background */
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: var(--text-main);
}

[data-theme="neo"] .std-input:focus,
[data-theme="neo"] .input-wrapper:focus-within {
    border-color: var(--secondary);
    /* Cyber Mint Border on Focus */
    box-shadow: 0 0 0 2px rgba(0, 255, 157, 0.1);
    background: rgba(2, 6, 23, 0.8);
}

[data-theme="neo"] .input-wrapper input {
    color: var(--text-main);
}

/* Privacy Banner */
#privacy-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    animation: slideUp 0.5s ease-out;
}

[data-theme="neo"] #privacy-banner {
    background: rgba(2, 6, 23, 0.9);
    border-color: var(--secondary);
    box-shadow: 0 0 20px rgba(0, 255, 157, 0.1);
}

#privacy-banner p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-main);
}

#privacy-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s;
}

#privacy-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

[data-theme="neo"] #privacy-btn {
    background: var(--secondary);
    /* Cyber Mint */
    color: #000;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@media (max-width: 600px) {
    #privacy-banner {
        flex-direction: column;
        text-align: center;
        bottom: 0;
        width: 100%;
        border-radius: 12px 12px 0 0;
    }
}

/* Social Sharing Buttons */
.social-links {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
}

.share-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.share-btn:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

[data-theme="neo"] .share-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

[data-theme="neo"] .share-btn:hover {
    border-color: var(--secondary);
    box-shadow: 0 0 10px rgba(0, 255, 157, 0.2);
}

/* Tooltips */
.tooltip-container {
    position: relative;
    display: inline-block;
    cursor: help;
    margin-left: 6px;
    vertical-align: middle;
}

.tooltip-icon {
    width: 16px;
    height: 16px;
    background: var(--border);
    color: var(--text-muted);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

[data-theme="neo"] .tooltip-icon {
    background: rgba(255, 255, 255, 0.1);
}

.tooltip-text {
    visibility: hidden;
    width: 220px;
    background-color: var(--bg-card);
    color: var(--text-main);
    text-align: center;
    border-radius: 8px;
    padding: 10px;
    position: absolute;
    z-index: 100;
    bottom: 125%;
    left: 50%;
    margin-left: -110px;
    opacity: 0;
    transition: opacity 0.3s;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    font-size: 0.8rem;
    line-height: 1.4;
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Validation Styling */
.std-input.invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1) !important;
}

/* Confetti Styles */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: #f2d74e;
    top: -10px;
    z-index: 10000;
    pointer-events: none;
}