/* ===================================================
   Fuel Cost Calculator – Plugin Styles
   =================================================== */

/* Root scoped to the plugin wrapper */
.fcc-wrapper {
    --fcc-primary: #2563eb;
    --fcc-primary-light: rgba(37, 99, 235, 0.12);
    --fcc-accent: #f97316;
    --fcc-surface: #ffffff;
    --fcc-surface-alt: #f8fafc;
    --fcc-border: #e2e8f0;
    --fcc-text: #1e293b;
    --fcc-muted: #64748b;
    --fcc-error: #ef4444;
    --fcc-success: #10b981;
    --fcc-radius: 16px;
    --fcc-shadow: 0 4px 24px rgba(0,0,0,.08);

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 780px;
    margin: 0 auto;
    padding: 0;
    color: var(--fcc-text);
    box-sizing: border-box;
}

.fcc-wrapper *, .fcc-wrapper *::before, .fcc-wrapper *::after {
    box-sizing: inherit;
}

/* ── Header ── */
.fcc-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 28px 28px 20px;
    background: linear-gradient(135deg, var(--fcc-primary) 0%, #1d4ed8 100%);
    border-radius: var(--fcc-radius) var(--fcc-radius) 0 0;
    color: #fff;
}

.fcc-header-icon {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,.18);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fcc-header-icon svg {
    width: 28px;
    height: 28px;
    stroke: #fff;
}

.fcc-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: #fff;
    line-height: 1.2;
}

.fcc-subtitle {
    font-size: 0.875rem;
    margin: 0;
    color: rgba(255,255,255,.8);
}

/* ── Unit Toggle ── */
.fcc-unit-toggle {
    display: flex;
    background: var(--fcc-surface-alt);
    border-bottom: 1px solid var(--fcc-border);
    padding: 0;
}

.fcc-toggle-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--fcc-muted);
    transition: all .2s ease;
    position: relative;
}

.fcc-toggle-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--fcc-primary);
    transform: scaleX(0);
    transition: transform .2s ease;
}

.fcc-toggle-btn.fcc-active {
    color: var(--fcc-primary);
    background: rgba(37,99,235,.06);
}

.fcc-toggle-btn.fcc-active::after {
    transform: scaleX(1);
}

.fcc-toggle-btn:hover:not(.fcc-active) {
    background: rgba(0,0,0,.04);
}

/* ── Inputs ── */
.fcc-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--fcc-border);
    border-left: 1px solid var(--fcc-border);
    border-right: 1px solid var(--fcc-border);
}

.fcc-field {
    background: var(--fcc-surface);
    padding: 20px 20px 16px;
}

.fcc-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--fcc-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 10px;
}

.fcc-label svg {
    width: 16px;
    height: 16px;
    color: var(--fcc-primary);
    flex-shrink: 0;
}

.fcc-input-wrap {
    display: flex;
    align-items: center;
    border: 2px solid var(--fcc-border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color .2s;
    background: var(--fcc-surface);
}

.fcc-input-wrap:focus-within {
    border-color: var(--fcc-primary);
    box-shadow: 0 0 0 3px var(--fcc-primary-light);
}

.fcc-currency-prefix {
    padding: 0 4px 0 12px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--fcc-primary);
}

.fcc-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 11px 12px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--fcc-text);
    background: transparent;
    min-width: 0;
}

.fcc-input-currency {
    padding-left: 4px;
}

.fcc-input::-webkit-outer-spin-button,
.fcc-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.fcc-unit-badge {
    background: var(--fcc-surface-alt);
    border-left: 1px solid var(--fcc-border);
    padding: 8px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--fcc-muted);
    white-space: nowrap;
    align-self: stretch;
    display: flex;
    align-items: center;
}

/* ── Range Slider ── */
.fcc-range {
    width: 100%;
    margin: 10px 0 4px;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: linear-gradient(
        to right,
        var(--fcc-primary) 0%,
        var(--fcc-primary) var(--pct, 0%),
        var(--fcc-border) var(--pct, 0%),
        var(--fcc-border) 100%
    );
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.fcc-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--fcc-primary);
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
    transition: transform .15s;
}

.fcc-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.fcc-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--fcc-primary);
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
    cursor: pointer;
}

.fcc-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--fcc-muted);
}

/* ── Action Buttons ── */
.fcc-actions {
    display: flex;
    gap: 12px;
    padding: 20px;
    background: var(--fcc-surface);
    border: 1px solid var(--fcc-border);
    border-top: none;
}

.fcc-btn-calculate, .fcc-btn-reset {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 10px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
}

.fcc-btn-calculate {
    flex: 1;
    background: var(--fcc-primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37,99,235,.4);
}

.fcc-btn-calculate:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37,99,235,.5);
}

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

.fcc-btn-calculate svg, .fcc-btn-reset svg {
    width: 20px;
    height: 20px;
}

.fcc-btn-reset {
    background: var(--fcc-surface-alt);
    color: var(--fcc-muted);
    border: 2px solid var(--fcc-border);
    padding: 14px 20px;
}

.fcc-btn-reset:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: var(--fcc-error);
}

/* ── Results ── */
.fcc-results {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 0 0 var(--fcc-radius) var(--fcc-radius);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height .4s ease, opacity .3s ease;
}

.fcc-results.fcc-show {
    max-height: 500px;
    opacity: 1;
}

.fcc-results-inner {
    padding: 24px;
}

.fcc-result-main {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.fcc-result-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.fcc-result-details {
    display: flex;
    flex-direction: column;
}

.fcc-result-label {
    font-size: 0.8125rem;
    color: rgba(255,255,255,.55);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 4px;
}

.fcc-result-value {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
}

.fcc-result-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.fcc-result-card {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.fcc-card-icon {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.fcc-card-label {
    font-size: 0.7rem;
    color: rgba(255,255,255,.5);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.fcc-card-value {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

/* ── Error ── */
.fcc-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: var(--fcc-error);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 12px 16px;
    margin-top: 12px;
    display: none;
}

.fcc-error.fcc-visible {
    display: block;
}

/* ── Disclaimer ── */
.fcc-disclaimer {
    font-size: 0.75rem;
    color: var(--fcc-muted);
    margin: 12px 0 0;
    text-align: center;
    line-height: 1.5;
}

/* ── Animations ── */
@keyframes fccPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .6; }
}

.fcc-btn-calculate.fcc-calculating {
    animation: fccPulse .8s ease-in-out infinite;
    pointer-events: none;
}

/* ── Responsive ── */
@media (max-width: 580px) {
    .fcc-inputs {
        grid-template-columns: 1fr;
    }

    .fcc-result-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .fcc-header {
        padding: 20px 16px;
    }

    .fcc-title {
        font-size: 1.2rem;
    }

    .fcc-result-value {
        font-size: 1.6rem;
    }

    .fcc-actions {
        flex-direction: column;
    }

    .fcc-btn-calculate, .fcc-btn-reset {
        width: 100%;
    }
}

@media (max-width: 360px) {
    .fcc-result-grid {
        grid-template-columns: 1fr 1fr;
    }
}
