/**
 * HomeWorth Engine Wizard Styles
 *
 * CSS for the one-question-at-a-time wizard UI.
 * Mobile-first design with smooth animations.
 *
 * @package HomeWorthEngine
 * @since 2.1.0
 */

/* ==========================================================================
   Variables
   ========================================================================== */

:root {
    --hwe-primary: #2563eb;
    --hwe-primary-hover: #1d4ed8;
    --hwe-secondary: #64748b;
    --hwe-success: #10b981;
    --hwe-error: #ef4444;
    --hwe-bg: #ffffff;
    --hwe-bg-secondary: #f8fafc;
    --hwe-text: #1e293b;
    --hwe-text-secondary: #64748b;
    --hwe-border: #e2e8f0;
    --hwe-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --hwe-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --hwe-radius: 12px;
    --hwe-radius-sm: 8px;
    --hwe-transition: 0.3s ease;
}

/* ==========================================================================
   Wizard Container
   ========================================================================== */

.hwe-wizard {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--hwe-bg);
    border-radius: var(--hwe-radius);
    box-shadow: var(--hwe-shadow-lg);
    overflow: visible;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
}

/* Wrapper - override WordPress constrained layout */
.hwe-wizard-wrapper {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Ensure parent containers don't clip */
#homeworth-wizard {
    overflow: visible !important;
}

/* Override common WordPress theme layout issues */
.entry-content,
.post-content,
.page-content,
.wp-block-post-content,
article {
    overflow: visible !important;
}

/* ==========================================================================
   Progress Header
   ========================================================================== */

.hwe-wizard-header {
    padding: 16px 24px;
    background: var(--hwe-bg-secondary);
    border-bottom: 1px solid var(--hwe-border);
}

.hwe-wizard-progress {
    height: 6px;
    background: var(--hwe-border);
    border-radius: 3px;
    overflow: hidden;
}

.hwe-wizard-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--hwe-primary), var(--hwe-success));
    border-radius: 3px;
    transition: width 0.4s ease-out;
}

.hwe-wizard-progress-text {
    margin-top: 8px;
    font-size: 13px;
    color: var(--hwe-text-secondary);
    text-align: right;
}

/* ==========================================================================
   Form & Screens
   ========================================================================== */

.hwe-wizard-form {
    position: relative;
    min-height: 400px;
    overflow: visible;
}

.hwe-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 32px 24px;
    box-sizing: border-box;
}

.hwe-screen.active {
    position: relative;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    overflow: visible;
}

.hwe-screen.exiting-left {
    transform: translateX(-100%);
    opacity: 0;
}

.hwe-screen.entering-right {
    transform: translateX(100%);
}

.hwe-screen-content {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
}

/* ==========================================================================
   Typography
   ========================================================================== */

.hwe-screen-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--hwe-text);
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.hwe-screen-subtitle {
    font-size: 15px;
    color: var(--hwe-text-secondary);
    margin: 0 0 24px 0;
    line-height: 1.5;
}

/* ==========================================================================
   Input Styles
   ========================================================================== */

.hwe-input-group {
    margin-bottom: 20px;
}

.hwe-input-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--hwe-text);
    margin-bottom: 6px;
}

.hwe-input-group .required {
    color: var(--hwe-error);
}

.hwe-input,
.hwe-select {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid var(--hwe-border);
    border-radius: var(--hwe-radius-sm);
    background: var(--hwe-bg);
    color: var(--hwe-text);
    transition: border-color var(--hwe-transition), box-shadow var(--hwe-transition);
    -webkit-appearance: none;
    appearance: none;
}

.hwe-input:focus,
.hwe-select:focus {
    outline: none;
    border-color: var(--hwe-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.hwe-input::placeholder {
    color: var(--hwe-text-secondary);
    opacity: 0.7;
}

.hwe-input-large {
    font-size: 18px;
    padding: 16px 20px;
}

.hwe-input-small {
    width: 100px;
    padding: 10px 12px;
    font-size: 14px;
}

.hwe-input-row {
    display: flex;
    gap: 16px;
}

.hwe-input-half {
    flex: 1;
}

.hwe-input-hint {
    font-size: 13px;
    color: var(--hwe-text-secondary);
    margin-top: 8px;
    text-align: center;
}

/* ==========================================================================
   Card Selection
   ========================================================================== */

.hwe-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

.hwe-card-grid-single {
    grid-template-columns: 1fr;
}

.hwe-card {
    position: relative;
    cursor: pointer;
    min-width: 0;
    overflow: visible;
}

.hwe-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.hwe-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    background: var(--hwe-bg);
    border: 2px solid var(--hwe-border);
    border-radius: var(--hwe-radius);
    transition: all var(--hwe-transition);
    min-height: 100px;
}

.hwe-card input[type="radio"]:checked + .hwe-card-content {
    border-color: var(--hwe-primary);
    background: rgba(37, 99, 235, 0.05);
    box-shadow: var(--hwe-shadow);
}

.hwe-card:hover .hwe-card-content {
    border-color: var(--hwe-primary);
}

.hwe-card-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.hwe-card-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--hwe-text);
    text-align: center;
    line-height: 1.3;
}

