/* listing_engine Wizard Styles */

/* Reset & Variables */
:root {
    --primary: #004225; /* British Racing Green */
    --primary-hover: #002b18;
    --accent: #D4AF37; /* Luxury Gold */
    --bg-color: #FDFDFD;
    --text-main: #1A202C;
    --text-light: #718096;
    --white: #FFFFFF;
    --card-shadow: 0 12px 30px rgba(1, 50, 32, 0.08);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --error-red: #e53e3e;
    --success-green: #38A169;
    --warning-amber: #D69E2E;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
}

/* Wizard Container */
.wizard-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 20px 130px;
    min-height: 100vh;
}

/* Wizard Header */
.wizard-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--border-radius);
    padding: 25px 30px;
    margin-bottom: 25px;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(0,0,0,0.03);
}

.wizard-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wizard-title h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
}

.wizard-title .material-symbols-rounded {
    color: var(--primary);
    font-size: 2rem;
}

/* Wizard header topbar (title left, actions right; wraps on mobile) */
.wizard-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.wizard-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Header compact buttons (higher specificity than global .btn overrides) */
.wizard-actions .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
    min-height: 44px;
}

#btnDiscard {
    color: var(--error-red);
    border-color: var(--error-red);
}

/* Two-column form grids that collapse to one column on small screens */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Field labels with trailing action buttons (e.g. Suggest Price) */
.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* AVM result cards — tappable Aggressive / Fair Market / Quick Sale.
   Buttons inherit browser font styles, so reset them; the per-card
   colours stay inline in create.html. 56px min height = elder-friendly
   touch target per the upgrade.css baseline. */
.avm-price-card {
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.3;
    min-height: 56px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.avm-price-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(1, 50, 32, 0.12);
}

.avm-price-card:active {
    transform: scale(0.97);
}

.avm-price-card .avm-apply-hint {
    font-size: 0.68rem;
    font-weight: 600;
    opacity: 0.65;
    text-transform: none;
    letter-spacing: 0;
}

.avm-price-card.selected {
    box-shadow: 0 0 0 3px rgba(0, 66, 37, 0.35);
}

.avm-price-card.selected .avm-apply-hint::after {
    content: " ✓";
    opacity: 1;
}

/* Confirmation pulse on the asking-price input after a card tap. */
@keyframes priceAppliedFlash {
    0% { background-color: #F0FFF4; box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.35); }
    100% { background-color: var(--white); box-shadow: none; }
}

.price-applied-flash {
    animation: priceAppliedFlash 1.2s ease-out;
}

/* Progress Bar */
.progress-container {
    position: relative;
    height: 8px;
    background: #E2E8F0;
    border-radius: 4px;
    margin-top: 20px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* Wizard Body */
.wizard-body {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--card-shadow);
    min-height: 400px;
    border: 1px solid rgba(0,0,0,0.03);
}

.wizard-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.wizard-step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.step-subtitle {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 25px;
}

/* Selection Cards */
.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.selection-card {
    background: var(--white);
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    padding: 25px 15px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.selection-card:hover {
    border-color: var(--accent);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 30px rgba(1, 50, 32, 0.15);
}

.selection-card.selected {
    border-color: var(--primary);
    background: rgba(1, 50, 32, 0.05);
    box-shadow: 0 0 0 2px var(--primary);
}

.selection-card .material-symbols-rounded {
    font-size: 2.5rem;
    color: var(--primary);
}

.selection-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Input Groups */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.input-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #E2E8F0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    background: var(--white);
    transition: var(--transition);
}

.input-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 66, 37, 0.08);
}

.input-control::placeholder {
    color: #A0AEC0;
}

select.input-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

textarea.input-control {
    resize: vertical;
    min-height: 120px;
}

/* Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 2px solid #E2E8F0;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
}

.checkbox-item:hover {
    border-color: var(--primary);
    background: #F7FAFC;
}

.checkbox-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed #CBD5E0;
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: #F7FAFC;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: #F0FFF4;
}

.upload-zone .material-symbols-rounded {
    color: var(--primary);
}

/* Photo Grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.photo-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    aspect-ratio: 1 / 1;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-item button {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
}

.photo-item .cover-badge {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: var(--primary);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.photo-item .set-cover-btn {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 1px solid white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(0, 66, 37, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 66, 37, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    background-color: transparent;
    color: var(--text-main);
    border: 2px solid #E2E8F0;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-secondary {
    background-color: #EDF2F7;
    color: var(--text-main);
    border: 2px solid transparent;
}

.btn-secondary:hover {
    background-color: #E2E8F0;
}

/* Wizard Footer */
.wizard-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    padding: 15px 30px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.wizard-footer .btn {
    min-width: 140px;
}

/* Error Messages */
.error-msg {
    color: var(--error-red);
    font-size: 0.85rem;
    margin-top: 4px;
    font-weight: 500;
}

/* Quota Modal */
#quotaModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#quotaModal[style*="flex"] {
    display: flex !important;
}

/* Loading Spinner */
@keyframes spin {
    100% { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 9999;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.toast-success {
    background: var(--success-green);
    color: white;
}

.toast-error {
    background: var(--error-red);
    color: white;
}

.toast-info {
    background: #3182CE;
    color: white;
}

/* Responsive */
@media (max-width: 600px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
    }

    .label-row {
        flex-direction: column;
        align-items: flex-start;
        row-gap: 6px;
    }

    .label-row .btn {
        min-height: 36px;
    }
}

@media (max-width: 767px) {
    .wizard-container {
        padding: 15px 15px 145px;
    }

    .wizard-header {
        padding: 16px;
    }

    .wizard-body {
        padding: 20px;
    }

    .selection-grid {
        grid-template-columns: 1fr 1fr;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .wizard-footer {
        padding: 12px 15px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }

    .btn {
        padding: 10px 18px;
        font-size: 0.95rem;
    }

    /* Header stacks on phones so Exit/Discard never overflow */
    .wizard-topbar {
        flex-wrap: wrap;
        row-gap: 12px;
    }

    .wizard-actions {
        gap: 10px;
        margin-left: auto;
    }

    .wizard-actions .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    #save-status {
        display: none !important;
    }
}

/* Tablet (768-1023px): 2-col selection & checkbox grids, 900px wizard container */
@media (min-width: 768px) and (max-width: 1023px) {
    .wizard-container {
        max-width: 900px;
        padding: 20px 24px 110px;
    }

    .selection-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .checkbox-item {
        min-height: 56px;
        padding: 12px 16px;
    }

    .wizard-footer .btn {
        min-width: 160px;
    }
}

@media (max-width: 480px) {
    .selection-grid {
        grid-template-columns: 1fr;
    }

    .wizard-title h2 {
        font-size: 1.15rem;
    }

    .wizard-title .material-symbols-rounded {
        font-size: 1.6rem;
    }

    .step-title {
        font-size: 1.2rem;
    }

    #quotaModal > div {
        padding: 22px 18px;
    }

    #quotaModal h3 {
        font-size: 1.25rem;
    }
}
