/* =========================================================
   Toska Price Calculator - Frontend Styles (RTL + Responsive)
   Brand Palette: #2E473B (Forest Green), #5C3A21 (Wood), #F7F3EE (Cream)
   ========================================================= */

.tpc-wrapper,
.tpc-wrapper * {
    box-sizing: border-box;
}

.tpc-wrapper {
    scroll-margin-top: var(--tpc-scroll-offset, 96px);
    --tpc-bg: #F7F3EE;
    --tpc-card: #FFFFFF;
    --tpc-border: #E5DDD3;
    --tpc-soft: #EFE8DF;
    --tpc-primary: #2E473B;
    --tpc-primary-hover: #22352C;
    --tpc-brand: #5C3A21;
    --tpc-text: #1E1E1E;
    --tpc-muted: #665E57;
    --tpc-danger: #B42318;
    --tpc-danger-bg: #FEF3F2;

    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: 8px 0;
    direction: rtl;
    text-align: right;
    color: var(--tpc-text);
    font-family: "Vazirmatn FD", "Vazirmatn", inherit, Tahoma, sans-serif;
    line-height: 1.7;
    overflow-x: hidden;
}

.tpc-card {
    background: var(--tpc-card);
    border: 1px solid var(--tpc-border);
    border-radius: 22px;
    box-shadow: 0 14px 38px rgba(30, 30, 30, 0.06);
    padding: 28px 30px;
    overflow: hidden;
}

/* Header & Progress */
.tpc-header {
    margin-bottom: 26px;
}

.tpc-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.tpc-badge {
    display: inline-flex;
    align-items: center;
    background: var(--tpc-soft);
    color: var(--tpc-brand);
    font-size: 13px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 999px;
}

.tpc-step-counter {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--tpc-primary);
    background: #EDF3F0;
    padding: 4px 12px;
    border-radius: 999px;
}

.tpc-progress-track {
    width: 100%;
    height: 8px;
    background: var(--tpc-soft);
    border-radius: 999px;
    overflow: hidden;
}

.tpc-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--tpc-brand), var(--tpc-primary));
    border-radius: 999px;
    transition: width 0.35s ease;
}

/* Steps */
.tpc-step {
    display: none;
    animation: tpcFadeIn 0.28s ease;
}

.tpc-step.is-active {
    display: block;
}

@keyframes tpcFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tpc-step-head {
    margin-bottom: 22px;
}

.tpc-title {
    margin: 0 0 8px 0 !important;
    font-size: 22px;
    font-weight: 800;
    color: var(--tpc-text);
    line-height: 1.45;
}

.tpc-subtitle {
    margin: 0 !important;
    font-size: 14.5px;
    color: var(--tpc-muted);
    line-height: 1.7;
}

/* Step 1: Image Selection Cards */
.tpc-image-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.tpc-image-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--tpc-card);
    border: 2px solid var(--tpc-border);
    border-radius: 18px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.tpc-image-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tpc-image-card:hover {
    transform: translateY(-3px);
    border-color: #B6A999;
    box-shadow: 0 12px 26px rgba(46, 71, 59, 0.08);
}

.tpc-image-card.is-selected {
    border-color: var(--tpc-primary);
    box-shadow: 0 12px 28px rgba(46, 71, 59, 0.14);
}

.tpc-image-box {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: var(--tpc-bg);
    overflow: hidden;
}

.tpc-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.tpc-image-card:hover .tpc-image-box img {
    transform: scale(1.03);
}

