/* ── Energy Unit Converter — style.css ─────────────────────── */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --accent:       #f43f5e;
    --accent-dark:  #e11d48;
    --accent-light: #ffe4e6;
    --accent-glow:  rgba(244, 63, 94, 0.18);
    --bg:           #f8fafc;
    --surface:      #ffffff;
    --surface2:     #f1f5f9;
    --border:       #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary:#475569;
    --text-muted:   #94a3b8;
    --radius-lg:    16px;
    --radius-md:    10px;
    --radius-sm:    6px;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:    0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
    --shadow-lg:    0 8px 32px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.06);
    --transition:   0.18s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { font-size: 16px; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Layout ───────────────────────────────────────────────── */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 48px;
}

/* ── Header ───────────────────────────────────────────────── */
header {
    padding: 28px 0 20px;
    text-align: left;
}

.header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

header h1 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.subtitle {
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 680px;
    text-align: left;
}

/* ── Header Actions ────────────────────────────────────────── */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.home-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: var(--surface2);
    color: var(--text-secondary);
    font-size: 0.83rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--border);
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}
.home-btn:hover {
    background: var(--accent-light);
    color: var(--accent-dark);
    border-color: var(--accent);
}

.lang-switcher {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.lang-btn {
    padding: 5px 11px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    letter-spacing: 0.02em;
}
.lang-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent-dark);
}
.lang-btn.active {
    background: var(--accent);
    border-color: var(--accent-dark);
    color: #ffffff;
}

/* ── Reset Row ────────────────────────────────────────────── */
.reset-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 18px;
}

.btn-reset {
    padding: 8px 20px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
}
.btn-reset:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

/* ── Main Grid ────────────────────────────────────────────── */
.calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 768px) {
    .calc-grid { grid-template-columns: 1fr; }
}

/* ── Section Cards ────────────────────────────────────────── */
.calc-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px 22px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    transition: box-shadow var(--transition);
}
.calc-section:hover {
    box-shadow: var(--shadow-md);
}

.section-header {
    margin-bottom: 16px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.section-title > span:first-child {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.section-desc {
    font-size: 0.81rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* ── Section Badges ───────────────────────────────────────── */
.section-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge-si {
    background: #dbeafe;
    color: #1d4ed8;
}
.badge-electrical {
    background: #fef3c7;
    color: #d97706;
}
.badge-thermal {
    background: #fee2e2;
    color: #b91c1c;
}
.badge-physics {
    background: #f3e8ff;
    color: #7c3aed;
}

/* ── Input Grid ───────────────────────────────────────────── */
.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}

@media (max-width: 480px) {
    .input-grid { grid-template-columns: 1fr; }
}

/* ── Field Groups ─────────────────────────────────────────── */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.field-group input[type="number"] {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface2);
    color: var(--text-primary);
    font-size: 0.92rem;
    font-family: var(--font);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    appearance: textfield;
    -moz-appearance: textfield;
}
.field-group input[type="number"]::-webkit-outer-spin-button,
.field-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
}
.field-group input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.field-group input[type="number"]::placeholder {
    color: var(--text-muted);
}

/* Full-width fields */
.field-full {
    grid-column: 1 / -1;
}

/* ── Right Panel (knowledge + FAQ) ───────────────────────── */
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Knowledge Card ───────────────────────────────────────── */
.knowledge-card,
.faq-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
}

.knowledge-card h2,
.faq-card h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-light);
}

.knowledge-block {
    margin-bottom: 14px;
}
.knowledge-block:last-child { margin-bottom: 0; }

.knowledge-block h3 {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--accent-dark);
    margin-bottom: 4px;
}

.knowledge-block p {
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* ── Conversion Table ─────────────────────────────────────── */
.conv-table-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 18px 0 8px;
}

.conv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.80rem;
}
.conv-table th {
    background: var(--accent-light);
    color: var(--accent-dark);
    font-weight: 700;
    padding: 7px 10px;
    text-align: left;
    border-bottom: 2px solid var(--accent);
}
.conv-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: top;
}
.conv-table tr:last-child td { border-bottom: none; }
.conv-table tr:hover td { background: var(--surface2); }

/* ── FAQ Card ─────────────────────────────────────────────── */
.faq-card { margin-top: 20px; }

.faq-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.faq-item:last-child { border-bottom: none; }

.faq-item h3 {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}
.faq-item p {
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* ── Footer ───────────────────────────────────────────────── */
footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}
footer a {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 6px;
}
footer a:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}

/* ── Accent Divider ───────────────────────────────────────── */
.accent-divider {
    height: 3px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
    border-radius: 2px;
    margin-bottom: 24px;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Print ────────────────────────────────────────────────── */
@media print {
    .header-actions, .reset-row, footer { display: none; }
    .calc-section { box-shadow: none; border: 1px solid #ccc; }
}
