/* ==========================================================================
   House Materials Calculator
   ========================================================================== */

.hc-page {
    --hc-blue: #2563eb;
    --hc-blue-dark: #1d4ed8;
    --hc-blue-soft: #eff6ff;
    --hc-border: #e5e7eb;
    --hc-radius: 14px;
    --hc-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
}

/* --- Hero ----------------------------------------------------------------- */
.hc-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: center;
    padding: 1.75rem;
    margin-bottom: 1.75rem;
    border-radius: var(--hc-radius);
    background: linear-gradient(135deg, #f8fafc 0%, #e0ecff 100%);
    border: 1px solid var(--hc-border);
    box-shadow: var(--hc-shadow);
}

.hc-hero__title {
    font-size: clamp(1.6rem, 2.6vw, 2.25rem);
    font-weight: 700;
    color: #0f172a;
    line-height: 1.15;
    margin-bottom: 0.5rem;
}

.hc-hero__lead {
    color: #475569;
    margin-bottom: 1.25rem;
}

.hc-features {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.hc-feature {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.75rem 0.85rem;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--hc-border);
    border-radius: 10px;
    font-size: 0.8rem;
    color: #64748b;
}

.hc-feature strong {
    color: #0f172a;
    font-size: 0.9rem;
}

.hc-feature__icon {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.hc-feature__icon--blue { color: var(--hc-blue); }
.hc-feature__icon--green { color: #16a34a; }
.hc-feature__icon--amber { color: #d97706; }

.hc-hero__art {
    min-width: 0;
}

.hc-house-art {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: var(--hc-shadow);
}

/* --- Cards ---------------------------------------------------------------- */
.hc-card {
    border: 1px solid var(--hc-border);
    border-radius: var(--hc-radius);
    box-shadow: var(--hc-shadow);
}

.hc-card__title {
    display: flex;
    align-items: center;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 1rem;
}

.hc-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    margin-right: 0.6rem;
    border-radius: 50%;
    background: var(--hc-blue);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.hc-step--muted {
    background: #94a3b8;
}

.hc-label {
    font-family: inherit;
    letter-spacing: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.3rem;
}

.hc-readonly {
    background: #f1f5f9;
    color: #334155;
    font-weight: 600;
}

.hc-dims {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
        "length diagram"
        "width diagram"
        "height diagram"
        "area diagram";
    gap: 0.75rem 1rem;
    align-items: start;
}

.hc-field-length { grid-area: length; }
.hc-field-width { grid-area: width; }
.hc-field-height { grid-area: height; }
.hc-field-area { grid-area: area; }
.hc-field-diagram { grid-area: diagram; }

.hc-diagram {
    display: block;
    width: 100%;
    height: auto;
    max-width: 260px;
    margin: 0 auto;
}

/* --- Component checkboxes ------------------------------------------------- */
.hc-check {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    width: 100%;
    height: 100%;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--hc-border);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.hc-check:hover {
    border-color: #bfdbfe;
    background: #f8fafc;
}

.hc-check:has(input:checked) {
    border-color: var(--hc-blue);
    background: var(--hc-blue-soft);
}

.hc-check .form-check-input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.hc-check__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hc-check__label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
}

.hc-check__hint {
    color: #64748b;
    font-size: 0.74rem;
    line-height: 1.3;
}

.hc-more-options {
    display: none;
    font-weight: 600;
}

/* --- Unit prices ---------------------------------------------------------- */
.hc-prices__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    list-style: none;
}

.hc-prices__summary::-webkit-details-marker { display: none; }
.hc-prices__summary::marker { content: ''; }

.hc-prices__chevron {
    color: #94a3b8;
    transition: transform 0.2s;
}

.hc-prices[open] .hc-prices__chevron {
    transform: rotate(180deg);
}

.hc-price-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Actions -------------------------------------------------------------- */
.hc-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.hc-btn-calc {
    flex: 1 1 auto;
    background: var(--hc-blue);
    border-color: var(--hc-blue);
    font-weight: 600;
}

.hc-btn-calc:hover,
.hc-btn-calc:focus {
    background: var(--hc-blue-dark);
    border-color: var(--hc-blue-dark);
}

/* --- Results -------------------------------------------------------------- */
.hc-results__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.hc-results__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}

.hc-results__badge--idle {
    background: #cbd5e1;
}

.hc-results__tools {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.hc-tabs .nav-link {
    color: #64748b;
    font-weight: 600;
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 0.6rem 1rem;
}

.hc-tabs .nav-link:hover {
    color: var(--hc-blue-dark);
    border-color: #bfdbfe;
}

.hc-tabs .nav-link.active {
    color: var(--hc-blue);
    background: transparent;
    border-color: var(--hc-blue);
}

.hc-tab-content {
    padding-top: 1rem;
}

.hc-table thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid var(--hc-border);
    white-space: nowrap;
}

