/* ============================================================
   TrueLease Calculator — CSS
   Design: Soft fintech / Wise-inspired
   ============================================================ */

/* --- Variables --- */
.tlc-wrap {
    --tlc-bg:          #f7f8fc;
    --tlc-surface:     #ffffff;
    --tlc-surface-2:   #f0f2f8;
    --tlc-border:      #e2e6f0;
    --tlc-blue:        #3b6ef8;
    --tlc-blue-dark:   #2852d9;
    --tlc-blue-light:  #eef2ff;
    --tlc-green:       #18b481;
    --tlc-green-light: #e6f9f3;
    --tlc-orange:      #f4831f;
    --tlc-orange-light:#fff4eb;
    --tlc-gray-1:      #111827;
    --tlc-gray-2:      #374151;
    --tlc-gray-3:      #6b7280;
    --tlc-gray-4:      #9ca3af;
    --tlc-radius:      14px;
    --tlc-radius-sm:   8px;
    --tlc-shadow:      0 2px 12px rgba(59,110,248,.08), 0 1px 3px rgba(0,0,0,.06);
    --tlc-shadow-lg:   0 8px 32px rgba(59,110,248,.12), 0 2px 8px rgba(0,0,0,.08);
    --tlc-font:        'Segoe UI', system-ui, -apple-system, sans-serif;
    --tlc-mono:        'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    --tlc-transition:  .18s cubic-bezier(.4,0,.2,1);

    font-family:    var(--tlc-font);
    background:     var(--tlc-bg);
    color:          var(--tlc-gray-1);
    border-radius:  var(--tlc-radius);
    padding:        32px 24px;
    max-width:      1120px;
    margin:         0 auto 48px;
    box-sizing:     border-box;
}

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

/* --- Header --- */
.tlc-header {
    text-align:    center;
    margin-bottom: 36px;
}
.tlc-header__badge {
    display:          inline-block;
    background:       var(--tlc-blue-light);
    color:            var(--tlc-blue);
    font-size:        11px;
    font-weight:      700;
    letter-spacing:   .06em;
    text-transform:   uppercase;
    padding:          4px 12px;
    border-radius:    100px;
    margin-bottom:    12px;
}
.tlc-header__title {
    font-size:   clamp(22px, 4vw, 34px);
    font-weight: 800;
    color:       var(--tlc-gray-1);
    margin:      0 0 10px;
    line-height: 1.15;
}
.tlc-header__title span {
    color: var(--tlc-blue);
}
.tlc-header__sub {
    color:      var(--tlc-gray-3);
    font-size:  15px;
    max-width:  520px;
    margin:     0 auto;
    line-height: 1.6;
}

/* --- Ad slots (invisible until populated) --- */
.tlc-ad-slot { min-height: 0; }
.tlc-ad-slot:not(:empty) {
    min-height:    90px;
    margin:        20px 0;
    text-align:    center;
}

/* --- Main layout --- */
.tlc-main {
    display:               grid;
    grid-template-columns: 300px 1fr;
    gap:                   28px;
    align-items:           start;
}

/* --- Inputs panel --- */
.tlc-inputs {
    background:    var(--tlc-surface);
    border:        1px solid var(--tlc-border);
    border-radius: var(--tlc-radius);
    padding:       24px 20px;
    box-shadow:    var(--tlc-shadow);
    position:      sticky;
    top:           24px;
}

.tlc-section-label {
    font-size:     11px;
    font-weight:   700;
    letter-spacing:.08em;
    text-transform:uppercase;
    color:         var(--tlc-gray-4);
    margin-bottom: 14px;
}
.tlc-section-label--lg {
    font-size:   13px;
    color:       var(--tlc-gray-3);
    margin-bottom:16px;
}