/* Horizontal cards */
.hwe-card-horizontal .hwe-card-content {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 16px 20px;
    min-height: auto;
}

.hwe-card-horizontal .hwe-card-icon {
    font-size: 24px;
    margin-bottom: 0;
    margin-right: 16px;
    flex-shrink: 0;
}

.hwe-card-horizontal .hwe-card-text {
    display: flex;
    flex-direction: column;
}

.hwe-card-horizontal .hwe-card-label {
    text-align: left;
}

.hwe-card-horizontal .hwe-card-desc {
    font-size: 12px;
    color: var(--hwe-text-secondary);
    margin-top: 2px;
}

/* ==========================================================================
   Pills Selection
   ========================================================================== */

.hwe-pills-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.hwe-pill {
    cursor: pointer;
}

.hwe-pill input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.hwe-pill span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    font-size: 18px;
    font-weight: 600;
    color: var(--hwe-text);
    background: var(--hwe-bg);
    border: 2px solid var(--hwe-border);
    border-radius: 50%;
    transition: all var(--hwe-transition);
}

.hwe-pill:hover span {
    border-color: var(--hwe-primary);
}

.hwe-pill input[type="radio"]:checked + span {
    background: var(--hwe-primary);
    border-color: var(--hwe-primary);
    color: white;
    box-shadow: var(--hwe-shadow);
}

/* ==========================================================================
   Number Input with Buttons
   ========================================================================== */

.hwe-number-input-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.hwe-number-btn {
    width: 48px;
    height: 48px;
    font-size: 24px;
    font-weight: 500;
    color: var(--hwe-primary);
    background: var(--hwe-bg);
    border: 2px solid var(--hwe-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--hwe-transition);
}

.hwe-number-btn:hover {
    background: var(--hwe-primary);
    color: white;
}

.hwe-number-input {
    width: 80px;
    height: 64px;
    font-size: 32px;
    font-weight: 600;
    text-align: center;
    border: 2px solid var(--hwe-border);
    border-radius: var(--hwe-radius-sm);
}

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

/* ==========================================================================
   Slider
   ========================================================================== */

.hwe-slider-container {
    text-align: center;
}

.hwe-slider {
    width: 100%;
    height: 8px;
    background: var(--hwe-border);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 16px;
}

.hwe-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--hwe-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--hwe-shadow);
    transition: transform var(--hwe-transition);
}

.hwe-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.hwe-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--hwe-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: var(--hwe-shadow);
}

.hwe-slider-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.hwe-slider-input {
    width: 100px;
    padding: 12px;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    border: 2px solid var(--hwe-border);
    border-radius: var(--hwe-radius-sm);
}

.hwe-slider-unit {
    font-size: 18px;
    color: var(--hwe-text-secondary);
}

.hwe-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--hwe-text-secondary);
}

/* ==========================================================================
   Toggle Inputs (Accessory Surfaces)
   ========================================================================== */

.hwe-toggle-inputs {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hwe-toggle-input {
    background: var(--hwe-bg-secondary);
    border-radius: var(--hwe-radius-sm);
    padding: 16px;
}

.hwe-toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.hwe-toggle-check {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.hwe-toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--hwe-border);
    border-radius: 13px;
    margin-right: 12px;
    transition: background var(--hwe-transition);
    flex-shrink: 0;
}

.hwe-toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    box-shadow: var(--hwe-shadow);
    transition: transform var(--hwe-transition);
}

.hwe-toggle-check:checked + .hwe-toggle-switch {
    background: var(--hwe-primary);
}

.hwe-toggle-check:checked + .hwe-toggle-switch::after {
    transform: translateX(22px);
}

.hwe-toggle-text {
    font-size: 15px;
    font-weight: 500;
    color: var(--hwe-text);
}

.hwe-toggle-field {
    margin-top: 12px;
    padding-left: 60px;
}

/* ==========================================================================
   Summary Box
   ========================================================================== */

.hwe-summary-box {
    background: linear-gradient(135deg, var(--hwe-primary), var(--hwe-primary-hover));
    color: white;
    padding: 32px;
    border-radius: var(--hwe-radius);
    text-align: center;
    margin-bottom: 16px;
}

