/* SpotVaiFix specific styles */

.input-group {
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--k-text-soft);
}

.input-group input,
.input-group select {
    width: 100%;
}

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

.result-box {
    padding: 0.8rem;
    border-radius: 12px;
    background: var(--k-card-alt);
    border: 1px solid var(--k-border);
    text-align: center;
}

.spot-result {
    border-left: 4px solid var(--k-accent);
}

.spot-result-alt {
    border-left: 4px solid #f59e0b;
    /* Orange for historical average */
}

.fixed-result {
    border-left: 4px solid #8b5cf6;
    /* Violet for fixed to match chart */
}

.result-label {
    font-size: 0.85rem;
    color: var(--k-text-soft);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--k-text);
}

.result-subtext {
    font-size: 0.9rem;
    color: var(--k-text-soft);
    margin-top: 0.2rem;
}

.result-warning {
    font-size: 0.8rem;
    color: #dc2626;
    margin-top: 0.5rem;
    font-weight: 600;
}

.result-info {
    font-size: 0.8rem;
    color: #059669;
    margin-top: 0.5rem;
    font-weight: 600;
}

.input-hint {
    font-size: 0.75rem;
    color: var(--k-text-soft);
    font-style: italic;
    margin-top: 0.2rem;
    display: block;
}

.verdict-box {
    margin-top: 0;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    background: transparent;
    color: var(--k-text);
    border: 1px solid transparent;
}

.verdict-box.cheaper-fixed {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.price-info-box {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--k-border);
}

.current-price-hero {
    margin-top: 1rem;
    text-align: center;
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--k-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.hero-price {
    font-size: 2.2rem;
    font-weight: 800;
    color: #1a1a1b;
    /* Tumma navy/musta */
    letter-spacing: -0.02em;
}

.hero-unit {
    font-size: 1.4rem;
    font-weight: 600;
    color: #4b5563;
    margin-left: 0.4rem;
}

.current-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--k-accent-strong);
    background: #fffbeb;
    padding: 0.8rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(223, 175, 43, 0.2);
}

#currentSpotPriceValue {
    font-size: 1.2rem;
}

/* Visual Comparison Chart (CSS Based) */
.comparison-graph {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.graph-bar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.graph-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--k-text-soft);
}

.graph-bar-container {
    height: 24px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
    width: 100%;
}

.graph-bar {
    height: 100%;
    transition: width 0.5s ease-out;
}

.spot-bar {
    background: var(--k-accent);
}

.spot-bar-alt {
    background: #f59e0b;
    /* Orange for historical */
}

.fixed-bar {
    background: #8b5cf6;
    /* Violet to match chart */
}

.results-card h2 {
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--k-accent);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.chart-card {
    background: var(--k-card);
    border-radius: var(--k-radius);
    padding: 1.5rem;
    box-shadow: var(--k-shadow);
    border: 1px solid rgba(229, 231, 235, 0.8);
    width: 100%;
    box-sizing: border-box;
    margin-top: 2rem;
}

.chart-container {
    position: relative;
    height: 400px;
    /* Hieman isompi kun leveä */
    width: 100%;
}

input[type="date"] {
    padding: 0.65rem 0.9rem;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: var(--k-text);
    font-size: 0.95rem;
    max-width: 100%;
    box-sizing: border-box;
}

/* Explanation Box */
.explanation-box {
    margin-top: 1rem;
    padding: 0.8rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.explanation-box h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--k-text);
    margin: 0 0 0.8rem 0;
}

.explanation-box p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--k-text-soft);
    margin: 0 0 0.6rem 0;
}

.explanation-box p:last-child {
    margin-bottom: 0;
}

/* Chart Explanation (below chart) */
.chart-explanation {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid var(--k-accent);
}

.chart-explanation p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--k-text-soft);
    margin: 0;
}

.chart-explanation strong {
    color: var(--k-text);
}

#chartDateRange {
    font-weight: 600;
    color: var(--k-accent-strong);
}

.result-date-range {
    font-size: 0.8rem;
    color: var(--k-text-soft);
    margin-top: 0.2rem;
    font-weight: 500;
}

.chart-date-badge {
    background: #f1f5f9;
    padding: 0.3rem 0.8rem;
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--k-text);
    border: 1px solid #e2e8f0;
}

/* Footer Styles */
.explanation-box {
    margin-top: 1rem;
    padding: 0.8rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.explanation-box h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--k-text);
    margin: 0 0 0.8rem 0;
}

.explanation-box p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--k-text-soft);
    margin: 0 0 0.6rem 0;
}

.explanation-box p:last-child {
    margin-bottom: 0;
}

/* Footer Styles */
.app-footer {
    margin-top: 3rem;
    padding: 2rem 0 1rem 0;
    border-top: 2px solid var(--k-border);
}

.app-footer h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--k-text);
    margin: 0 0 1.5rem 0;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.source-section h4,
.disclaimer-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--k-text);
    margin: 0 0 0.8rem 0;
}

.source-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.source-section li {
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--k-text-soft);
    margin-bottom: 0.5rem;
}

.source-section a {
    color: var(--k-accent-strong);
    text-decoration: none;
    font-weight: 500;
}

.source-section a:hover {
    text-decoration: underline;
}

.disclaimer-section p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--k-text-soft);
    margin: 0;
}

/* Inherit and adjust Saffron accents if needed */
:root {
    --fixed-blue: #3b82f6;
}

/* Align cards to equal height (both top and bottom aligned) */

