/* ------------------------------------------------------------
   Base font sizing (unchanged)
------------------------------------------------------------ */
html {
    font-size: 14px;
    height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

/* ------------------------------------------------------------
   Body + layout fix (IMPORTANT)
------------------------------------------------------------ */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
}

/*
   This class must wrap header + main
   Footer will sit below it
*/
.app-shell {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

/*
   Main content expands to fill space
*/
main {
    flex: 1 0 auto;
}

/*
   Footer sticks to bottom
*/
footer {
    flex-shrink: 0;
}

/* ------------------------------------------------------------
   Bootstrap focus styles (unchanged)
------------------------------------------------------------ */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ------------------------------------------------------------
   Floating label tweaks (unchanged)
------------------------------------------------------------ */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ------------------------------------------------------------
   Busy overlay (unchanged)
------------------------------------------------------------ */
.busy-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.35);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.busy-box {
    background: white;
    padding: 2rem 3rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 10px 35px rgba(0,0,0,0.25);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 6px solid #ddd;
    border-top-color: #0078D4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.busy-message {
    font-size: 1.1rem;
    font-weight: 500;
}

.results-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.results-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.5rem 1rem;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Stack vertically on smaller screens */
@media (max-width: 900px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

.panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.price-slider {
    width: 100%;
    max-width: 420px;
}

.metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.25rem;
}

.chart-wrapper {
    position: relative;
    width: 100%;
    min-width: 320px; /* acceptable minimum */
    height: 360px;
}


/* Stack only when truly narrow */
@media (max-width: 900px) {
    .results-main {
        grid-template-columns: 1fr;
    }
}


/* ===== Controls ===== */
.price-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 520px;
}

.price-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.25rem;
}

/* ===== Charts ===== */
.chart-container {
    position: relative;
    width: 100%;
    height: 360px;
}


/* ===== Page wrapper ===== */
.results-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== Summary text: vertical stack ===== */
.results-summary {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* ===== Two-column body ===== */
.results-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Stack only on narrow screens */
@media (max-width: 900px) {
    .results-body {
        grid-template-columns: 1fr;
    }
}

/* ===== Columns ===== */
.left-column,
.right-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ===== Controls ===== */
.price-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 480px;
}

/* ===== Charts ===== */
.chart-box {
    position: relative;
    width: 100%;
    height: 380px; /* SAME HEIGHT BOTH SIDES */
}

    /* Ensure canvas fills container */
    .chart-box canvas {
        width: 100% !important;
        height: 100% !important;
    }
.settings-container {
    max-width: 880px;
    margin: 0 auto;
}
.rule-inactive {
    background-color: #f8f9fa;
    color: #6c757d;
}

    .rule-inactive td {
        font-style: italic;
    }