/* ── Timber Price Calculator — Frontend Styles ───────────────────────── */

.tpc-calculator {
    background: #f8fdfb;
    border: 1.5px solid #b7dfc7;
    border-radius: 10px;
    margin: 20px 0 24px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Header ──────────────────────────────────────────────────────────── */
.tpc-calc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #1e5c35, #2e7d4f);
    border-bottom: 1px solid #1a4a2a;
}

.tpc-calc-icon { font-size: 18px; line-height: 1; }

.tpc-calc-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    letter-spacing: .3px;
}

/* ── Body ────────────────────────────────────────────────────────────── */
.tpc-calc-body { padding: 18px 20px 20px; }

/* ── Fields ──────────────────────────────────────────────────────────── */
.tpc-calc-dims {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 14px;
}

.tpc-calc-field {
    flex: 1 1 120px;
    min-width: 110px;
}

.tpc-calc-field--qty {
    margin-bottom: 14px;
    max-width: 200px;
}

.tpc-calc-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

/* ── Unit badge ──────────────────────────────────────────────────────── */
.tpc-unit-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    background: #d1fae5;
    color: #065f46;
    padding: 1px 6px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.tpc-fixed-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    background: #e0e7ff;
    color: #3730a3;
    padding: 1px 6px;
    border-radius: 20px;
}

/* ── Input wrap ──────────────────────────────────────────────────────── */
.tpc-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.tpc-input {
    width: 100%;
    padding: 9px 36px 9px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #111827;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    -moz-appearance: textfield;
    box-sizing: border-box;
}

.tpc-input::-webkit-outer-spin-button,
.tpc-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.tpc-input:focus {
    border-color: #2e7d4f;
    box-shadow: 0 0 0 3px rgba(46,125,79,.15);
    outline: none;
}

.tpc-input.tpc-input--error { border-color: #ef4444; }

.tpc-input-suffix {
    position: absolute;
    right: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    pointer-events: none;
}

/* ── Stepper ─────────────────────────────────────────────────────────── */
.tpc-input-wrap--stepper .tpc-input {
    padding: 9px 12px;
    text-align: center;
    border-radius: 0;
    border-left: none;
    border-right: none;
    max-width: 70px;
}

.tpc-stepper {
    width: 36px;
    height: 38px;
    border: 1.5px solid #d1d5db;
    background: #fff;
    color: #374151;
    font-size: 18px;
    font-weight: 400;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, border-color .12s;
    flex-shrink: 0;
}

.tpc-stepper--minus { border-radius: 6px 0 0 6px; }
.tpc-stepper--plus  { border-radius: 0 6px 6px 0; }

.tpc-stepper:hover {
    background: #f0faf4;
    border-color: #2e7d4f;
    color: #2e7d4f;
}

/* ── Fixed value display ─────────────────────────────────────────────── */
.tpc-fixed-value {
    padding: 9px 12px;
    background: #f3f4f6;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
}

/* ── Summary ─────────────────────────────────────────────────────────── */
.tpc-calc-summary {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 16px;
}

.tpc-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
}

.tpc-summary-row:last-child { border-bottom: none; }

.tpc-summary-label { color: #6b7280; }

.tpc-summary-value {
    font-weight: 600;
    color: #111827;
}

.tpc-summary-row--total {
    background: #f0faf4;
    border-top: 1px solid #b7dfc7;
}

.tpc-summary-row--total .tpc-summary-label {
    color: #1a3c28;
    font-weight: 600;
    font-size: 14px;
}

.tpc-total {
    font-size: 20px;
    font-weight: 700;
    color: #1e5c35;
}

/* ── Notice ──────────────────────────────────────────────────────────── */
.tpc-calc-notice {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.tpc-calc-notice--error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
}

.tpc-calc-notice--info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

/* ── Per-unit label (shop / product page) ────────────────────────────── */
.tpc-per-unit-label {
    font-size: .75em;
    font-weight: 500;
    color: #6b7280;
    margin-left: 4px;
}

/* ── Loading state ───────────────────────────────────────────────────── */
.tpc-total.is-loading {
    opacity: .5;
    transition: opacity .2s;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media ( max-width: 480px ) {
    .tpc-calc-dims { flex-direction: column; }
    .tpc-calc-field { flex: 1 1 100%; }
    .tpc-calc-field--qty { max-width: 100%; }
}

/* ── Add-on Services ─────────────────────────────────────────────────── */
.tpc-services-section {
    margin-top: 16px;
    border: 1.5px solid #e0e7ff;
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
}

.tpc-services-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 8px;
    background: #eef2ff;
    border-bottom: 1px solid #e0e7ff;
}

.tpc-services-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #3730a3;
}

.tpc-services-icon { font-size: 14px; }

.tpc-services-subtitle {
    font-size: 11px;
    color: #6366f1;
    font-style: italic;
}

/* ── Service cards grid ──────────────────────────────────────────────── */
.tpc-services-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px;
}

/* ── Individual service card ─────────────────────────────────────────── */
.tpc-service-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 7px;
    background: #fff;
    cursor: pointer;
    transition: border-color .18s, background .18s, box-shadow .18s, transform .1s;
    user-select: none;
    margin-bottom: 6px;
    position: relative;
}

.tpc-service-card:last-child { margin-bottom: 0; }

.tpc-service-card:hover {
    border-color: #a5b4fc;
    background: #f5f3ff;
    box-shadow: 0 2px 8px rgba(99,102,241,.08);
}

.tpc-service-card:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}

/* ── Active / selected state ─────────────────────────────────────────── */
.tpc-service-card.is-active {
    border-color: #6366f1;
    background: linear-gradient(135deg, #eef2ff 0%, #f0fdf4 100%);
    box-shadow: 0 2px 10px rgba(99,102,241,.15);
}

.tpc-service-card.is-active:hover {
    border-color: #4f46e5;
}

.tpc-service-card:active { transform: scale(0.99); }

/* ── Check circle ────────────────────────────────────────────────────── */
.tpc-svc-card__check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .18s, border-color .18s;
}

.tpc-svc-card__check-icon {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    opacity: 0;
    transition: opacity .15s;
    line-height: 1;
}

.tpc-service-card.is-active .tpc-svc-card__check {
    background: #6366f1;
    border-color: #6366f1;
}

.tpc-service-card.is-active .tpc-svc-card__check-icon {
    opacity: 1;
}

/* ── Card body ───────────────────────────────────────────────────────── */
.tpc-svc-card__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tpc-svc-card__name {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    transition: color .15s;
}

.tpc-service-card.is-active .tpc-svc-card__name {
    color: #3730a3;
}

.tpc-svc-card__desc {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.4;
}

/* ── Rate display ────────────────────────────────────────────────────── */
.tpc-svc-card__rate {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
}

.tpc-svc-card__rate-value {
    font-size: 14px;
    font-weight: 700;
    color: #374151;
    transition: color .15s;
}

.tpc-service-card.is-active .tpc-svc-card__rate-value {
    color: #4338ca;
}

.tpc-svc-card__rate-unit {
    font-size: 10px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .3px;
}

/* ── Summary services row ────────────────────────────────────────────── */
.tpc-summary-row--services .tpc-summary-label { color: #6366f1; }
.tpc-summary-row--services .tpc-summary-value { color: #4338ca; }

.tpc-summary-row--base .tpc-summary-label { color: #6b7280; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media ( max-width: 480px ) {
    .tpc-svc-card__desc { display: none; }
}
