﻿/* ==========================================================================
   GLOBAL COMPONENT MATRIX & COLOR VARIABLES
   ========================================================================== */
:root {
    --primary: #10b981; /* Finance Green */
    --primary-dark: #059669;
    --bg: #f3f4f6;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #d1d5db;
    --card-inner: #f9fafb;
    --ad-bg: #e5e7eb;
}

body.dark-theme {
    --bg: #111827; /* Dark charcoal */
    --card: #1f2937; /* Off-black card structures */
    --text: #f9fafb; /* High contrast text */
    --muted: #9ca3af; /* Mid-tone gray details */
    --border: #374151; /* Subdued dark borders */
    --card-inner: #111827;
    --ad-bg: #374151;
}

/* Base Transitions & Formatting */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body, .card, select, input, .main-stat, .sub-row, button, .chart-bar {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

body {
    background-color: var(--bg);
    color: var(--text);
    /*padding: 24px;*/
    line-height: 1.5;
}

.wrapper {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    margin-bottom: 28px;
    /*text-align: center;*/
}

    header h1 {
        font-size: 2.2rem;
        color: var(--text);
        margin-bottom: 8px;
        font-weight: 700;
    }

    header p {
        color: var(--muted);
        font-size: 1.05rem;
    }

/* ==========================================================================
   2-COLUMN HIGH-AD-VIEWABILITY CORE LAYOUT
   ========================================================================== */
.main-layout-grid {
    display: grid;
    grid-template-columns: 1fr 300px; /* Left tool gets variable flex space; Right side locks ad size */
    gap: 28px;
    align-items: start;
}

/* Left Column Workspace (Tool Wrapper) */
.tool-workspace {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Internal Inner Panel Setup (Splits Inputs from Outputs inside the workspace) */
.inner-tool-split {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
}

/* Standard Visual Elements */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.03);
}

.input-group {
    margin-bottom: 20px;
}

    .input-group label {
        display: block;
        font-weight: 600;
        font-size: 0.9rem;
        margin-bottom: 8px;
        color: var(--text);
    }

.input-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.input-prefix {
    position: absolute;
    left: 12px;
    color: var(--muted);
    font-weight: bold;
}

.input-suffix {
    position: absolute;
    right: 12px;
    color: var(--muted);
    font-size: 0.85rem;
}

.card input[type="number"], .card input[type="text"], .card select {
    width: 100%;
    padding: 10px 12px 10px 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
    background-color: var(--card);
    color: var(--text);
}

    .card input[type="number"].no-prefix {
        padding-left: 12px;
    }

.card select {
    padding-left: 12px;
    cursor: pointer;
}

    .card input:focus, .card select:focus {
        border-color: var(--primary);
    }

.card input[type="range"] {
    width: 100%;
    margin-top: 8px;
    accent-color: var(--primary);
}

.range-val {
    font-size: 0.85rem;
    color: var(--primary-dark);
    font-weight: bold;
    float: right;
}

/* Dashboard Output Stats Layouts */
.results-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 460px;
}

.main-stat {
    text-align: center;
    background: rgba(16, 185, 129, 0.04);
    padding: 20px;
    border-radius: 8px;
    border: 1px dashed var(--primary);
}

    .main-stat h2 {
        font-size: 2.4rem;
        color: var(--primary-dark);
        margin-top: 4px;
        font-weight: 700;
    }

/* Graphical Canvas Core */
.chart-box {
    position: relative;
    width: 100%;
    height: 250px;
    margin-top: auto;
    display: flex;
    align-items: flex-end;
    gap: 20px;
    padding-top: 20px;
    border-bottom: 2px solid var(--border);
}

.chart-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 100%;
    background: #3b82f6;
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease;
    min-height: 4px;
}

    .chart-bar.highlight {
        background: var(--primary);
    }

.chart-label {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 8px;
    font-weight: bold;
    text-align: center;
}

/* Right Column (Locked Sticky Ad space to combat Layout Shifts) */
.ad-space {
    position: sticky;
    top: 24px;
    background: var(--ad-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 300px;
    min-height: 600px;
    aspect-ratio: 300 / 600;
    overflow: hidden;
}

/* SEO content block container beneath tool window */
.seo-text-block {
    /*margin-top: 12px;
    padding: 24px;
    line-height: 1.7;*/

    /*background-color: var(--bg-card);*/
    padding: 32px;
    border-radius: 12px;
    margin-bottom: 40px;
    /*border: 1px solid rgba(0, 0, 0, 0.02);*/
    transition: background-color 0.3s ease;

}

    /*.seo-text-block h2 {
        font-size: 1.5rem;
        margin-bottom: 12px;
        color: var(--text);
    }*/

    .seo-text-block p {
        margin-bottom: 16px;
        color: var(--muted);
    }

    .seo-text-block h3 {
        font-size: 16px;
    }

/* Universal Responsive Grid Collapsing Rules */
@media (max-width: 1150px) {
    .inner-tool-split {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 850px) {
    .main-layout-grid {
        grid-template-columns: 1fr;
    }

    .ad-space {
        min-height: 250px;
        aspect-ratio: 300 / 250;
        width: 100%;
        position: static;
    }

    body {
        padding: 12px;
    }
}

/* ==========================================================================
   TOOL SPECIFIC SPECIFIC DESIGN OVERRIDES
   ========================================================================== */

/* --- TITLE IDENTIFIER: Subscription Cancellation Tracker --- */
.sub-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    background: var(--card-inner) !important;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

    .sub-row input[type="text"] {
        flex: 1;
        padding: 6px;
    }

    .sub-row input[type="number"] {
        width: 80px;
        padding: 6px 6px 6px 16px;
    }

.btn-toggle {
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8rem;
    cursor: pointer;
    color: white;
    min-width: 80px;
}

    .btn-toggle.cancel {
        background: var(--primary);
    }

    .btn-toggle.keep {
        background: var(--muted);
    }

/* --- TITLE IDENTIFIER: Debt Snowball vs. Avalanche Tracker --- */
.debt-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    background: var(--card-inner) !important;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    align-items: center;
}

    .debt-row input {
        padding: 6px !important;
    }

.btn-delete {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

/* --- TITLE IDENTIFIER: Crypto Profit Calculator --- */
.chart-bar.profit {
    background: var(--primary);
}

.chart-bar.loss {
    background: #ef4444;
}

/* --- TITLE IDENTIFIER: Car Lease vs. Buy Utility --- */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.sub-stat {
    background: var(--card-inner) !important;
    border: 1px solid var(--border) !important;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
}

    .sub-stat h3 {
        font-size: 1.4rem;
        color: var(--text);
        margin-top: 2px;
    }

.section-title {
    font-size: 0.85rem;
    font-weight: bold;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
    margin-bottom: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