.tlc-field {
    margin-bottom: 16px;
}
.tlc-field label {
    display:       block;
    font-size:     13px;
    font-weight:   600;
    color:         var(--tlc-gray-2);
    margin-bottom: 6px;
}
.tlc-input-wrap {
    display:       flex;
    align-items:   center;
    border:        1.5px solid var(--tlc-border);
    border-radius: var(--tlc-radius-sm);
    overflow:      hidden;
    transition:    border-color var(--tlc-transition), box-shadow var(--tlc-transition);
    background:    var(--tlc-surface);
}
.tlc-input-wrap:focus-within {
    border-color: var(--tlc-blue);
    box-shadow:   0 0 0 3px rgba(59,110,248,.12);
}
.tlc-input-prefix,
.tlc-input-suffix {
    padding:     0 10px;
    font-size:   13px;
    font-weight: 600;
    color:       var(--tlc-gray-4);
    background:  var(--tlc-surface-2);
    height:      38px;
    display:     flex;
    align-items: center;
    flex-shrink: 0;
}
.tlc-input-prefix { border-right: 1.5px solid var(--tlc-border); }
.tlc-input-suffix { border-left:  1.5px solid var(--tlc-border); }

.tlc-inputs input[type="number"],
.tlc-inputs input[type="text"],
.tlc-inputs select {
    width:      100%;
    height:     38px;
    border:     1.5px solid var(--tlc-border);
    border-radius: var(--tlc-radius-sm);
    padding:    0 12px;
    font-size:  14px;
    color:      var(--tlc-gray-1);
    background: var(--tlc-surface);
    outline:    none;
    transition: border-color var(--tlc-transition), box-shadow var(--tlc-transition);
    -moz-appearance: textfield;
    appearance: textfield;
}
.tlc-input-wrap input[type="number"] {
    border: none;
    border-radius: 0;
    flex: 1;
    height: 38px;
}
.tlc-inputs input[type="number"]::-webkit-outer-spin-button,
.tlc-inputs input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

.tlc-inputs input:focus,
.tlc-inputs select:focus {
    border-color: var(--tlc-blue);
    box-shadow:   0 0 0 3px rgba(59,110,248,.12);
    outline:      none;
}
.tlc-inputs select {
    cursor: pointer;
}

.tlc-field-note {
    display:    block;
    font-size:  11px;
    color:      var(--tlc-gray-4);
    margin-top: 4px;
    line-height:1.4;
}

/* Slider */
.tlc-slider {
    -webkit-appearance: none;
    appearance:         none;
    width:              100%;
    height:             6px;
    background:         var(--tlc-border);
    border-radius:      100px;
    outline:            none;
    cursor:             pointer;
    margin:             8px 0 4px;
}
.tlc-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance:         none;
    width:              20px;
    height:             20px;
    border-radius:      50%;
    background:         var(--tlc-blue);
    box-shadow:         0 2px 6px rgba(59,110,248,.35);
    cursor:             grab;
    transition:         transform var(--tlc-transition);
}
.tlc-slider::-webkit-slider-thumb:active { transform: scale(1.18); }
.tlc-slider::-moz-range-thumb {
    width:        20px;
    height:       20px;
    border:       none;
    border-radius:50%;
    background:   var(--tlc-blue);
    cursor:       grab;
}
.tlc-slider-labels {
    display:         flex;
    justify-content: space-between;
    font-size:       11px;
    color:           var(--tlc-gray-4);
}

/* Toggle */
.tlc-toggle-label {
    display:     flex !important;
    align-items: center;
    gap:         10px;
    cursor:      pointer;
    font-weight: 500 !important;
}
.tlc-toggle-input { position: absolute; opacity: 0; width: 0; height: 0; }
.tlc-toggle-track {
    width:         42px;
    height:        24px;
    background:    var(--tlc-border);
    border-radius: 100px;
    position:      relative;
    flex-shrink:   0;
    transition:    background var(--tlc-transition);
}
.tlc-toggle-track::after {
    content:       '';
    position:      absolute;
    top:           3px;
    left:          3px;
    width:         18px;
    height:        18px;
    border-radius: 50%;
    background:    #fff;
    box-shadow:    0 1px 4px rgba(0,0,0,.18);
    transition:    transform var(--tlc-transition);
}
.tlc-toggle-input:checked + .tlc-toggle-track {
    background: var(--tlc-blue);
}
.tlc-toggle-input:checked + .tlc-toggle-track::after {
    transform: translateX(18px);
}