/* Override grid alignment to stretch columns to equal height */
/* Override alignment to stretch columns to equal height */
.fiber-layout {
    display: flex;
    align-items: stretch;
    gap: 2rem;
}

.fiber-layout>div {
    display: flex;
    flex-direction: column;
}

.fiber-layout>div:first-child {
    flex: 1;
}

.fiber-layout>div:last-child {
    flex: 0 0 32%;
    /* Kapeampi oikea sarake, n. 1/3 leveydestä */
    min-width: 300px;
}

.fiber-layout .card,
.results-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    height: 100%;
    /* Ensure it fills parent */
    justify-content: flex-start;
    /* Keep content at top */
}

/* Apply fade ONLY to the left card (inputs) */
.fiber-layout .card {
    mask-image: linear-gradient(to bottom, black 95%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 95%, transparent 100%);
}

/* Uusi chart-header layout */
.chart-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.chart-header-row h2 {
    white-space: nowrap;
    margin-right: auto;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.2rem 0.4rem;
    border-radius: 8px;
    border: 1px solid var(--k-border);
}

.chart-date-input {
    border: 1px solid transparent;
    background: transparent;
    font-size: 0.85rem;
    color: var(--k-text);
    padding: 0.2rem 0;
    width: 90px;
    /* Compact width */
    font-family: inherit;
    cursor: pointer;
    text-align: center;
}

.chart-date-input:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--k-accent);
    border-radius: 4px;
}

.date-sep {
    color: var(--k-text-soft);
    font-weight: 500;
}

.refresh-button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--k-border);
    color: var(--k-text);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    margin-left: 0.5rem;
    transition: all 0.2s;
    flex-shrink: 0;
    /* Estää painikkeen kasaan puristumisen */
    width: auto;
    padding: 0 1rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.refresh-button:hover {
    background: var(--k-accent);
    border-color: var(--k-accent);
    color: #fff;
}

/* Header alignment fixes */
.card h2,
.results-card h2 {
    margin-top: 0;
    padding-top: 0;
    margin-bottom: 0.8rem;
}

.card,
.results-card {
    padding: 1.5rem;
}

/* Verdict box visual fix */
.verdict-box {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
    text-align: left;
    font-size: 1rem;
}

.verdict-box.spot-win {
    background: #fffbeb;
    /* Light yellow bg */
    color: #b45309;
    /* Dark amber text */
    border: 1px solid #fcd34d;
    /* Yellow border */
}

.verdict-box.fixed-win {
    background: #f5f3ff;
    /* Light violet bg */
    color: #7c3aed;
    /* Dark violet text */
    border: 1px solid #c4b5fd;
    /* Violet border */
}

/* Custom Select Styling */
.chart-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    background-color: transparent;
    border: 1px solid transparent;
    border-radius: 6px;

    padding: 0.2rem 1.8rem 0.2rem 0.6rem;

    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--k-text);

    cursor: pointer;

    /* Custom SVG Arrow (Gray) */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.4rem center;
    background-size: 1rem;

    transition: all 0.2s;
    margin-right: 0.5rem;
}

.chart-select:hover {
    background-color: #ffffff;
    border-color: #e2e8f0;
    color: #1e293b !important;
    /* Force dark text on white hover */
}

.chart-select:focus {
    outline: none;
    background-color: #ffffff;
    border-color: var(--k-accent);
    box-shadow: 0 0 0 2px rgba(223, 175, 43, 0.1);
    color: #1e293b !important;
    /* Force dark text on white focus */
}

/* 
   FLATPICKR FIX (Comprehensive): 
   Force dark colors on all specific elements to handle inheritance issues.
*/
.flatpickr-calendar .flatpickr-header,
.flatpickr-calendar .flatpickr-header * {
    color: #0f172a !important;
    fill: #0f172a !important;
}

/* Explicit Month selector */
.flatpickr-calendar .flatpickr-current-month .cur-month {
    color: #0f172a !important;
    font-weight: 700 !important;
}

/* Explicit Year Input */
.flatpickr-calendar .flatpickr-current-month input.cur-year {
    color: #0f172a !important;
    font-weight: 700 !important;
}

/* Navigation Arrows (Prev/Next Month) */
.flatpickr-calendar .flatpickr-prev-month,
.flatpickr-calendar .flatpickr-next-month {
    color: #0f172a !important;
    fill: #0f172a !important;
}

.flatpickr-calendar .flatpickr-prev-month svg,
.flatpickr-calendar .flatpickr-next-month svg {
    fill: #0f172a !important;
    stroke: #0f172a !important;
}

/* Year Spinner Arrows (Triangles) - The border trick & Persistent Visibility */
.flatpickr-calendar .flatpickr-current-month .numInputWrapper span.arrowUp,
.flatpickr-calendar .flatpickr-current-month .numInputWrapper span.arrowDown {
    opacity: 1 !important;
    display: block !important;
}

.flatpickr-calendar .flatpickr-current-month .numInputWrapper span.arrowUp:after {
    border-bottom-color: #0f172a !important;
}

.flatpickr-calendar .flatpickr-current-month .numInputWrapper span.arrowDown:after {
    border-top-color: #0f172a !important;
}

/* Hover states for spinner arrows to ensure they stay visible */
.flatpickr-calendar .flatpickr-current-month .numInputWrapper span.arrowUp:hover:after {
    border-bottom-color: #000000 !important;
}

.flatpickr-calendar .flatpickr-current-month .numInputWrapper span.arrowDown:hover:after {
    border-top-color: #000000 !important;
}