/**
 * components.css - Components UI
 *
 * Bao gồm:
 *   - .card / .section-title / .badge
 *   - .row / .field / input / select / textarea
 *   - .btn (primary, secondary, warning, export, export-excel)
 *   - .alert (info, warning, danger)
 *   - .input-mode-tabs (chuyển manual / paste)
 *   - .tower-input-table (bảng cột)
 *   - .result-table (bảng kết quả)
 *   - Charts SVG (.chart, .chart-area, .chart-line)
 */

.card { background: white; padding: 22px; margin-bottom: 14px; border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,0.04); }

.section-title { font-size: 15px; font-weight: 600; color: #0f4c75; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid #e0e7ed; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.section-title .num { background: #0f4c75; color: white; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }

.section-title .badge { font-size: 11px; padding: 3px 9px; background: #ffd700; color: #5d4a00; border-radius: 10px; font-weight: 700; margin-left: auto; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 12px; }

.row.three { grid-template-columns: 1fr 1fr 1fr; }

.row.four { grid-template-columns: 1fr 1fr 1fr 1fr; }

.field { display: flex; flex-direction: column; }

.field label { font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: #2d3748; }

.field label .help { font-size: 11px; color: #718096; font-weight: 400; margin-left: 3px; }

.field input, .field select, .field textarea { padding: 10px 12px; border: 1.5px solid #cbd5e0; border-radius: 6px; font-size: 14px; transition: all 0.15s; background: white; color: #1a2332; font-family: inherit; }

.field textarea { resize: vertical; font-family: 'SF Mono', 'Cascadia Code', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 12px; min-height: 80px; }

.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: #0f4c75; box-shadow: 0 0 0 3px rgba(15,76,117,0.12); }

/* Hint text ngay dưới input - LUÔN hiển thị, không cần hover */
.field-hint { font-size: 11.5px; color: #5568a6; margin-top: 5px; line-height: 1.45; padding-left: 2px; font-style: italic; }

.field-hint strong { color: #0f4c75; font-style: normal; }

.btn { background: linear-gradient(135deg, #0f4c75 0%, #1a5f8e 100%); color: white; padding: 14px 28px; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.15s; width: 100%; box-shadow: 0 2px 6px rgba(15,76,117,0.3); font-family: inherit; }

.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(15,76,117,0.4); }

.btn-small { padding: 8px 14px; font-size: 13px; width: auto; }

.btn-export { background: linear-gradient(135deg, #2c7a3e 0%, #3a9c52 100%); }

.btn-export-excel { background: linear-gradient(135deg, #1d6f42 0%, #228a52 100%); }

.btn-secondary { background: linear-gradient(135deg, #6c757d 0%, #8a929b 100%); }

.btn-warning { background: linear-gradient(135deg, #d97706 0%, #ea8c14 100%); }

.export-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

.result-card { border-left: 4px solid #0f4c75; }

.result-summary { background: #f0f7ff; padding: 14px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13.5px; line-height: 1.6; }

.result-summary h3 { color: #0f4c75; font-size: 13px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }

.result-table-wrap { overflow-x: auto; margin: 14px 0; max-height: 420px; overflow-y: auto; border: 1px solid #e0e7ed; border-radius: 6px; }

.result-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.result-table thead { background: #0f4c75; position: sticky; top: 0; }

.result-table th { color: white; padding: 11px 10px; text-align: left; font-weight: 600; white-space: nowrap; }

.result-table td { padding: 8px 10px; border-bottom: 1px solid #e0e7ed; }

.result-table tr:nth-child(even) td { background: #f7fafc; }

.result-table tr.weak td { background: #fff3cd !important; }

.result-table tr.fault td { background: #ffe0e0 !important; font-weight: 600; }

.result-table .value { font-weight: 700; color: #0f4c75; }

.result-table .highlight { background: #fff3cd !important; color: #856404; }

.alert { padding: 12px 14px; border-radius: 6px; margin-bottom: 10px; font-size: 13px; display: flex; align-items: flex-start; gap: 10px; line-height: 1.55; }

.alert .icon { font-size: 16px; flex-shrink: 0; }

.alert-warning { background: #fff3cd; color: #856404; border-left: 4px solid #ffc107; }

.alert-danger { background: #f8d7da; color: #721c24; border-left: 4px solid #dc3545; }

.alert-info { background: #d1ecf1; color: #0c5460; border-left: 4px solid #17a2b8; }

.alert-success { background: #d4edda; color: #155724; border-left: 4px solid #28a745; }

.formula { background: #f7fafc; padding: 10px 14px; border-radius: 6px; font-family: 'SF Mono', 'Cascadia Code', Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 12.5px; margin: 6px 0 10px; border-left: 3px solid #0f4c75; color: #2d3748; line-height: 1.6; word-break: break-word; }

#results { display: none; }

#towersCard { display: none; }

.footer { text-align: center; color: #718096; font-size: 11.5px; padding: 18px 12px; margin-top: 16px; line-height: 1.6; }

.footer strong { color: #4a5568; }

details { margin: 10px 0; }

details summary { cursor: pointer; font-weight: 600; color: #0f4c75; padding: 10px 14px; background: #f0f7ff; border-radius: 6px; user-select: none; font-size: 13.5px; }

details > div { padding: 14px; background: #fafbfc; border-radius: 6px; margin-top: 6px; font-size: 13px; line-height: 1.6; border: 1px solid #e0e7ed; }

details ul, details ol { padding-left: 22px; margin: 6px 0; }

details li { margin: 3px 0; }

h3.subhead { margin-top: 22px; margin-bottom: 10px; color: #0f4c75; font-size: 14px; font-weight: 600; }

.tag { display: inline-block; background: #e0e7ed; color: #2d3748; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; margin-left: 4px; }

.tag.green { background: #d4edda; color: #155724; }

.tag.yellow { background: #fff3cd; color: #856404; }

.tag.red { background: #f8d7da; color: #721c24; }

.tag.blue { background: #d1ecf1; color: #0c5460; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #28a745; color: white; padding: 12px 22px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,0.2); font-size: 13.5px; font-weight: 600; z-index: 1000; }

.toast.warn { background: #d97706; }

.tower-input-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.tower-input-table th { background: #0f4c75; color: white; padding: 8px; text-align: left; }

.tower-input-table td { padding: 4px; border-bottom: 1px solid #e0e7ed; }

.tower-input-table input { width: 100%; padding: 6px 8px; border: 1px solid #cbd5e0; border-radius: 4px; font-size: 12.5px; }

.tower-input-table .del-btn { background: #dc3545; color: white; border: none; padding: 4px 10px; border-radius: 4px; cursor: pointer; font-size: 12px; }

.tower-input-table .del-btn:hover { background: #b02a37; }

.chart-wrap { background: white; padding: 16px; border-radius: 6px; margin: 12px 0; overflow-x: auto; border: 1px solid #e0e7ed; }

.chart-wrap svg { display: block; margin: 0 auto; max-width: 100%; }

.fault-selector { background: #fff3cd; padding: 14px 16px; border-radius: 6px; margin: 12px 0; border-left: 4px solid #ffc107; }

.fault-selector .label { font-size: 13px; font-weight: 600; color: #856404; margin-bottom: 8px; display: block; }

.fault-selector select { width: 100%; padding: 8px 10px; border: 1.5px solid #ffc107; border-radius: 6px; font-size: 13.5px; }

.toggle-section { display: none; }

.toggle-section.active { display: block; }

.input-mode-tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 2px solid #e0e7ed; }

.input-mode-tab { padding: 8px 16px; cursor: pointer; font-size: 13px; font-weight: 600; color: #718096; border-radius: 6px 6px 0 0; user-select: none; }

.input-mode-tab.active { background: #0f4c75; color: white; }