.tpc-check-pill {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid var(--tpc-border);
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.tpc-image-card.is-selected .tpc-check-pill {
    background: var(--tpc-primary);
    border-color: var(--tpc-primary);
    color: #FFFFFF;
}

.tpc-image-card-body {
    padding: 18px 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.tpc-image-card-body h3 {
    margin: 0 !important;
    font-size: 18px;
    font-weight: 800;
    color: var(--tpc-text);
}

.tpc-image-card-body p {
    margin: 0 !important;
    font-size: 13.5px;
    color: var(--tpc-muted);
    line-height: 1.65;
}

.tpc-meta-tag {
    align-self: flex-start;
    margin-top: auto;
    padding: 3px 10px;
    border-radius: 8px;
    background: var(--tpc-soft);
    color: var(--tpc-brand);
    font-size: 12px;
    font-weight: 700;
}

/* Choice Cards (Materials / Structure / Height / Doors) */
.tpc-choice-grid {
    display: grid;
    gap: 14px;
}

.tpc-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tpc-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tpc-choice-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: var(--tpc-bg);
    border: 2px solid var(--tpc-border);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tpc-choice-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tpc-choice-card:hover {
    border-color: #BBAFA0;
    background: #FFFFFF;
}

.tpc-choice-card.is-selected {
    background: #FFFFFF;
    border-color: var(--tpc-primary);
    box-shadow: 0 8px 20px rgba(46, 71, 59, 0.1);
}

.tpc-choice-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tpc-choice-title {
    font-size: 15.5px;
    font-weight: 800;
    color: var(--tpc-text);
}

.tpc-radio-dot {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid #BFB5A8;
    background: #FFFFFF;
    position: relative;
    transition: all 0.2s ease;
}

.tpc-choice-card.is-selected .tpc-radio-dot {
    border-color: var(--tpc-primary);
    background: var(--tpc-primary);
    box-shadow: inset 0 0 0 4px #FFFFFF;
}

.tpc-choice-desc {
    font-size: 13px;
    color: var(--tpc-muted);
    line-height: 1.6;
}

/* Yes / No Toggle Bar */
.tpc-toggle-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    max-width: 380px;
    margin-bottom: 20px;
}

.tpc-toggle-opt {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--tpc-bg);
    border: 2px solid var(--tpc-border);
    font-size: 15px;
    font-weight: 700;
    color: var(--tpc-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tpc-toggle-opt input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tpc-toggle-opt.is-selected {
    background: var(--tpc-primary);
    border-color: var(--tpc-primary);
    color: #FFFFFF;
}

.tpc-conditional-body {
    padding: 18px;
    border-radius: 16px;
    background: var(--tpc-bg);
    border: 1px solid var(--tpc-border);
}

/* Form Fields & Steppers */
.tpc-fields-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.tpc-field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.tpc-dims-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.tpc-field-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tpc-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--tpc-text);
}

.tpc-req {
    color: var(--tpc-danger);
}

.tpc-input,
.tpc-select {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1.5px solid var(--tpc-border);
    background: #FFFFFF;
    color: var(--tpc-text);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tpc-input:focus,
.tpc-select:focus {
    border-color: var(--tpc-primary);
    box-shadow: 0 0 0 3px rgba(46, 71, 59, 0.12);
}

.tpc-stepper {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.tpc-step-btn {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border: none;
    border-radius: 12px;
    background: var(--tpc-primary);
    color: #FFFFFF;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, transform 0.1s ease;
    padding: 0;
}

.tpc-step-btn:hover {
    background: var(--tpc-primary-hover);
}

.tpc-step-btn:active {
    transform: scale(0.95);
}

.tpc-num-input {
    text-align: center;
    direction: ltr;
    font-size: 17px;
    font-weight: 800;
}

/* Checkboxes & City Pills */
.tpc-check-group,
.tpc-city-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tpc-check-pill-opt,
.tpc-city-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 12px;
    background: #FFFFFF;
    border: 1.5px solid var(--tpc-border);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tpc-check-pill-opt input,
.tpc-city-pill input {
    accent-color: var(--tpc-primary);
    width: 17px;
    height: 17px;
    margin: 0;
}

.tpc-check-pill-opt.is-selected,
.tpc-city-pill.is-selected {
    border-color: var(--tpc-primary);
    background: #EDF3F0;
    color: var(--tpc-primary);
}

.tpc-help {
    margin: 2px 0 0 0 !important;
    font-size: 12.5px;
    color: var(--tpc-muted);
}

/* Live Metric Banner for Wardrobe */
.tpc-live-metric {
    margin-top: 18px;
    padding: 14px 18px;
    border-radius: 14px;
    background: var(--tpc-soft);
    color: var(--tpc-brand);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 14.5px;
}

.tpc-live-metric strong {
    font-size: 17px;
    font-weight: 800;
    color: var(--tpc-primary);
}

/* Contact Step */
.tpc-lock-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: #EDF3F0;
    color: var(--tpc-primary);
    font-size: 12.5px;
    font-weight: 700;
    margin-bottom: 10px;
}

.tpc-contact-box {
    padding: 22px;
    border-radius: 18px;
    background: var(--tpc-bg);
    border: 1px solid var(--tpc-border);
}

/* Final Result Step */
.tpc-result-banner {
    background: linear-gradient(135deg, var(--tpc-primary) 0%, #20332A 100%);
    color: #FFFFFF;
    padding: 28px 24px;
    border-radius: 18px;
    text-align: center;
    margin-bottom: 20px;
}

.tpc-result-label {
    display: block;
    font-size: 14px;
    color: #EFE8DF;
    margin-bottom: 8px;
}

.tpc-result-total {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: #FFFFFF;
}

.tpc-result-range {
    margin-top: 8px;
    font-size: 13.5px;
    color: #E3D9CD;
}

.tpc-breakdown-card {
    background: var(--tpc-bg);
    border: 1px solid var(--tpc-border);
    border-radius: 16px;
    padding: 18px 20px;
    margin-bottom: 16px;
}

.tpc-breakdown-card h3 {
    margin: 0 0 14px 0 !important;
    font-size: 16px;
    font-weight: 800;
    color: var(--tpc-brand);
}

.tpc-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tpc-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--tpc-border);
}

