/* ── Base ── */
.pb-safe {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Buttons ── */
.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #0f766e;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: all 0.25s ease;
}

.btn-secondary:hover {
    background: #f0fdfa;
    border-color: #5eead4;
}

.btn-secondary:active {
    transform: scale(0.98);
}

.btn-nav-back {
    padding: 0.875rem 1.5rem;
    border-radius: 1rem;
    font-weight: 500;
    color: #64748b;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: all 0.25s ease;
}

.btn-nav-back:hover {
    color: #334155;
    background: #f8fafc;
}

.btn-nav-next {
    padding: 0.875rem 1.5rem;
    border-radius: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.25);
    transition: all 0.25s ease;
}

.btn-nav-next:hover {
    box-shadow: 0 6px 24px rgba(13, 148, 136, 0.3);
    transform: translateY(-1px);
}

.btn-nav-next:active {
    transform: translateY(0) scale(0.98);
}

.btn-nav-next:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Upload zone ── */
.upload-zone.drag-over {
    border-color: #14b8a6;
    background: #f0fdfa;
    transform: scale(1.01);
}

/* ── Shape & fence grids ── */
.shape-btn,
.fence-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
    padding: 1.25rem 0.75rem;
    border-radius: 1rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: all 0.25s ease;
}

.fence-btn {
    padding: 1rem 0.75rem;
}

.shape-btn:hover,
.fence-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.shape-btn.selected,
.fence-btn.selected {
    background: #ecfdf5;
    border-color: #14b8a6;
    color: #0f766e;
    box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.15), 0 4px 12px rgba(20, 184, 166, 0.12);
}

.shape-icon {
    width: 3rem;
    height: 2rem;
}

.shape-btn span,
.fence-btn span {
    font-size: 0.8125rem;
    font-weight: 500;
}

.fence-color {
    border-radius: 0.625rem;
}

/* ── Sliders ── */
.luxury-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: #e2e8f0;
    outline: none;
    cursor: pointer;
}

.luxury-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2dd4bf, #14b8a6);
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.35);
    cursor: grab;
    transition: transform 0.15s ease;
}

.luxury-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.15);
}

.luxury-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2dd4bf, #14b8a6);
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.35);
    cursor: grab;
}

/* ── Footprint preview shapes ── */
.footprint-rectangle { border-radius: 4px; }
.footprint-oval { border-radius: 50%; }
.footprint-l-shape {
    clip-path: polygon(0 0, 55% 0, 55% 45%, 100% 45%, 100% 100%, 0 100%);
    border-radius: 4px;
}
.footprint-freeform { border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%; }

/* ── Color swatches ── */
.swatch {
    aspect-ratio: 1;
    border-radius: 0.875rem;
    background: var(--swatch);
    border: 2px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
}

.swatch:hover {
    transform: scale(1.08);
}

.swatch.selected {
    border-color: #14b8a6;
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, 0.08),
        0 0 0 2px rgba(20, 184, 166, 0.25),
        0 4px 12px rgba(20, 184, 166, 0.15);
    transform: scale(1.05);
}

.swatch.selected::after {
    content: '';
    position: absolute;
    inset: auto auto 4px 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #14b8a6;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2.5-2.5a1 1 0 1 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0Z'/%3E%3C/svg%3E");
    background-size: 10px;
    background-repeat: no-repeat;
    background-position: center;
}

/* ── Accessory cards ── */
.accessory-card {
    display: block;
    cursor: pointer;
}

.accessory-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.125rem;
    border-radius: 1rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: all 0.25s ease;
}

.accessory-card:hover .accessory-inner {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.accessory-input:checked + .accessory-inner {
    background: #ecfdf5;
    border-color: #14b8a6;
    box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.12);
}

.accessory-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.accessory-check {
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 0.375rem;
    border: 2px solid #cbd5e1;
    flex-shrink: 0;
    transition: all 0.2s ease;
    position: relative;
}

.accessory-input:checked + .accessory-inner .accessory-check {
    background: #14b8a6;
    border-color: #14b8a6;
}

.accessory-input:checked + .accessory-inner .accessory-check::after {
    content: '';
    position: absolute;
    inset: 2px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2.5-2.5a1 1 0 1 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0Z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

/* ── Custom instructions ── */
.custom-instructions {
    width: 100%;
    min-height: 140px;
    padding: 1rem 1.125rem;
    border-radius: 1rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 0.9375rem;
    line-height: 1.6;
    resize: vertical;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.custom-instructions::placeholder {
    color: #94a3b8;
}

.custom-instructions:focus {
    outline: none;
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

/* ── Wizard step transitions ── */
.wizard-step {
    animation: slideUp 0.45s ease-out forwards;
}

.wizard-step.step-exit {
    animation: fadeOut 0.25s ease-in forwards;
}

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

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

/* ── Progress dots ── */
.progress-dot {
    background: #e2e8f0 !important;
}

.progress-dot.active {
    background: #14b8a6 !important;
    box-shadow: 0 0 8px rgba(20, 184, 166, 0.35);
}

.progress-dot.completed {
    background: #99f6e4 !important;
}

/* ── Glassmorphism loading overlay ── */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(240, 249, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.glass-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem 3rem;
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #e2e8f0;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #e2e8f0;
    border-top-color: #14b8a6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Results summary cards ── */
.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.125rem;
    border-radius: 0.875rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.summary-row dt {
    font-size: 0.8125rem;
    color: #64748b;
}

.summary-row dd {
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
    text-align: right;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
