*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: "Fustat", sans-serif;
    width: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #e3e9f0 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

/* Animated dotted background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%233333CB' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    z-index: -1;
    animation: float-pattern 20s linear infinite;
}

@keyframes float-pattern {
    0%   { transform: translateX(0) translateY(0); }
    100% { transform: translateX(-60px) translateY(-60px); }
}

/* ─── Wizard wrapper ─────────────────────────────────────────── */
.wizard-wrapper {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.wizard-title {
    font-family: "Unbounded", sans-serif;
    font-size: 26px;
    color: #1a1a2e;
    margin: 0;
    text-align: center;
    letter-spacing: -0.5px;
}

/* ─── Step indicator ─────────────────────────────────────────── */
.step-indicator {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 420px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
}

.step-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid #d0d0d0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Fustat", sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: #bbb;
    background: white;
    transition: border-color 0.3s ease, background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.step-item.active .step-circle {
    border-color: #3333CB;
    color: #3333CB;
    background: #eef0ff;
    box-shadow: 0 0 0 5px rgba(51, 51, 203, 0.1);
}

.step-item.completed .step-circle {
    border-color: #3333CB;
    background: #3333CB;
    color: white;
}

/* Hide number on completed, show tick */
.step-item.completed .step-circle span { display: none; }
.step-item.completed .step-circle::after {
    content: '\2713';
    font-size: 15px;
    color: white;
    font-weight: 700;
}

.step-label {
    font-size: 11px;
    font-family: "Fustat", sans-serif;
    color: #bbb;
    margin-top: 5px;
    font-weight: 500;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.step-item.active .step-label,
.step-item.completed .step-label {
    color: #3333CB;
    font-weight: 700;
}

.step-line {
    flex: 1;
    height: 2px;
    background: #e0e0e0;
    margin: 0 6px;
    margin-bottom: 20px; /* align with circles (offset for label) */
    border-radius: 2px;
    transition: background 0.4s ease;
}

.step-line.completed {
    background: #3333CB;
}

/* ─── Wizard card ────────────────────────────────────────────── */
.wizard-card {
    width: 100%;
    background: white;
    border-radius: 18px;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.07),
        0 1px 4px rgba(0, 0, 0, 0.04);
    padding: 36px 40px 32px;
    display: none;
    text-align: left;
}

.wizard-card.active {
    display: block;
    animation: cardIn 0.32s ease forwards;
}

.wizard-card.exit {
    display: block;
    animation: cardOut 0.25s ease forwards;
    pointer-events: none;
}

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

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

/* ─── Card typography ────────────────────────────────────────── */
h2 {
    font-family: "Unbounded", sans-serif;
    font-size: 20px;
    color: #1a1a2e;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.step-subtitle {
    font-size: 14px;
    color: #999;
    margin: 0 0 24px 0;
    font-family: "Fustat", sans-serif;
}

/* ─── Form groups ────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 14px;
}

.form-group label {
    font-size: 13px;
    font-weight: 700;
    color: #444;
    margin-bottom: 6px;
    font-family: "Fustat", sans-serif;
    letter-spacing: 0.2px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e2e2;
    border-radius: 9px;
    font-family: "Fustat", sans-serif;
    font-size: 15px;
    color: #222;
    background: #fafafa;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input::placeholder {
    color: #bbb;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #3333CB;
    box-shadow: 0 0 0 3px rgba(51, 51, 203, 0.1);
    background: white;
}

/* ─── Password input wrapper ─────────────────────────────────── */
.input-wrapper {
    position: relative;
    width: 100%;
}

.input-wrapper input {
    padding-right: 50px;
}

.eye-toggle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 48px;
    background: none;
    border: none;
    cursor: pointer;
    color: #bbb;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 9px 9px 0;
    transition: color 0.2s ease;
    /* Large touch target */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.eye-toggle:hover {
    color: #3333CB;
}

.eye-toggle:focus {
    outline: 2px solid #3333CB;
    outline-offset: -2px;
    border-radius: 0 9px 9px 0;
}

/* ─── Checkbox group ─────────────────────────────────────────── */
.checkbox-group {
    width: 100%;
    margin-bottom: 14px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-family: "Fustat", sans-serif;
    color: #555;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
    cursor: pointer;
    accent-color: #3333CB;
    border-radius: 4px;
}

.policy-link {
    color: #3333CB;
    text-decoration: none;
    font-weight: 700;
}

.policy-link:hover {
    text-decoration: underline;
}

/* ─── Error message ──────────────────────────────────────────── */
.card-error {
    font-size: 13px;
    color: #e74c3c;
    min-height: 18px;
    margin-bottom: 10px;
    font-family: "Fustat", sans-serif;
    font-weight: 500;
}

/* ─── Navigation buttons ─────────────────────────────────────── */
.wizard-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
}

