/* ============================================================
   Bathroom Tile Estimator — Front-end Styles
   All selectors scoped to .bte-wrap to avoid theme conflicts
   ============================================================ */

/* ------ Reset & base ------ */
.bte-wrap *,
.bte-wrap *::before,
.bte-wrap *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
.bte-wrap {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #191c1e;
    background: #f7f9fb;
    padding: 24px 0;
    max-width: 1200px;
    margin: 0 auto;
}
.bte-hidden { display: none !important; }

/* ------ Header ------ */
.bte-header {
    margin-bottom: 24px;
}
.bte-main-title {
    font-size: 28px;
    font-weight: 700;
    color: #131b2e;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.bte-subtitle {
    font-size: 15px;
    color: #45464d;
    margin-top: 6px;
}

/* ------ Layout ------ */
.bte-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}
@media (max-width: 900px) {
    .bte-layout {
        grid-template-columns: 1fr;
    }
    .bte-summary-sticky {
        position: static !important;
    }
}

/* ------ Cards ------ */
.bte-inputs-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.bte-card {
    background: #ffffff;
    border: 1px solid #c6c6cd;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(15,23,42,0.05);
}
.bte-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: #f2f4f6;
    border-bottom: 1px solid #c6c6cd;
}
.bte-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #131b2e;
    flex: 1;
}
.bte-icon {
    width: 20px;
    height: 20px;
    color: #006c49;
    flex-shrink: 0;
}
.bte-step-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #006c49;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.bte-optional-badge {
    font-size: 11px;
    font-weight: 600;
    color: #76777d;
    background: #eceef0;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.bte-card-body {
    padding: 20px;
}
.bte-section-hint {
    font-size: 13px;
    color: #45464d;
    margin-bottom: 16px;
    background: #f2f4f6;
    border-left: 3px solid #006c49;
    padding: 8px 12px;
    border-radius: 0 6px 6px 0;
}

/* ------ Dimension Inputs ------ */
.bte-dim-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
@media (max-width: 520px) {
    .bte-dim-grid { grid-template-columns: 1fr; }
}
.bte-dim-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #45464d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.bte-dual-input {
    display: flex;
    gap: 8px;
}
.bte-unit-input {
    position: relative;
    flex: 1;
}
.bte-unit-input input {
    width: 100%;
    padding: 10px 38px 10px 12px;
    border: 1px solid #c6c6cd;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    color: #191c1e;
    background: #f7f9fb;
    transition: border-color 0.15s, box-shadow 0.15s;
    -moz-appearance: textfield;
}
.bte-unit-input input::-webkit-outer-spin-button,
.bte-unit-input input::-webkit-inner-spin-button { -webkit-appearance: none; }
.bte-unit-input input:focus {
    outline: none;
    border-color: #006c49;
    box-shadow: 0 0 0 3px rgba(0,108,73,0.12);
    background: #fff;
}
.bte-unit-label {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
    color: #76777d;
    pointer-events: none;
}

/* Generic field */
.bte-field {
    margin-bottom: 16px;
}
.bte-field:last-child { margin-bottom: 0; }
.bte-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #45464d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.bte-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #c6c6cd;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    color: #191c1e;
    background: #f7f9fb;
    transition: border-color 0.15s, box-shadow 0.15s;
    -moz-appearance: textfield;
}
.bte-input::-webkit-outer-spin-button,
.bte-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.bte-input:focus {
    outline: none;
    border-color: #006c49;
    box-shadow: 0 0 0 3px rgba(0,108,73,0.12);
    background: #fff;
}
.bte-input-suffix {
    position: relative;
    display: flex;
    align-items: center;
}
.bte-input-suffix .bte-input {
    padding-right: 52px;
}
.bte-input-suffix span {
    position: absolute;
    right: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #76777d;
    pointer-events: none;
    white-space: nowrap;
}
.bte-field-hint {
    font-size: 12px;
    color: #76777d;
    margin-top: 6px;
    font-style: italic;
}

