/* Shared calculator page styles. Loaded by templates/calculators/_layout.html (and the contact form).
   Page-specific rules go in static/css/calculators/<slug>.css. */

.calculator-container { --calc-width: 680px; max-width: 800px; margin: 0 auto; padding: 20px; text-align: left; }
.calculator-container .lede { max-width: var(--calc-width); margin-left: auto; margin-right: auto; }
.calculator-container h1, .calc-section h2, .button-group { text-align: center; }

/* Disclaimer */
.disclaimer {
    background-color: #333;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    border-left: 4px solid #ff0000;
    max-width: var(--calc-width);
    margin-left: auto;
    margin-right: auto;
    font-size: 0.9rem;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
}
.disclaimer strong { color: #fff; white-space: nowrap; }
.disclaimer p { margin: 0; color: #fff; }

/* Sections */
.calc-section {
    background: #222;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
    max-width: var(--calc-width);
    margin-left: auto;
    margin-right: auto;
}
.calc-section h2 { margin-top: 0; }

/* Forms */
.calc-form { display: flex; flex-direction: column; gap: 15px; margin: 0 0 15px; max-width: 600px; margin-left: auto; margin-right: auto; }
.form-group { display: flex; align-items: center; gap: 15px; }
/* Fixed 180px label column, right-aligned, so every control starts at the same x; long labels wrap. */
.form-group label { flex: 0 0 180px; min-width: 180px; font-weight: 500; font-size: 0.95rem; color: #eee; text-align: right; }
.form-group input, .form-group select, .form-group textarea {
    flex: 1;
    min-width: 0;
    padding: 10px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #333;
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
}
.form-group input.short { flex: 0 0 120px; }
.form-group input[type="date"] { color-scheme: dark; flex: 0 0 auto; width: 250px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}
.field-with-hint { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.hint { font-size: 0.82rem; color: #8fd18f; min-height: 1em; }
.hint.bad { color: #ff6b6b; }
.date-row { display: flex; gap: 8px; align-items: center; flex: 1; }

/* Checkbox list */
.checkbox-grid { margin: 0.25rem 0; border: 1px solid #333; border-radius: 4px; background-color: #1a1a1a; }
.checkbox-row {
    display: grid;
    grid-template-columns: 30px 1fr;
    gap: 10px;
    align-items: center;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #333;
    cursor: pointer;
    line-height: 1.4;
    color: #fff;
}
.checkbox-row:last-child { border-bottom: none; }
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; margin: 0 auto; appearance: auto; }

/* Buttons */
.button-group { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
button {
    padding: 10px 20px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
    transition: background-color 0.2s ease;
}
button:hover { background: #0052a3; }
button:disabled { background: #444; cursor: default; }
.ghost-btn { padding: 8px 12px; background: transparent; border: 1px solid #555; color: #ddd; font-size: 0.85rem; }
.ghost-btn:hover { background: #333; border-color: #7cc4ff; }
.copy-btn { padding: 6px 12px; font-size: 0.85rem; background: #444; border: 1px solid #666; }
.copy-btn:hover { background: #555; }
.copy-btn.copied { background: #2e7d32; border-color: #2ecc71; }

/* Results */
.results { margin-top: 20px; padding: 15px 18px; background: #333; border-radius: 6px; max-width: var(--calc-width, 600px); margin-left: auto; margin-right: auto; }
.results:empty { display: none; }
.results h3 { color: #fff; margin: 0 0 12px; }
.results p { margin: 8px 0; line-height: 1.4; color: #fff; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.results-head h3 { margin: 0; }
.result-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.result-table th, .result-table td { padding: 7px 10px; border-bottom: 1px solid #444; text-align: left; vertical-align: middle; }
.result-table th { font-weight: 500; color: #ccc; width: 40%; white-space: nowrap; }
.result-table tr:last-child th, .result-table tr:last-child td { border-bottom: none; }
.interpretation { margin-top: 10px; padding: 10px; background: #444; border-radius: 4px; font-weight: 500; white-space: pre-line; }
.report-line {
    margin-top: 12px;
    padding: 10px 12px;
    background: #1a1a1a;
    border: 1px dashed #555;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #eee;
    text-align: left;
    line-height: 1.45;
    cursor: pointer;
}
.report-line:hover { border-color: #7cc4ff; }
.copy-status { margin-top: 6px; font-size: 0.82rem; color: #ff6b6b; min-height: 1em; }
.copy-status.ok { color: #8fd18f; }
.formula { margin-top: 10px; }
.info-text { margin-top: 10px; font-size: 0.9rem; color: #ccc; }

/* Notes & references */
.reference {
    background-color: #333;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    border-left: 4px solid #2ecc71;
    max-width: var(--calc-width);
    margin-left: auto;
    margin-right: auto;
    font-size: 0.9rem;
}
.reference .content { display: flex; flex-direction: column; gap: 6px; }
.reference p { margin: 0 0 6px; color: #fff; line-height: 1.45; }
.reference h2, .reference h3 { margin-top: 0.6rem; }
.reference code { background: #222; padding: 1px 5px; border-radius: 3px; font-size: 0.9em; }
.reference a { color: #4CAF50; text-decoration: none; }
.reference a:hover { text-decoration: underline; }

/* Mobile */
@media (max-width: 700px) {
    .calculator-container { padding: 10px 0; }
    .calc-section { padding: 18px 14px; }
    .form-group { flex-direction: column; align-items: stretch; gap: 6px; }
    .form-group label { flex: none; min-width: 0; text-align: left; }
    .form-group input, .form-group select, .form-group input.short, .form-group input[type="date"] { width: 100%; flex: 1; }
    .date-row { width: 100%; }
    .result-table th { white-space: normal; width: auto; }
}

/* "Was this useful?" under the results, and the suggest / report links */
.calc-feedback { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 14px auto 0; max-width: var(--calc-width); color: #ccc; font-size: 0.95rem; }
.calc-feedback .vote { background: #333; border: 1px solid #555; color: #fff; padding: 6px 12px; font-size: 1.1rem; line-height: 1; }
.calc-feedback .vote:hover { background: #444; }
.calc-feedback .vote.chosen { border-color: #0066cc; }
.calc-feedback textarea { flex: 1 1 100%; background: #222; color: #fff; border: 1px solid #555; border-radius: 4px; padding: 8px; font: inherit; }
.calc-feedback #fb-send { padding: 6px 14px; }
.calc-links { text-align: center; color: #999; margin: 12px 0 4px; }
.calc-links a { color: #8ab4f8; }