/* Recalc button */
.tlc-recalc-btn {
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             8px;
    width:           100%;
    height:          42px;
    background:      var(--tlc-blue);
    color:           #fff;
    border:          none;
    border-radius:   var(--tlc-radius-sm);
    font-size:       14px;
    font-weight:     700;
    cursor:          pointer;
    margin-top:      20px;
    transition:      background var(--tlc-transition), transform var(--tlc-transition), box-shadow var(--tlc-transition);
    box-shadow:      0 2px 8px rgba(59,110,248,.25);
}
.tlc-recalc-btn:hover {
    background:  var(--tlc-blue-dark);
    box-shadow:  0 4px 14px rgba(59,110,248,.35);
    transform:   translateY(-1px);
}
.tlc-recalc-btn:active { transform: translateY(0); }

/* --- Result Cards --- */
.tlc-cards {
    display:               grid;
    grid-template-columns: repeat(3, 1fr);
    gap:                   16px;
    margin-bottom:         28px;
}

.tlc-card {
    background:    var(--tlc-surface);
    border:        1.5px solid var(--tlc-border);
    border-radius: var(--tlc-radius);
    padding:       22px 18px 18px;
    box-shadow:    var(--tlc-shadow);
    position:      relative;
    transition:    box-shadow var(--tlc-transition), transform var(--tlc-transition), border-color var(--tlc-transition);
}
.tlc-card:hover {
    box-shadow: var(--tlc-shadow-lg);
    transform:  translateY(-2px);
}
.tlc-card__icon {
    font-size:     22px;
    margin-bottom: 8px;
    display:       block;
}
.tlc-card__label {
    font-size:     13px;
    font-weight:   700;
    color:         var(--tlc-gray-3);
    text-transform:uppercase;
    letter-spacing:.05em;
    margin-bottom: 4px;
}
.tlc-card__badge {
    position:      absolute;
    top:           14px;
    right:         14px;
    font-size:     10px;
    font-weight:   800;
    letter-spacing:.05em;
    text-transform:uppercase;
    padding:       3px 9px;
    border-radius: 100px;
    display:       none;
}
.tlc-card__badge.visible { display: block; }
.tlc-card__badge--winner {
    background: var(--tlc-green-light);
    color:      var(--tlc-green);
}
.tlc-card__badge--runner {
    background: var(--tlc-orange-light);
    color:      var(--tlc-orange);
}

.tlc-card__stat { margin: 12px 0 0; }
.tlc-card__stat-label {
    font-size:  11px;
    color:      var(--tlc-gray-4);
    display:    block;
    margin-bottom:2px;
}
.tlc-card__stat-val {
    font-size:   20px;
    font-weight: 800;
    color:       var(--tlc-gray-1);
    font-variant-numeric: tabular-nums;
}
.tlc-card__stat-val--accent { color: var(--tlc-blue); }

.tlc-card__divider {
    border:  none;
    border-top: 1px solid var(--tlc-border);
    margin: 16px 0 12px;
}
.tlc-card__total-label {
    font-size:  11px;
    color:      var(--tlc-gray-4);
    margin-bottom:4px;
}
.tlc-card__total {
    font-size:   24px;
    font-weight: 900;
    color:       var(--tlc-gray-1);
    font-variant-numeric: tabular-nums;
}
.tlc-card__sub {
    font-size:  12px;
    color:      var(--tlc-green);
    font-weight:600;
    margin-top: 4px;
}