.tpc-breakdown-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.tpc-bi-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--tpc-text);
}

.tpc-bi-detail {
    font-size: 12.5px;
    color: var(--tpc-muted);
    margin-top: 2px;
}

.tpc-bi-price {
    font-size: 14.5px;
    font-weight: 800;
    color: var(--tpc-primary);
    white-space: nowrap;
}

.tpc-disclaimer {
    background: #FFFBF4;
    border: 1px solid #EADBC6;
    color: #5C3A21;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.75;
    margin-bottom: 20px;
}

.tpc-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Error Box */
.tpc-error-box {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--tpc-danger-bg);
    border: 1px solid #FECDCA;
    color: var(--tpc-danger);
    font-size: 14px;
    font-weight: 700;
}

/* Footer Navigation & Buttons */
.tpc-footer {
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--tpc-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tpc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none !important;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.tpc-btn-primary {
    background: var(--tpc-primary);
    color: #FFFFFF !important;
    margin-right: auto;
}

.tpc-btn-primary:hover {
    background: var(--tpc-primary-hover);
    color: #FFFFFF !important;
}

.tpc-btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.tpc-btn-secondary {
    background: var(--tpc-soft);
    color: var(--tpc-brand) !important;
}

.tpc-btn-secondary:hover {
    background: #E4D9CB;
}

.tpc-btn-outline {
    background: #FFFFFF;
    border-color: var(--tpc-primary);
    color: var(--tpc-primary) !important;
}

.tpc-btn-outline:hover {
    background: #EDF3F0;
}

.tpc-btn-ghost {
    background: transparent;
    color: var(--tpc-muted) !important;
    border-color: var(--tpc-border);
}

.tpc-btn-ghost:hover {
    background: var(--tpc-bg);
    color: var(--tpc-text) !important;
}

.tpc-result-actions .tpc-btn-primary {
    margin-right: 0;
}

/* Spinner */
.tpc-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: tpcSpin 0.7s linear infinite;
}

@keyframes tpcSpin {
    to { transform: rotate(360deg); }
}

.is-hidden {
    display: none !important;
}

/* =========================================================
   Responsive Breakpoints (Tablet & Mobile)
   ========================================================= */
@media (max-width: 768px) {
    .tpc-card {
        padding: 20px 18px;
        border-radius: 18px;
    }

    .tpc-title {
        font-size: 19px;
    }

    .tpc-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .tpc-result-total {
        font-size: 26px;
    }
}

@media (max-width: 560px) {
    .tpc-card {
        padding: 18px 14px;
        border-radius: 16px;
    }

    .tpc-image-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .tpc-image-box {
        aspect-ratio: 16 / 9;
    }

    .tpc-image-card-body {
        padding: 14px;
    }

    .tpc-cols-3,
    .tpc-cols-2 {
        grid-template-columns: 1fr;
    }

    .tpc-toggle-bar {
        max-width: 100%;
    }

    .tpc-conditional-body,
    .tpc-contact-box {
        padding: 14px;
    }

    .tpc-footer {
        flex-wrap: nowrap;
    }

    .tpc-footer .tpc-btn {
        flex: 1;
        padding: 12px 14px;
        font-size: 14px;
    }

    .tpc-result-actions {
        flex-direction: column;
    }

    .tpc-result-actions .tpc-btn {
        width: 100%;
    }

    .tpc-breakdown-item {
        flex-direction: column;
        gap: 4px;
    }
}
