/* --- Global Styles --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0f0f11;
    color: #e4e4e7;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.auth-box {
    background: #18181b;
    padding: 40px 30px;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    border: 1px solid #27272a;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(193, 18, 31, 0.15);
}

/* "Home" link at the top of the login / register card */
.home-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    color: #a1a1aa;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.home-link:hover,
.home-link:focus-visible {
    color: #f43f5e;
}

h2 {
    color: #f43f5e;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.subtitle {
    text-align: center;
    color: #a1a1aa;
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.input-group {
    margin-bottom: 16px;
}

input {
    width: 100%;
    padding: 12px 16px;
    background: #27272a;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    color: white;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

input:focus {
    outline: none;
    border-color: #f43f5e;
    background: #202024;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2);
}

input::placeholder {
    color: #71717a;
}

.btn {
    width: 100%;
    padding: 12px;
    background: #c1121f;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn:hover {
    background: #a10f1a;
}

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

.switch {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: #a1a1aa;
}

.switch a {
    color: #f43f5e;
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
    transition: color 0.2s ease;
}

.switch a:hover {
    color: #c1121f;
    text-decoration: underline;
}

/* --- Agreement Checkbox Feature --- */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 15px 0 20px 0;
    text-align: left;
}

/* Overrides the global block input styles specifically for the checkbox */
.checkbox-group input[type="checkbox"] {
    width: auto;
    padding: 0;
    background: transparent;
    border: none;
    accent-color: #c1121f;
    width: 16px;
    height: 16px;
    margin-top: 3px;
    cursor: pointer;
}

/* Removes box-shadow focus rings from the tiny checkbox element */
.checkbox-group input[type="checkbox"]:focus {
    box-shadow: none;
    background: transparent;
}

.checkbox-group label {
    font-size: 0.88rem;
    color: #a1a1aa;
    line-height: 1.4;
    cursor: pointer;
    user-select: none;
}

.checkbox-group label a {
    color: #f43f5e;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.checkbox-group label a:hover {
    color: #c1121f;
    text-decoration: underline;
}

        .form-errors {
            background: rgba(244, 63, 94, 0.1);
            border: 1px solid #f43f5e;
            color: #f43f5e;
            padding: 12px 16px;
            border-radius: 8px;
            font-size: 14px;
            margin-bottom: 18px;
        }

        .form-errors ul {
            margin: 0;
            padding-left: 18px;
        }

        .form-success {
            background: rgba(34, 197, 94, 0.1);
            border: 1px solid #22c55e;
            color: #22c55e;
            padding: 12px 16px;
            border-radius: 8px;
            font-size: 14px;
            margin-bottom: 18px;
        }

        /* .match-message and the input-match borders live in password-field.css. */

        /* ---------- OTP Modal ---------- */
        .modal-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.7);
            z-index: 999;
            align-items: center;
            justify-content: center;
        }

        .modal-overlay.open {
            display: flex;
        }

        .otp-modal {
            background: #18181b;
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 14px;
            padding: 32px 28px;
            max-width: 380px;
            width: 90%;
            text-align: center;
        }

        .otp-modal h3 {
            margin-bottom: 6px;
        }

        .otp-modal p {
            color: #a1a1aa;
            font-size: 14px;
            margin-bottom: 22px;
        }

        .otp-modal .otp-email {
            color: #f43f5e;
            font-weight: 600;
        }

        .otp-inputs {
            display: flex;
            gap: 8px;
            justify-content: center;
            margin-bottom: 18px;
        }

        .otp-inputs input {
            width: 42px;
            height: 52px;
            text-align: center;
            font-size: 22px;
            font-weight: 600;
            background: #0f0f10;
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 8px;
            color: #fff;
        }

        .otp-inputs input:focus {
            outline: none;
            border-color: #f43f5e;
        }

        .otp-timer {
            font-size: 13px;
            color: #a1a1aa;
            margin-bottom: 16px;
        }

        .otp-timer.expired {
            color: #f43f5e;
        }

        .otp-error {
            background: rgba(244, 63, 94, 0.1);
            border: 1px solid #f43f5e;
            color: #f43f5e;
            padding: 10px 14px;
            border-radius: 8px;
            font-size: 13px;
            margin-bottom: 16px;
            display: none;
        }

        .otp-resend {
            font-size: 13px;
            color: #a1a1aa;
            margin-top: 14px;
        }

        .otp-resend a {
            color: #f43f5e;
            font-weight: 600;
            cursor: pointer;
        }

        .otp-resend a.disabled {
            color: #52525b;
            pointer-events: none;
        }

        .otp-modal button.btn {
            width: 100%;
        }

        .otp-modal button.btn:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .form-success {
            width: 100%;
            box-sizing: border-box;
            padding: 14px 18px;
            border-radius: 8px;
            margin-bottom: 18px;
            text-align: center;
            font-size: 14px;
            font-weight: 500;
        }

        .form-success {
            background: rgba(34, 197, 94, 0.12);
            color: #166534;
            border: 1px solid #22c55e;
        }

        .form-errors div,
        .form-success div {
            margin: 0;
        }
/* --- Inline field validation (mobile number) --- */
.field-error {
    display: none;
    margin-top: 6px;
    color: #f87171;
    font-size: 12px;
    line-height: 1.4;
}

.field-error.is-visible {
    display: block;
}

.input-group input.is-invalid {
    border-color: #ef4444;
}

.input-group input.is-valid {
    border-color: #10b981;
}

/* The live password checklist (.password-rules) lives in password-field.css. */

/* --- Responsive ---
   Shared breakpoints: mobile <= 767px, tablet 768-1023px, computer >= 1024px. */
.otp-modal {
    max-height: 90vh;
    overflow-y: auto;
}

.otp-modal .otp-email {
    overflow-wrap: anywhere;
}

/* Close (X) and "Wrong email? Go back" on the Create Account code pop-up */
.otp-modal {
    position: relative;
}

.otp-close + h3 {
    padding: 0 36px; /* keeps the centred title clear of the X */
}

.otp-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 8px;
    color: #a1a1aa;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s;
}

.otp-close:hover,
.otp-close:focus-visible {
    color: #f43f5e;
}

.otp-close:focus-visible {
    outline: 2px solid #f43f5e;
    outline-offset: -2px;
}

.otp-back-row {
    margin-top: 4px;
}

.otp-back {
    min-height: 44px;
    padding: 0 8px;
    background: none;
    border: none;
    color: #a1a1aa;
    font-family: inherit;
    font-size: 13px;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color 0.2s;
}

.otp-back:hover,
.otp-back:focus-visible {
    color: #e4e4e7;
}

@media (max-width: 767px) {
    .container {
        padding: 16px 14px;
    }

    .auth-box {
        padding: 28px 20px;
    }

    h2 {
        font-size: 1.5rem;
    }

    /* 16px stops iPhone Safari zooming into the field */
    input {
        font-size: 16px;
    }

    .btn {
        min-height: 46px;
    }

    .home-link {
        min-height: 44px;
        margin-bottom: 6px;
    }

    .switch a {
        display: inline-block;
        padding: 10px 0;
    }

    .checkbox-group input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin-top: 1px;
        flex-shrink: 0;
    }

    /* OTP / reset-password modal: fits a 360px screen */
    .modal-overlay {
        padding: 10px;
    }

    .otp-modal {
        width: 100%;
        max-width: 95vw;
        padding: 26px 16px;
    }

    .otp-inputs {
        gap: 6px;
    }

    .otp-inputs input {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        max-width: 46px;
        height: 50px;
        padding: 0;
    }

    .otp-resend a {
        display: inline-block;
        padding: 10px 4px;
    }
}
