/* ============================================
   KALIMALIO — Wizard Modal Styles
   Generic wizard engine styles
   ============================================ */

/* --- Overlay --- */
.wizard-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(10, 12, 14, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.wizard-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* --- Modal --- */
.wizard-modal {
    background: var(--color-white);
    border-radius: 16px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.1s, opacity 0.5s ease 0.1s;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.wizard-overlay.open .wizard-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* --- Close button --- */
.wizard-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background var(--transition);
}

.wizard-close:hover {
    background: var(--color-gray-light);
}

.wizard-close::before,
.wizard-close::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 2px;
    background: var(--color-dark-alt);
    border-radius: 1px;
}

.wizard-close::before {
    transform: rotate(45deg);
}

.wizard-close::after {
    transform: rotate(-45deg);
}

/* --- Header --- */
.wizard-header {
    padding: 32px 32px 0;
    text-align: center;
}

.wizard-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--color-dark);
    margin-bottom: 24px;
}

/* --- Progress bar --- */
.wizard-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0 32px 24px;
}

.wizard-progress-step {
    display: flex;
    align-items: center;
    gap: 0;
}

.wizard-progress-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--color-gray);
    background: var(--color-white);
    color: var(--color-gray-mid);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.wizard-progress-dot.active {
    border-color: var(--color-accent);
    background: var(--color-accent);
    color: var(--color-white);
}

.wizard-progress-dot.done {
    border-color: var(--color-accent);
    background: var(--color-accent);
    color: var(--color-white);
}

.wizard-progress-line {
    width: 24px;
    height: 2px;
    background: var(--color-gray);
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.wizard-progress-line.done {
    background: var(--color-accent);
}

/* --- Body (steps container) --- */
.wizard-body {
    padding: 0 32px;
    flex: 1;
    overflow-y: auto;
}

.wizard-step {
    display: none;
    padding: 8px 0 16px;
    animation: wizardStepIn 0.35s ease;
}

.wizard-step.active {
    display: block;
}

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

.wizard-step-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--color-dark);
    margin-bottom: 20px;
    text-align: center;
}

/* --- Form fields --- */
.wizard-field {
    margin-bottom: 20px;
    transition: opacity 0.3s ease, max-height 0.3s ease;
}

.wizard-field.hidden {
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
    overflow: hidden;
    pointer-events: none;
}

.wizard-label {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--color-dark-alt);
    margin-bottom: 8px;
}

.wizard-label .optional {
    font-weight: 400;
    text-transform: none;
    color: var(--color-gray-mid);
    font-size: 0.75rem;
}

.wizard-input,
.wizard-textarea,
.wizard-select {
    width: 100%;
    padding: 12px 16px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--color-dark);
    background: var(--color-gray-light);
    border: 2px solid transparent;
    border-radius: 8px;
    outline: none;
    transition: border-color var(--transition), background var(--transition);
}

.wizard-input:focus,
.wizard-textarea:focus,
.wizard-select:focus {
    border-color: var(--color-accent);
    background: var(--color-white);
}

.wizard-input.error,
.wizard-textarea.error {
    border-color: #d32f2f;
}

.wizard-textarea {
    min-height: 80px;
    resize: vertical;
}

.wizard-input::placeholder,
.wizard-textarea::placeholder {
    color: var(--color-gray-mid);
}

/* --- Row layout (side by side fields) --- */
.wizard-row {
    display: flex;
    gap: 12px;
}

.wizard-row .wizard-field {
    flex: 1;
}

/* --- Radio & Checkbox cards --- */
.wizard-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wizard-card {
    flex: 1;
    min-width: 120px;
    padding: 14px 16px;
    text-align: center;
    border: 2px solid var(--color-gray);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    background: var(--color-white);
    user-select: none;
}

.wizard-card:hover {
    border-color: var(--color-accent-light);
    background: rgba(156, 1, 75, 0.03);
}

.wizard-card.selected {
    border-color: var(--color-accent);
    background: rgba(156, 1, 75, 0.06);
    box-shadow: 0 0 0 1px var(--color-accent);
}

.wizard-card-icon {
    font-size: 1.5rem;
    margin-bottom: 6px;
    display: block;
}

.wizard-card-label {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-dark);
    line-height: 1.3;
}