/* ------ Tile Grid ------ */
.bte-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.bte-no-tiles-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px 16px;
    color: #76777d;
}
.bte-no-tiles-msg svg {
    width: 36px;
    height: 36px;
    margin: 0 auto 10px;
    display: block;
}
.bte-tile-card {
    border: 2px solid #e0e3e5;
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    text-align: center;
    position: relative;
}
.bte-tile-card:hover {
    border-color: #4edea3;
    box-shadow: 0 2px 8px rgba(0,108,73,0.12);
    transform: translateY(-1px);
}
.bte-tile-card.bte-selected {
    border-color: #006c49;
    background: #f0fdf7;
    box-shadow: 0 0 0 3px rgba(0,108,73,0.15);
}
.bte-tile-card-img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #eceef0;
}
.bte-tile-card-img-placeholder {
    width: 100%;
    height: 90px;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #eceef0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c6c6cd;
}
.bte-tile-card-name {
    font-size: 12px;
    font-weight: 600;
    color: #191c1e;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bte-tile-card-meta {
    font-size: 11px;
    color: #76777d;
}
.bte-tile-card-check {
    display: none;
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #006c49;
    color: #fff;
    align-items: center;
    justify-content: center;
}
.bte-tile-card.bte-selected .bte-tile-card-check { display: flex; }

/* Selected tile summary */
.bte-tile-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f0fdf7;
    border: 1px solid #4edea3;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}
.bte-tile-summary-img-wrap {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #eceef0;
}
.bte-tile-summary-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.bte-tile-summary-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.bte-tile-summary-info strong {
    font-size: 14px;
    color: #131b2e;
}

/* Chips */
.bte-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: #eceef0;
    color: #45464d;
}
.bte-chip-green {
    background: #6cf8bb;
    color: #00714d;
}
.bte-chip-grey {
    background: #e0e3e5;
    color: #45464d;
}

/* Grout joint button group */
.bte-grout-field { margin-top: 16px; }
.bte-btn-group {
    display: flex;
    gap: 8px;
}
.bte-btn-option {
    flex: 1;
    padding: 9px 8px;
    border: 1.5px solid #c6c6cd;
    border-radius: 8px;
    background: #f7f9fb;
    color: #45464d;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.bte-btn-option:hover {
    border-color: #006c49;
    color: #006c49;
    background: #f0fdf7;
}
.bte-btn-option.bte-selected {
    border-color: #006c49;
    background: #006c49;
    color: #fff;
}

