/* ── Celsius to Fahrenheit Converter ───────────────────────────── */

.ctf-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 900px;
    margin: 2rem auto;
    background: #ecfeff;
    border: 1.5px solid #67e8f9;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 32px rgba(8,145,178,0.13);
    color: #0f172a;
    box-sizing: border-box;
}
.ctf-wrap *, .ctf-wrap *::before, .ctf-wrap *::after { box-sizing: border-box; }

/* ── Header ── */
.ctf__header {
    background: linear-gradient(135deg, #0c1a2e 0%, #0c4a6e 35%, #0369a1 65%, #0891b2 85%, #06b6d4 100%);
    padding: clamp(1.4rem, 4vw, 2rem) clamp(1.2rem, 4vw, 2rem);
}
.ctf__header h2 {
    font-size: clamp(1.3rem, 4vw, 1.8rem) !important;
    font-weight: 900 !important; color: #fff !important;
    margin: 0 0 0.25rem 0 !important; letter-spacing: -0.01em;
}
.ctf__header p { font-size: 0.9rem; color: #bae6fd; margin: 0; }

/* ── Body ── */
.ctf__body {
    display: flex;
    align-items: flex-start;
}
.ctf__card {
    flex: 1;
    padding: clamp(1.2rem, 3vw, 1.75rem);
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.ctf__card-label {
    font-size: 0.78rem; font-weight: 800;
    letter-spacing: 1.5px; text-transform: uppercase;
    color: #0369a1; border-bottom: 2px solid #cffafe;
    padding-bottom: 0.5rem;
}
.ctf__label {
    display: block; font-size: 0.82rem;
    font-weight: 600; color: #0f172a; margin-bottom: 0.4rem;
}

/* ── Inputs ── */
.ctf__field-group { display: flex; flex-direction: column; gap: 0.2rem; }
.ctf__input-row {
    display: flex; align-items: center;
    border: 2px solid #67e8f9; border-radius: 10px;
    overflow: hidden; transition: border-color 0.2s;
}
.ctf__input-row:focus-within {
    border-color: #0891b2;
    box-shadow: 0 0 0 3px rgba(8,145,178,0.15);
}
.ctf__input {
    flex: 1; border: none; outline: none;
    padding: 0.7rem 0.75rem; font-size: 1.1rem;
    color: #0f172a; background: transparent;
    font-weight: 700; font-family: inherit; width: 100%;
}
.ctf__input::placeholder { color: #94a3b8; font-weight: 400; font-size: 0.9rem; }
.ctf__unit {
    background: #cffafe; color: #0369a1;
    padding: 0.7rem 0.9rem; font-size: 1rem;
    font-weight: 800; white-space: nowrap; flex-shrink: 0;
}

/* ── Arrow ── */
.ctf__arrow { text-align: center; font-size: 1.4rem; color: #0891b2; line-height: 1; }

/* ── Result box ── */
.ctf__result-box {
    background: #ecfeff; border: 2px solid #67e8f9;
    border-radius: 10px; padding: 0.85rem 1rem;
    min-height: 64px; display: flex;
    flex-direction: column; gap: 4px;
    transition: background 0.2s, border-color 0.2s;
}
.ctf__result-box.ctf--has-value { background: #cffafe; border-color: #22d3ee; }
.ctf__result-main { display: flex; align-items: baseline; gap: 0.4rem; }
.ctf__result-val {
    font-size: 1.9rem; font-weight: 900; color: #0c4a6e;
    font-variant-numeric: tabular-nums; line-height: 1;
}
.ctf__result-unit { font-size: 1.1rem; font-weight: 800; color: #0369a1; }
.ctf__result-sub { font-size: 0.78rem; color: #0891b2; font-weight: 600; font-style: italic; }

/* ── Formula ── */
.ctf__formula {
    font-size: 0.75rem; color: #64748b; line-height: 1.6;
    background: #f8fafc; border-left: 3px solid #67e8f9;
    padding: 0.5rem 0.75rem; border-radius: 0 6px 6px 0;
}

/* ── Clear button ── */
.ctf__clear-btn {
    align-self: flex-start; background: none;
    border: 1.5px solid #cbd5e1; border-radius: 7px;
    padding: 0.35rem 0.85rem; font-size: 0.78rem;
    color: #64748b; cursor: pointer; transition: all 0.15s;
    font-weight: 600; font-family: inherit;
}
.ctf__clear-btn:hover { border-color: #ef4444; color: #ef4444; background: #fff5f5; }

/* ── Divider ── */
.ctf__divider {
    display: flex; align-items: center; justify-content: center;
    width: 48px; min-width: 48px; background: #ecfeff;
    font-size: 0.7rem; font-weight: 800; letter-spacing: 1px; color: #0369a1;
    border-left: 1px solid #cffafe; border-right: 1px solid #cffafe;
}

/* ── Tables ── */
.ctf__table-section {
    padding: clamp(1rem, 3vw, 1.5rem);
    background: #fff; border-top: 1.5px solid #cffafe;
}
.ctf__table-section--alt { background: #f0fdff; }
.ctf__table-title {
    font-size: clamp(0.9rem, 2.5vw, 1rem) !important;
    font-weight: 800 !important; color: #0f172a !important;
    margin: 0 0 0.85rem !important;
}
.ctf__table-note {
    font-size: 0.75rem; color: #64748b; margin: 0.5rem 0 0;
    font-style: italic;
}
.ctf__table-wrap { overflow-x: auto; }

/* Main table */
.ctf__table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.ctf__table thead tr { background: linear-gradient(90deg, #0c1a2e, #0369a1); }
.ctf__table thead th {
    color: #fff; padding: 0.6rem 1rem; text-align: left;
    font-weight: 700; font-size: 0.82rem; white-space: nowrap;
}
.ctf__table tbody tr:nth-child(even) { background: #f0fdff; }
.ctf__table tbody tr:hover { background: #cffafe; }
.ctf__table tbody td {
    padding: 0.5rem 1rem; color: #0f172a;
    font-weight: 500; border-bottom: 1px solid #cffafe;
}
.ctf__tr--highlight td { background: #fffbeb !important; }
.ctf__tr--highlight:hover td { background: #fef3c7 !important; }
.ctf__f-cell { color: #0c4a6e; font-weight: 800; font-size: 0.95rem; }

/* Compact lookup table */
.ctf__table--compact { min-width: 2400px; }
.ctf__table--compact thead th {
    padding: 0.5rem 0.7rem; font-size: 0.78rem; text-align: center;
}
.ctf__table--compact tbody td {
    padding: 0.45rem 0.7rem; text-align: center;
    font-size: 0.82rem; white-space: nowrap;
}

/* Category badges */
.ctf__badge {
    display: inline-block; padding: 2px 8px; border-radius: 20px;
    font-size: 11px; font-weight: 700; white-space: nowrap;
}
.ctf__badge--physics   { background: #1e1b4b; color: #a5b4fc; }
.ctf__badge--weather   { background: #dbeafe; color: #1e40af; }
.ctf__badge--reference { background: #fef9c3; color: #854d0e; }
.ctf__badge--everyday  { background: #dcfce7; color: #166534; }
.ctf__badge--body      { background: #fce7f3; color: #9d174d; }
.ctf__badge--cooking   { background: #ffedd5; color: #9a3412; }
.ctf__badge--science   { background: #f3f4f6; color: #374151; }

/* ── Note ── */
.ctf__note {
    background: #ecfeff; border-top: 1.5px solid #67e8f9;
    padding: 0.85rem clamp(1rem, 3vw, 1.5rem);
    font-size: 0.82rem; color: #0f172a; line-height: 1.65;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .ctf__body { flex-direction: column; }
    .ctf__divider {
        width: 100%; min-width: unset; height: 36px;
        border-left: none; border-right: none;
        border-top: 1px solid #cffafe; border-bottom: 1px solid #cffafe;
    }
    .ctf__card { padding: 1rem; }
}