.hwe-summary-main {
    margin-bottom: 16px;
}

.hwe-summary-value {
    font-size: 48px;
    font-weight: 700;
    display: block;
}

.hwe-summary-unit {
    font-size: 16px;
    opacity: 0.9;
}

.hwe-summary-breakdown {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--hwe-radius-sm);
    padding: 16px;
}

.hwe-breakdown-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    padding: 4px 0;
}

.hwe-info-text {
    font-size: 13px;
    color: var(--hwe-text-secondary);
    text-align: center;
    line-height: 1.5;
}

/* ==========================================================================
   Energy Class Grid
   ========================================================================== */

.hwe-energy-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.hwe-energy-pill {
    cursor: pointer;
}

.hwe-energy-pill input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.hwe-energy-pill span {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    border-radius: var(--hwe-radius-sm);
    transition: all var(--hwe-transition);
}

.hwe-energy-pill input[type="radio"]:checked + span {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

/* Energy class colors */
.hwe-energy-a4 span { background: #00a651; }
.hwe-energy-a3 span { background: #00a651; }
.hwe-energy-a2 span { background: #39b54a; }
.hwe-energy-a1 span { background: #8dc63f; }
.hwe-energy-b span { background: #d9e021; color: var(--hwe-text); }
.hwe-energy-c span { background: #fff200; color: var(--hwe-text); }
.hwe-energy-d span { background: #f7941d; }
.hwe-energy-e span { background: #f15a24; }
.hwe-energy-f span { background: #ed1c24; }
.hwe-energy-g span { background: #be1e2d; }

/* ==========================================================================
   Skip Option
   ========================================================================== */

.hwe-skip-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    font-size: 14px;
    color: var(--hwe-text-secondary);
    cursor: pointer;
    margin-top: 16px;
}

.hwe-skip-option input[type="radio"],
.hwe-skip-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--hwe-primary);
}

/* ==========================================================================
   Price Input
   ========================================================================== */

.hwe-price-input-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.hwe-price-currency {
    font-size: 24px;
    font-weight: 600;
    color: var(--hwe-text);
}

.hwe-price-input {
    width: 200px;
    padding: 16px;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    border: 2px solid var(--hwe-border);
    border-radius: var(--hwe-radius-sm);
}

/* ==========================================================================
   Footer Navigation
   ========================================================================== */

.hwe-wizard-footer {
    display: flex;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--hwe-bg-secondary);
    border-top: 1px solid var(--hwe-border);
}

.hwe-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--hwe-radius-sm);
    cursor: pointer;
    transition: all var(--hwe-transition);
}

.hwe-btn-primary {
    background: var(--hwe-primary);
    color: white;
}

.hwe-btn-primary:hover {
    background: var(--hwe-primary-hover);
    box-shadow: var(--hwe-shadow);
}

.hwe-btn-secondary {
    background: transparent;
    color: var(--hwe-text-secondary);
}

.hwe-btn-secondary:hover {
    color: var(--hwe-text);
    background: var(--hwe-border);
}

.hwe-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hwe-btn-icon {
    font-size: 14px;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.hwe-wizard.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* ==========================================================================
   Error States
   ========================================================================== */

.hwe-input.error,
.hwe-select.error {
    border-color: var(--hwe-error);
}

.hwe-error-message {
    color: var(--hwe-error);
    font-size: 13px;
    margin-top: 4px;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 600px) {
    .hwe-wizard {
        border-radius: 0;
        box-shadow: none;
    }

    .hwe-screen {
        padding: 24px 16px;
    }

    .hwe-screen-title {
        font-size: 20px;
    }

    .hwe-card-grid {
        grid-template-columns: 1fr;
    }

    .hwe-input-row {
        flex-direction: column;
        gap: 0;
    }

    .hwe-energy-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
    }

    .hwe-energy-pill span {
        padding: 10px 4px;
        font-size: 12px;
    }

    .hwe-pills-container {
        gap: 8px;
    }

    .hwe-pill span {
        width: 48px;
        height: 48px;
        font-size: 16px;
    }

    .hwe-slider-input {
        width: 80px;
        font-size: 20px;
    }

    .hwe-summary-value {
        font-size: 36px;
    }

    .hwe-wizard-footer {
        padding: 12px 16px;
    }

    .hwe-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* ==========================================================================
   Hide when classic theme
   ========================================================================== */

/* When not using wizard, hide wizard-specific elements */
#homeworth-engine-form:not(.hwe-wizard-form) {
    /* Classic form styles remain unchanged */
}