/* ------ Pattern Selector ------ */
.bte-pattern-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 0;
}
@media (max-width: 640px) {
    .bte-pattern-grid { grid-template-columns: repeat(2, 1fr); }
}
.bte-pattern-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 2px solid #e0e3e5;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
    text-align: center;
}
.bte-pattern-card:hover {
    border-color: #4edea3;
    background: #f0fdf7;
}
.bte-pattern-card.bte-selected {
    border-color: #006c49;
    background: #f0fdf7;
    box-shadow: 0 0 0 3px rgba(0,108,73,0.12);
}
.bte-pattern-preview {
    width: 56px;
    height: 56px;
    color: #45464d;
}
.bte-pattern-card.bte-selected .bte-pattern-preview { color: #006c49; }
.bte-pattern-preview svg {
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.bte-pattern-name {
    font-weight: 600;
    color: #191c1e;
    font-size: 12px;
    line-height: 1.3;
}
.bte-pattern-waste {
    font-size: 11px;
    color: #76777d;
}
.bte-pattern-card.bte-selected .bte-pattern-waste { color: #006c49; font-weight: 600; }

.bte-waste-override-field { margin-top: 16px; }

/* ------ Walls (collapsible) ------ */
.bte-collapsible-header {
    cursor: pointer;
    user-select: none;
}
.bte-collapsible-header:focus-visible {
    outline: 2px solid #006c49;
    outline-offset: -2px;
}
.bte-toggle-wrap {
    margin-left: auto;
}
.bte-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}
.bte-toggle input { display: none; }
.bte-toggle-slider {
    position: absolute;
    inset: 0;
    background: #c6c6cd;
    border-radius: 999px;
    transition: background 0.2s;
}
.bte-toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}
.bte-toggle input:checked + .bte-toggle-slider { background: #006c49; }
.bte-toggle input:checked + .bte-toggle-slider::before { transform: translateX(20px); }
.bte-chevron {
    width: 18px;
    height: 18px;
    color: #76777d;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.bte-chevron.bte-open { transform: rotate(180deg); }

/* Wall rows */
.bte-wall-row {
    display: grid;
    grid-template-columns: auto 1fr 1fr 1fr auto;
    gap: 10px;
    align-items: end;
    padding: 12px 0;
    border-bottom: 1px dashed #e0e3e5;
}
.bte-wall-row:last-child { border-bottom: none; }
.bte-wall-row-label {
    font-size: 12px;
    font-weight: 600;
    color: #006c49;
    padding-bottom: 10px;
    white-space: nowrap;
}
.bte-wall-field label {
    font-size: 11px;
    font-weight: 600;
    color: #76777d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: block;
    margin-bottom: 4px;
}
@media (max-width: 600px) {
    .bte-wall-row {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
    }
    .bte-wall-row-label { grid-column: 1 / -1; }
    .bte-wall-remove { grid-column: 2; grid-row: 3; justify-self: end; }
}
.bte-wall-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #ba1a1a;
    padding: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: background 0.15s;
}
.bte-wall-remove:hover { background: #ffdad6; }
.bte-wall-remove svg { width: 16px; height: 16px; }

.bte-btn-add-wall {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 8px 16px;
    border: 1.5px dashed #006c49;
    border-radius: 8px;
    background: transparent;
    color: #006c49;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.bte-btn-add-wall svg { width: 18px; height: 18px; }
.bte-btn-add-wall:hover { background: #f0fdf7; }

/* ------ Summary Sidebar ------ */
.bte-summary-sticky {
    position: sticky;
    top: 24px;
}
.bte-summary-card {
    background: #fff;
    border: 1px solid #c6c6cd;
    border-left: 4px solid #006c49;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(15,23,42,0.08);
}
#bte-summary-card {
    background: #fff;
    border: 1px solid #c6c6cd;
    border-left: 4px solid #006c49;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(15,23,42,0.08);
}
.bte-summary-header {
    padding: 16px 20px;
    background: #131b2e;
    color: #fff;
}
.bte-summary-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}
.bte-summary-header p {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-top: 2px;
}
.bte-summary-body {
    padding: 16px 20px;
}
.bte-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px dashed #e0e3e5;
    font-size: 14px;
}
.bte-summary-row:last-of-type { border-bottom: none; }
.bte-summary-row span { color: #45464d; }
.bte-summary-row strong { font-weight: 700; color: #131b2e; }
.bte-summary-row-total {
    font-weight: 600;
}
.bte-summary-row-total span { color: #191c1e; }
.bte-summary-row-total strong { color: #006c49; }

.bte-summary-divider {
    height: 1px;
    background: #e0e3e5;
    margin: 12px 0;
}
.bte-summary-boxes {
    text-align: center;
    padding: 16px 0 10px;
}
.bte-boxes-count {
    font-size: 48px;
    font-weight: 700;
    color: #131b2e;
    line-height: 1;
}
.bte-boxes-label {
    font-size: 13px;
    color: #45464d;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.bte-summary-message {
    font-size: 13px;
    color: #191c1e;
    background: #f0fdf7;
    border-left: 3px solid #006c49;
    padding: 10px 12px;
    border-radius: 0 6px 6px 0;
    margin: 10px 0 4px;
    line-height: 1.5;
}
.bte-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 14px;
}
.bte-summary-total span {
    font-size: 13px;
    font-weight: 600;
    color: #45464d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.bte-summary-total strong {
    font-size: 28px;
    font-weight: 700;
    color: #006c49;
}

.bte-btn-pdf {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 16px;
    background: #006c49;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    margin-top: 4px;
}
.bte-btn-pdf svg { width: 18px; height: 18px; }
.bte-btn-pdf:hover { background: #005236; }
.bte-btn-pdf:active { transform: scale(0.98); }
.bte-btn-pdf:disabled {
    background: #c6c6cd;
    cursor: not-allowed;
}

.bte-disclaimer {
    padding: 12px 20px;
    font-size: 11px;
    color: #76777d;
    border-top: 1px solid #e0e3e5;
    line-height: 1.5;
    font-style: italic;
}