.hc-table td {
    font-size: 0.92rem;
    border-color: #f1f5f9;
}

.hc-col-num {
    width: 2.5rem;
}

.hc-col-share {
    width: 30%;
}

.hc-mat {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.hc-mat__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 8px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.hc-tone-grey  { background: #e2e8f0; color: #475569; }
.hc-tone-sand  { background: #fef3c7; color: #b45309; }
.hc-tone-stone { background: #e7e5e4; color: #57534e; }
.hc-tone-brick { background: #fee2e2; color: #b91c1c; }
.hc-tone-steel { background: #e0e7ff; color: #3730a3; }
.hc-tone-wood  { background: #fde68a; color: #92400e; }
.hc-tone-roof  { background: #cffafe; color: #0e7490; }
.hc-tone-blue  { background: var(--hc-blue-soft); color: var(--hc-blue-dark); }

.hc-share {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hc-share__bar {
    flex: 1 1 auto;
    height: 8px;
    background: #f1f5f9;
}

.hc-share__bar .progress-bar {
    background: var(--hc-blue);
}

.hc-row-muted td {
    background: #fafafa;
}

.hc-row-total th {
    background: var(--hc-blue-soft);
    color: var(--hc-blue-dark);
    font-size: 1rem;
    border-top: 2px solid #bfdbfe;
}

.hc-stat {
    display: flex;
    flex-direction: column;
    padding: 0.55rem 0;
    border-bottom: 1px dashed var(--hc-border);
}

.hc-stat span {
    font-size: 0.78rem;
    color: #64748b;
}

.hc-stat strong {
    font-size: 1rem;
    color: #0f172a;
}

.hc-subtitle {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.6rem;
}

.hc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.hc-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: var(--hc-blue-soft);
    color: var(--hc-blue-dark);
    font-size: 0.8rem;
    font-weight: 600;
}

.hc-assumptions {
    padding-left: 1.1rem;
}

.hc-assumptions li + li {
    margin-top: 0.25rem;
}

/* --- Total banner --------------------------------------------------------- */
.hc-total {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: var(--hc-blue-soft);
    border: 1px solid #bfdbfe;
}

.hc-total__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    background: #f59e0b;
    color: #fff;
    flex-shrink: 0;
}

.hc-total__text {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.hc-total__text strong {
    color: #0f172a;
}

.hc-total__text small {
    color: #64748b;
    font-size: 0.75rem;
}

.hc-total__value {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    color: var(--hc-blue);
    white-space: nowrap;
}

/* --- Empty state ---------------------------------------------------------- */
.hc-empty {
    padding: 3rem 1rem;
    text-align: center;
    border: 2px dashed var(--hc-border);
    border-radius: 12px;
    margin-top: 1.5rem;
}

.hc-empty__icon {
    font-size: 2.2rem;
    color: #cbd5e1;
    margin-bottom: 0.75rem;
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 991.98px) {
    .hc-hero {
        grid-template-columns: 1fr;
        padding: 1.25rem;
    }

    .hc-hero__art {
        order: -1;
    }
}

@media (max-width: 575.98px) {
    .hc-features {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hc-feature {
        align-items: center;
        text-align: center;
        padding: 0.65rem 0.4rem;
    }

    .hc-feature span {
        display: none;
    }

    .hc-dims {
        grid-template-areas:
            "length width"
            "height diagram"
            "area area";
    }

    .hc-check__hint {
        display: none;
    }

    .hc-more-options {
        display: inline-flex;
        align-items: center;
    }

    .hc-components:not(.hc-components--expanded) .hc-component--extra {
        display: none;
    }

    .hc-components--expanded + .hc-more-options .fa-chevron-down {
        transform: rotate(180deg);
    }

    .hc-total {
        flex-wrap: wrap;
    }

    .hc-total__value {
        flex-basis: 100%;
        text-align: right;
    }
}

/* --- Print ---------------------------------------------------------------- */
.hc-print-only {
    display: none;
}

@media print {
    nav,
    footer,
    .mobile-bottom-nav,
    .offline-banner,
    .install-banner,
    #progress-bar,
    .hc-no-print {
        display: none !important;
    }

    body {
        padding-bottom: 0 !important;
    }

    #content {
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .hc-print-only {
        display: block;
    }

    .hc-print-meta {
        margin: 0.5rem 0 1rem;
        color: #334155;
    }

    .hc-print-heading {
        font-size: 1rem;
        margin: 1.25rem 0 0.5rem;
        color: #0f172a;
    }

    .hc-form .col-lg-7 {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    .hc-card {
        box-shadow: none;
        border-color: #cbd5e1;
    }

    .hc-tab-content > .tab-pane {
        display: block !important;
        opacity: 1 !important;
    }

    .hc-table .d-none {
        display: table-cell !important;
    }

    .hc-total {
        break-inside: avoid;
    }
}