.wizard-card-desc {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--color-dark-alt);
    margin-top: 4px;
    line-height: 1.3;
}

.wizard-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* --- Date slots (repeatable date + time rows) --- */
.wizard-date-slots {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wizard-date-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.wizard-date-slot-prefix {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--color-dark-alt);
    flex-shrink: 0;
}

.wizard-date-slot .wizard-input {
    width: auto;
    flex-shrink: 0;
}

.wizard-date-slot-date {
    min-width: 150px;
}

.wizard-date-slot-start,
.wizard-date-slot-end {
    min-width: 120px;
}

.wizard-date-slot-remove {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--color-gray-mid);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wizard-date-slot-remove:hover {
    background: rgba(211, 47, 47, 0.08);
    color: #d32f2f;
}

.wizard-date-add {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--color-accent);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 8px 0;
    transition: color var(--transition);
    margin-top: 4px;
}

.wizard-date-add:hover {
    color: var(--color-accent-light);
}

/* --- Toggle switch --- */
.wizard-toggle {
    display: flex;
    gap: 8px;
    background: none;
    border-radius: 8px;
    border: none;
}

.wizard-toggle-option {
    flex: 1;
    padding: 12px 16px;
    text-align: center;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-dark-alt);
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
    border: 2px solid var(--color-gray);
    border-radius: 8px;
    background: var(--color-gray-light);
}

.wizard-toggle-option.active {
    background: var(--color-accent);
    color: var(--color-white);
    border-color: var(--color-accent);
}

.wizard-toggle-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* --- Error message --- */
.wizard-error {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: #d32f2f;
    margin-top: 4px;
    display: none;
}

.wizard-error.visible {
    display: block;
}

/* --- Footer (navigation) --- */
.wizard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px 32px;
    gap: 12px;
}

.wizard-btn {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    padding: 12px 28px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    text-transform: uppercase;
}

.wizard-btn-prev {
    background: none;
    color: var(--color-dark-alt);
    border: 2px solid var(--color-gray);
}

.wizard-btn-prev:hover {
    border-color: var(--color-dark-alt);
    color: var(--color-dark);
}

.wizard-btn-next,
.wizard-btn-submit {
    background: var(--color-accent);
    color: var(--color-white);
    margin-left: auto;
}

.wizard-btn-next:hover,
.wizard-btn-submit:hover {
    background: var(--color-accent-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--color-accent-glow);
}

.wizard-btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* --- Success screen --- */
.wizard-success {
    text-align: center;
    padding: 48px 32px;
}

.wizard-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--color-accent);
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: wizardCheckIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes wizardCheckIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.wizard-success-icon::after {
    content: '';
    display: block;
    width: 20px;
    height: 10px;
    border-left: 3px solid var(--color-white);
    border-bottom: 3px solid var(--color-white);
    transform: rotate(-45deg);
    margin-top: -4px;
}

.wizard-success-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--color-dark);
    margin-bottom: 12px;
}

.wizard-success-text {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 300;
    color: var(--color-dark-alt);
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .wizard-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .wizard-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        opacity: 1;
    }

    .wizard-overlay.open .wizard-modal {
        transform: translateY(0);
    }

    .wizard-header {
        padding: 24px 20px 0;
    }

    .wizard-progress {
        padding: 0 20px 20px;
    }

    .wizard-progress-dot {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }

    .wizard-progress-line {
        width: 16px;
    }

    .wizard-body {
        padding: 0 20px;
    }

    .wizard-footer {
        padding: 16px 20px 24px;
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }

    .wizard-title {
        font-size: 1.25rem;
    }

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

    .wizard-card {
        min-width: 0;
    }

    .wizard-cards {
        flex-direction: column;
    }

    .wizard-date-slot {
        gap: 6px;
    }

    .wizard-date-slot .wizard-input {
        min-width: 0;
        flex: 1;
    }

    .wizard-date-slot-date {
        width: 100%;
        flex-basis: 100%;
    }

    .wizard-btn {
        padding: 12px 20px;
        font-size: 0.8rem;
    }

    .wizard-toggle {
        flex-direction: column;
    }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    .wizard-overlay,
    .wizard-modal,
    .wizard-steps,
    .wizard-field {
        transition: none;
    }

    .wizard-success-icon {
        animation: none;
    }
}