/* Winner card highlight */
.tlc-card--winner-highlight {
    border-color: var(--tlc-green);
    background:   linear-gradient(135deg, #fff 0%, #edfbf5 100%);
}
.tlc-card--winner-highlight .tlc-card__total { color: var(--tlc-green); }

/* --- Comparison table --- */
.tlc-comparison {
    background:    var(--tlc-surface);
    border:        1px solid var(--tlc-border);
    border-radius: var(--tlc-radius);
    padding:       24px 22px;
    box-shadow:    var(--tlc-shadow);
    margin-bottom: 24px;
    overflow:      hidden;
}
.tlc-table-wrap { overflow-x: auto; }
.tlc-table {
    width:           100%;
    border-collapse: collapse;
    font-size:       13.5px;
}
.tlc-table th,
.tlc-table td {
    padding:      10px 14px;
    text-align:   left;
    border-bottom:1px solid var(--tlc-border);
}
.tlc-table th {
    font-weight:    700;
    font-size:      12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color:          var(--tlc-gray-3);
    background:     var(--tlc-surface-2);
}
.tlc-table th:first-child { border-radius: var(--tlc-radius-sm) 0 0 0; }
.tlc-table th:last-child  { border-radius: 0 var(--tlc-radius-sm) 0 0; }
.tlc-table tbody tr:hover td { background: var(--tlc-blue-light); }
.tlc-table td:first-child  { font-weight: 600; color: var(--tlc-gray-2); }
.tlc-table td.winner-cell  { color: var(--tlc-green); font-weight: 700; }
.th-novated { color: var(--tlc-blue) !important; }
.th-loan    { color: var(--tlc-orange) !important; }
.th-cash    { color: var(--tlc-green) !important; }

/* --- Insights --- */
.tlc-insights {
    background:    linear-gradient(135deg, var(--tlc-blue-light) 0%, #fff 100%);
    border:        1.5px solid rgba(59,110,248,.18);
    border-radius: var(--tlc-radius);
    padding:       20px 22px;
    margin-bottom: 24px;
}
.tlc-insights__header {
    display:       flex;
    align-items:   center;
    gap:           8px;
    font-weight:   700;
    font-size:     14px;
    color:         var(--tlc-blue);
    margin-bottom: 12px;
}
.tlc-insights__list {
    list-style:  none;
    padding:     0;
    margin:      0;
    display:     flex;
    flex-direction: column;
    gap:         8px;
}
.tlc-insights__list li {
    font-size:   13.5px;
    color:       var(--tlc-gray-2);
    padding-left:18px;
    position:    relative;
    line-height: 1.5;
}
.tlc-insights__list li::before {
    content:  '→';
    position: absolute;
    left:     0;
    color:    var(--tlc-blue);
    font-weight:700;
}

/* --- Disclaimer --- */
.tlc-disclaimer {
    font-size:     11.5px;
    color:         var(--tlc-gray-4);
    background:    var(--tlc-surface-2);
    border-radius: var(--tlc-radius-sm);
    padding:       12px 16px;
    margin:        20px 0 0;
    line-height:   1.55;
    border:        1px solid var(--tlc-border);
}

/* --- Affiliate slot (invisible until used) --- */
.tlc-affiliate-slot:not(:empty) {
    margin: 20px 0;
    padding: 16px;
    border: 1px dashed var(--tlc-border);
    border-radius: var(--tlc-radius-sm);
    text-align: center;
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes tlc-fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.tlc-card {
    animation: tlc-fade-up .35s ease both;
}
.tlc-card:nth-child(1) { animation-delay: .04s; }
.tlc-card:nth-child(2) { animation-delay: .10s; }
.tlc-card:nth-child(3) { animation-delay: .16s; }

.tlc-card__stat-val,
.tlc-card__total {
    transition: color .22s ease;
}

/* ============================================================
   Responsive — Tablet
   ============================================================ */
@media (max-width: 900px) {
    .tlc-main {
        grid-template-columns: 1fr;
    }
    .tlc-inputs {
        position: static;
    }
    .tlc-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================================
   Responsive — Mobile
   ============================================================ */
@media (max-width: 600px) {
    .tlc-wrap { padding: 20px 14px; }

    .tlc-cards {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .tlc-table th, .tlc-table td {
        padding: 8px 10px;
        font-size: 12.5px;
    }

    /* Mobile: label-value stack for table */
    .tlc-table thead { display: none; }
    .tlc-table tbody tr {
        display:       block;
        border:        1px solid var(--tlc-border);
        border-radius: var(--tlc-radius-sm);
        margin-bottom: 10px;
        overflow:      hidden;
    }
    .tlc-table tbody td {
        display:       flex;
        justify-content:space-between;
        align-items:   center;
        border-bottom: 1px solid var(--tlc-border);
        padding:       8px 12px;
        font-size:     13px;
    }
    .tlc-table tbody td::before {
        content:     attr(data-label);
        font-weight: 700;
        color:       var(--tlc-gray-3);
        font-size:   11px;
        text-transform:uppercase;
        letter-spacing:.04em;
        margin-right:8px;
        flex-shrink: 0;
    }
    .tlc-table tbody td:last-child { border-bottom: none; }
}

@media (max-width: 380px) {
    .tlc-header__title { font-size: 20px; }
    .tlc-recalc-btn    { font-size: 13px; }
}