.back-btn,
.next-btn {
    flex: 0 0 auto;
    padding: 11px 18px;
    border-radius: 10px;
    font-family: "Fustat", sans-serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.back-btn {
    border: 1.5px solid #3333CB;
    background: white;
    color: #3333CB;
}

.back-btn:hover {
    background: #f0f0ff;
}

.back-btn:active {
    transform: scale(0.97);
}

.next-btn {
    border: 1.5px solid transparent;
    background: #3333CB;
    color: white;
}

.next-btn:hover {
    background: #2525a8;
    box-shadow: 0 4px 12px rgba(51, 51, 203, 0.3);
}

.next-btn:active {
    transform: scale(0.97);
}

.next-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #a5a5d0;
}

/* Register button keeps gradient */
.submit-btn {
    background: linear-gradient(-45deg, #3333CB 40%, #DBFFF9 50%, #3333CB 60%);
    background-size: 300%;
    background-position-x: 100%;
    animation: shimmer 4s infinite;
}

.submit-btn:hover {
    background: linear-gradient(-45deg, #3333CB 40%, #DBFFF9 50%, #3333CB 60%);
    background-size: 300%;
    box-shadow: 0 4px 16px rgba(51, 51, 203, 0.35);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    animation: none;
    background: #a5a5d0;
}

@keyframes shimmer {
    to { background-position-x: -1%; }
}

/* ─── Responsive ─────────────────────────────────────────────── */

/* Tablet landscape / small desktop */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
        padding-top: 28px;
    }

    .wizard-wrapper {
        gap: 16px;
    }

    .wizard-title {
        font-size: 22px;
    }

    .wizard-card {
        padding: 30px 30px 26px;
        border-radius: 16px;
    }
}

/* Tablet portrait (iPad) */
@media (max-width: 600px) {
    body {
        padding: 20px 16px;
    }

    .wizard-card {
        padding: 28px 24px 24px;
        border-radius: 14px;
    }

    h2 {
        font-size: 19px;
    }

    /* Prevent iOS font zoom on inputs */
    .form-group input,
    .form-group select,
    .input-wrapper input {
        font-size: 16px;
    }

    .step-circle {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }
}

/* Phone */
@media (max-width: 430px) {
    body {
        padding: 16px 12px;
        padding-top: 20px;
    }

    .wizard-title {
        font-size: 20px;
    }

    .wizard-card {
        padding: 24px 20px 20px;
        border-radius: 12px;
    }

    h2 {
        font-size: 17px;
    }

    .step-subtitle {
        font-size: 13px;
        margin-bottom: 18px;
    }

    .step-circle {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .step-label {
        font-size: 10px;
    }

    .step-line {
        margin: 0 4px;
        margin-bottom: 18px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .back-btn,
    .next-btn {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .wizard-card {
        padding: 20px 16px 18px;
    }

    h2 {
        font-size: 16px;
    }

    .step-circle {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .back-btn,
    .next-btn {
        padding: 9px 12px;
        font-size: 12px;
    }
}

/* Landscape on phones */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .wizard-wrapper {
        gap: 12px;
    }

    .wizard-title {
        font-size: 18px;
    }

    .wizard-card {
        padding: 20px 28px 18px;
    }

    h2 {
        font-size: 17px;
        margin-bottom: 2px;
    }

    .step-subtitle {
        margin-bottom: 14px;
    }

    .form-group {
        margin-bottom: 10px;
    }
}

/* Touch-specific overrides — disable hover effects on touch screens */
@media (hover: none) and (pointer: coarse) {
    .back-btn:hover {
        background: white;
    }

    .next-btn:hover {
        box-shadow: none;
    }

    .eye-toggle:hover {
        color: #bbb;
    }

    .back-btn:active {
        background: #f0f0ff;
        transform: scale(0.97);
    }

    .next-btn:active {
        transform: scale(0.97);
    }

    .eye-toggle:active {
        color: #3333CB;
    }
}

/* Focus ring for keyboard accessibility */
.form-group input:focus,
.form-group select:focus,
.back-btn:focus,
.next-btn:focus {
    outline: none;
}

.back-btn:focus-visible,
.next-btn:focus-visible {
    outline: 2px solid #3333CB;
    outline-offset: 2px;
}
