/* =========================================================
   Calculator Engine — calculator.css  v2.3
   Self-contained glassmorphism.
   The wrapper provides its own dark gradient background so
   the glass effect works on any page color.
   ========================================================= */

:root {
    --calc-accent:     #4f86f7;
    --calc-accent-rgb: 79, 134, 247;
    --calc-radius:     0px;
    --calc-radius-sm:  10px;
}

/* ── Outer wrapper — owns its own background ── */
.calc-wrapper {
    max-width: 700px;
    margin: 0 auto;
    padding: 36px;
    border-radius: var(--calc-radius);
    box-sizing: border-box;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;

    /* Self-contained dark gradient */
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 55%, #0f172a 100%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.30), 0 4px 16px rgba(0, 0, 0, 0.20);
    color: #ffffff;
}

/* ── Inner glass card that sits on top of the gradient ── */
.calc-inner {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--calc-radius);
    padding: 28px;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

/* ── Inputs grid ── */
.calc-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 28px;
}

@media (max-width: 580px) {
    .calc-wrapper { padding: 20px; }
    .calc-inner   { padding: 20px; }
    .calc-inputs  { grid-template-columns: 1fr; }
}

/* ── Input group ── */
.calc-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.calc-input-group label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255, 255, 255, 0.65);
}

.calc-input-hint {
    font-size: 0.70rem;
    color: rgba(255, 255, 255, 0.60);
    line-height: 1.4;
}

/* ── Number inputs ── */
.calc-input-group input[type="number"] {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 13px;
    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: var(--calc-radius-sm);
    font-family: inherit;
    font-size: 0.9375rem;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.10);
    -moz-appearance: textfield;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.calc-input-group input[type="number"]::-webkit-outer-spin-button,
.calc-input-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.calc-input-group input[type="number"]:focus {
    border-color: rgba(110, 181, 255, 0.65);
    box-shadow: 0 0 0 3px rgba(79, 134, 247, 0.22);
    outline: none;
}

/* ── Select dropdowns ── */
.calc-input-group select {
    width: 100%;
    box-sizing: border-box;
    padding: 3px 16px 3px 13px;
    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: var(--calc-radius-sm);
    font-family: inherit;
    font-size: 0.9375rem;
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.10);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='rgba(255,255,255,0.5)' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.calc-input-group select option {
    background: #1e2a3a;
    color: #ffffff;
}

.calc-input-group select:focus {
    border-color: rgba(110, 181, 255, 0.65);
    box-shadow: 0 0 0 3px rgba(79, 134, 247, 0.22);
    outline: none;
}

/* ── Prefix / suffix ── */
.calc-affix-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.calc-prefix,
.calc-suffix {
    position: absolute;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.9rem;
    pointer-events: none;
    user-select: none;
    z-index: 1;
}

.calc-prefix { left: 12px; }
.calc-suffix { right: 12px; }

.calc-affix-wrap input[type="number"] {
    flex: 1;
    padding-left: 24px;
}

/* ── Result card ── */
.calc-result {
    background: rgba(79, 134, 247, 0.18);
    border: 1px solid rgba(79, 134, 247, 0.40);
    border-radius: var(--calc-radius);
    padding: 26px 24px;
    text-align: center;
    margin-bottom: 16px;
}

.calc-result-label {
    font-size: 0.70rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #6eb5ff;
    margin-bottom: 8px;
}

.calc-result-value {
    font-size: clamp(2.4rem, 6.5vw, 3.4rem);
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
    text-shadow: 0 2px 20px rgba(79, 134, 247, 0.45);
}

/* ── Narrative callout ── */
.calc-narrative {
    background: rgba(255, 255, 255, 0.06);
    border-left: 3px solid #4f86f7;
    border-radius: 0 var(--calc-radius-sm) var(--calc-radius-sm) 0;
    padding: 13px 16px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.80);
    margin-bottom: 0px;
    line-height: 1.65;
}

.calc-narrative strong {
    color: #ffffff;
}

/* ── Chart ── */
.calc-chart-wrap {
    max-width: 520px;
    margin: 0 auto 0px;
}

/* ── Breakdown ── */
.calc-breakdown {
    border-top: 1px solid rgba(255, 255, 255, 0.10);
    padding-top: 0px;
}

.calc-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 4px;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.calc-breakdown-row--highlight {
    color: #ffffff;
    font-weight: 700;
    font-size: 0.925rem;
    padding-top: 13px;
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.calc-breakdown-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 6px 0;
}

.calc-breakdown-amount {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* ── Error ── */
.calc-error {
    color: #fca5a5;
    font-size: 0.875rem;
    padding: 12px 16px;
    background: rgba(220, 38, 38, 0.15);
    border-radius: var(--calc-radius-sm);
    border: 1px solid rgba(220, 38, 38, 0.30);
}

/* ── Input alignment fix ──
   Align all inputs to the bottom of their group so hint text
   doesn't push inputs out of row alignment. */
.calc-inputs {
    align-items: end;
    }
    
    /* ── Light reflection animation ──
   A soft diagonal light sweep passes over the card on load
   and repeats every 6 seconds. */
.calc-wrapper {
    position: relative;
    overflow: hidden;
}
 
.calc-wrapper::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 60%;
    height: 300%;
    background: linear-gradient(
        105deg,
        transparent 20%,
        rgba(255, 255, 255, 0.055) 40%,
        rgba(255, 255, 255, 0.13) 50%,
        rgba(255, 255, 255, 0.055) 60%,
        transparent 80%
    );
    transform: skewX(-15deg);
    animation: calc-light-sweep 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}
 
/* Make sure all content sits above the reflection layer */
.calc-inner {
    position: relative;
    z-index: 1;
}
 
@keyframes calc-light-sweep {
    0%   { left: -100%; opacity: 0; }
    5%   { opacity: 1; }
    40%  { left: 160%;  opacity: 1; }
    45%  { opacity: 0; }
    100% { left: 160%;  opacity: 0; }
}