/* =============================================
   House Affordability Calculator Pro – CSS
   ============================================= */

.hac-wrapper {
    max-width: 900px;
    margin: 30px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fff;
    border: 1px solid #e0e4ea;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

/* Header */
.hac-header {
    background: linear-gradient(135deg, #1a6fc4 0%, #0d4f9e 100%);
    padding: 28px 32px;
    text-align: center;
}
.hac-header-icon { font-size: 36px; margin-bottom: 8px; }
.hac-title {
    margin: 0 0 6px 0 !important;
    font-size: 24px !important;
    font-weight: 700 !important;
    color: #fff !important;
}
.hac-subtitle { margin: 0 !important; font-size: 14px; color: rgba(255,255,255,0.75); }

/* Body */
.hac-body { padding: 28px 32px; }

/* Grid Layout */
.hac-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

/* Section label */
.hac-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #1a6fc4;
    margin: 18px 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e8f0fe;
}
.hac-section-label:first-child { margin-top: 0; }

/* Fields */
.hac-field { margin-bottom: 14px; }
.hac-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 6px;
}
.hac-optional { font-weight: 400; color: #9ca3af; font-size: 11px; }

.hac-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.hac-prefix {
    position: absolute;
    left: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    pointer-events: none;
}
.hac-input {
    width: 100%;
    padding: 10px 12px 10px 26px;
    font-size: 15px;
    font-weight: 500;
    color: #111827;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 7px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
    -moz-appearance: textfield;
}
.hac-input::-webkit-outer-spin-button,
.hac-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.hac-input:focus {
    border-color: #1a6fc4;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26,111,196,0.1);
}
.hac-input-no-prefix {
    padding-left: 12px;
}
.hac-select {
    width: 100%;
    padding: 10px 36px 10px 12px;
    font-size: 15px;
    font-weight: 500;
    color: #111827;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 7px;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.hac-select:focus { border-color: #1a6fc4; box-shadow: 0 0 0 3px rgba(26,111,196,0.1); }

.hac-down-pct { font-size: 12px; color: #6b7280; margin-top: 5px; }

/* Calculate button */
.hac-calc-btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #1a6fc4, #0d4f9e);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}
.hac-calc-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26,111,196,0.4);
}

/* Results panel */
.hac-results { display: flex; flex-direction: column; gap: 18px; }

/* Hero result */
.hac-result-hero {
    background: linear-gradient(135deg, #f0f7ff, #e8f4fd);
    border: 2px solid #bfdbfe;
    border-radius: 10px;
    padding: 22px;
    text-align: center;
}
.hac-result-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.7px; color: #6b7280; margin-bottom: 8px; }
.hac-result-price { font-size: 40px; font-weight: 800; color: #1a6fc4; letter-spacing: -1.5px; line-height: 1; }
.hac-result-sub { font-size: 12px; color: #6b7280; margin-top: 6px; }

/* Metrics */
.hac-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.hac-metric {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px 10px;
    text-align: center;
}
.hac-metric-val { font-size: 17px; font-weight: 700; color: #111827; }
.hac-metric-label { font-size: 11px; color: #6b7280; margin-top: 3px; }

/* Breakdown */
.hac-breakdown {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}
.hac-breakdown-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #374151;
    margin-bottom: 12px;
}
.hac-breakdown-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #4b5563;
    padding: 5px 0;
    border-bottom: 1px solid #f3f4f6;
}
.hac-breakdown-row:last-child { border-bottom: none; }
.hac-total-row { font-weight: 700; color: #111827; margin-top: 4px; padding-top: 8px; border-top: 2px solid #e5e7eb !important; border-bottom: none !important; }

/* DTI Gauge */
.hac-gauge-wrap { }
.hac-gauge-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: #374151; margin-bottom: 10px; }
.hac-gauge { }
.hac-gauge-bar {
    height: 12px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 6px;
}
.hac-gauge-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #22c55e, #f59e0b, #ef4444);
    border-radius: 999px;
    transition: width 0.6s ease;
}
.hac-gauge-labels { display: flex; justify-content: space-between; font-size: 11px; color: #9ca3af; }
.hac-good-label { color: #1a6fc4; font-weight: 600; }
.hac-dti-status { font-size: 13px; font-weight: 600; margin-top: 6px; }
.hac-dti-good  { color: #16a34a; }
.hac-dti-ok    { color: #d97706; }
.hac-dti-high  { color: #dc2626; }

/* Rules */
.hac-rules { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; }
.hac-rules-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: #374151; margin-bottom: 12px; }
.hac-rule-row { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid #f3f4f6; }
.hac-rule-row:last-child { border-bottom: none; }
.hac-rule-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.hac-rule-icon.pass { color: #16a34a; }
.hac-rule-icon.fail { color: #dc2626; }
.hac-rule-text { font-size: 12px; }
.hac-rule-text strong { display: block; color: #111827; margin-bottom: 2px; }
.hac-rule-text span { color: #6b7280; }

/* Disclaimer */
.hac-disclaimer { font-size: 11px; color: #9ca3af; margin: 0 !important; line-height: 1.5; }

/* Responsive */
@media (max-width: 680px) {
    .hac-grid { grid-template-columns: 1fr; }
    .hac-body { padding: 20px 18px; }
    .hac-metrics { grid-template-columns: repeat(3,1fr); }
    .hac-result-price { font-size: 32px; }
}
@media (max-width: 380px) {
    .hac-metrics { grid-template-columns: 1fr 1fr; }
}
