/**
 * NewDesign auth pages — responsive layout (mobile-first overrides)
 * Scoped to .auth-split-page / .auth-centered-page to avoid side effects.
 */

/* ─── Split layout (login, register, signup, forgot-password) ─── */
.auth-split-page {
    min-height: 100vh;
    min-height: 100dvh;
}

.auth-hero-panel .auth-hero-title {
    font-size: 48px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.auth-hero-panel .auth-hero-subtitle {
    font-size: 25px;
    line-height: 1.6;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.auth-form-column {
    -webkit-overflow-scrolling: touch;
}

.auth-back-btn {
    top: 20px;
    right: 30px;
    z-index: 10;
}

/* Signup progress */
.auth-progress-track {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    max-width: 100%;
}

.auth-progress-step {
    flex: 0 1 auto;
    min-width: 115px;
}

.auth-progress-label {
    font-size: 0.75rem;
    line-height: 1.35;
    max-width: 100%;
}

.auth-progress-line {
    margin-top: 16px;
}

/* Centered pages (reset, verify) */
.auth-centered-page {
    width: 100%;
    margin: 0;
    min-height: calc(100dvh - 2rem);
    align-items: center;
}

.auth-centered-card {
    width: 100%;
}

/* ─── Tablet (768px–992px): split layout — prevent clipped form column ─── */
@media (min-width: 768px) and (max-width: 991.98px) {
    .auth-split-page {
        min-height: 100dvh;
        height: auto !important;
        overflow: visible !important;
        align-items: stretch;
    }

    .auth-split-page > .auth-hero-col {
        flex: 0 0 50%;
        max-width: 50%;
        min-height: 100dvh;
    }

    .auth-split-page > .auth-form-column {
        flex: 0 0 50%;
        max-width: 50%;
        width: 50%;
        height: auto !important;
        min-height: 100dvh;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .auth-split-page .auth-card-body {
        margin-top: 3rem !important;
        padding-bottom: 2rem !important;
    }

    .auth-split-page .phone-field-country {
        width: 118px;
        max-width: 40%;
    }

    .auth-split-page .phone-field-input {
        min-width: 0;
        font-size: 1rem;
    }

    .auth-split-page .select2-container {
        max-height: none;
        overflow-y: visible;
    }
}

@media (max-width: 991.98px) {
    .auth-hero-panel .auth-hero-title {
        font-size: 36px;
    }

    .auth-hero-panel .auth-hero-subtitle {
        font-size: 20px;
    }

    .auth-split-page .auth-card {
        margin-left: auto;
        margin-right: auto;
    }
}

/* ─── Mobile ─── */
@media (max-width: 767.98px) {
    body.gradient-bg {
        align-items: stretch !important;
        justify-content: flex-start !important;
    }

    body.gradient-bg > .h-100,
    body.gradient-bg > .m-0 {
        width: 100%;
        min-height: 100dvh;
        height: auto !important;
    }

    .auth-split-page {
        min-height: 100dvh;
        height: auto !important;
        overflow: visible !important;
    }

    .auth-form-column {
        flex: 0 0 100%;
        max-width: 100%;
        width: 100%;
        height: auto !important;
        min-height: 100dvh;
        overflow-x: hidden !important;
        overflow-y: visible !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .auth-card-body {
        margin-top: 3.25rem !important;
        padding-top: 0.75rem !important;
        padding-bottom: 2rem !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .auth-form-column:not(.auth-form-column--has-back) .auth-card-body {
        margin-top: 1.25rem !important;
        padding-top: 1rem !important;
    }

    .auth-back-btn {
        top: 12px;
        right: 16px;
        left: auto;
        font-size: 14px !important;
    }

    .auth-header img {
        width: 112px !important;
        max-width: 48vw;
    }

    .auth-header h1 {
        font-size: 1.25rem !important;
    }

    .auth-split-page .form-footer {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
    }

    .auth-split-page .form-footer .form-check {
        justify-content: flex-start;
    }

    .auth-split-page .form-footer .link-primary {
        text-align: center;
        display: block;
    }

    .auth-split-page .method-card {
        padding: 0.875rem;
    }

    .auth-split-page .btn-google {
        font-size: 0.8125rem;
        gap: 0.5rem;
        padding: 0.7rem 0.5rem;
    }

    .auth-split-page .user-type-card {
        min-height: 160px;
    }

    /* Progress — prevent horizontal page overflow */
    .auth-progress-track {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
        gap: 0.25rem !important;
        justify-content: center;
        flex-wrap: wrap;
        overflow: hidden;
    }

    .auth-progress-step {
        min-width: 115px;
        flex: 1 1 0;
        max-width: 32%;
    }

    .auth-progress-label {
        white-space: normal !important;
        font-size: 0.625rem !important;
        word-break: break-word;
    }

    .auth-progress-line {
        flex: 1 1 12px !important;
        min-width: 8px;
        max-width: 24px;
        margin-top: 14px !important;
    }

    .auth-split-page .progress-step {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    /* Phone field */
    .auth-split-page .phone-code-wrapper {
        width: 88px;
    }

    .auth-split-page .phone-code-dropdown {
        width: min(200px, calc(100vw - 2rem)) !important;
        max-width: calc(100vw - 2rem);
        left: 0;
        right: auto;
    }

    .auth-split-page .phone-input-wrapper {
        flex-wrap: nowrap;
    }

    .auth-split-page .phone-number-input {
        min-width: 0;
    }

    /* Select2 */
    .auth-split-page .select2-container {
        max-height: 50vh;
    }

    .auth-split-page .select2-dropdown {
        max-width: calc(100vw - 2rem) !important;
    }

    /* Verification modals (login / signup) */
    body.gradient-bg .auth-verification-modal .modal-dialog,
    body.gradient-bg .modal-dialog {
        margin: 0.75rem;
        max-width: calc(100% - 1.5rem);
    }

    body.gradient-bg .auth-verification-modal .modal-body,
    body.gradient-bg .modal-body {
        padding: 1rem !important;
    }

    body.gradient-bg .auth-verification-modal .modal-content img {
        width: 72px !important;
    }

    body.gradient-bg .auth-verification-modal .form-control.text-center {
        font-size: 1.125rem !important;
        letter-spacing: 0.35rem !important;
        height: 52px !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    body.gradient-bg .auth-verification-modal .alert {
        font-size: 0.8125rem !important;
        padding: 0.75rem !important;
    }

    body.gradient-bg #otpModal .phone-modal-dialog {
        margin: 0.75rem;
        max-width: calc(100% - 1.5rem);
    }

    body.gradient-bg #otpModal .phone-modal-body {
        padding: 1rem 1rem 1.25rem !important;
    }

    body.gradient-bg #otpModal .phone-modal-content .otp-input {
        font-size: 1.35rem !important;
        letter-spacing: 0.45rem !important;
        height: 50px !important;
    }

    body.gradient-bg #emailModal .phone-modal-dialog {
        margin: 0.75rem;
        max-width: calc(100% - 1.5rem);
    }

    body.gradient-bg #emailModal .phone-modal-body {
        padding: 1rem 1rem 1.25rem !important;
    }

    body.gradient-bg #emailModal .phone-modal-content .email-code-input {
        font-size: 1.25rem !important;
        letter-spacing: 0.4rem !important;
        height: 50px !important;
    }

    /* Admin standalone password page (legacy layout) */
    .auth-admin-standalone {
        padding: 1rem;
        box-sizing: border-box;
    }

    .auth-admin-standalone .auth-admin-wrapper {
        width: 100%;
    }

    .auth-admin-standalone .flex.items-center.gap-6 {
        flex-wrap: wrap;
        justify-content: center;
        font-size: 1.25rem;
    }

    .auth-admin-standalone input[type="password"] {
        font-size: 16px;
    }

    .auth-admin-standalone button[type="submit"] {
        width: 100%;
        max-width: 280px;
    }

    /* Form inputs — iOS zoom prevention */
    .auth-split-page .form-control,
    .auth-split-page .form-select,
    .auth-centered-card .form-control {
        font-size: 16px;
    }

    /* Centered auth cards */
    .auth-centered-page {
        min-height: 100dvh;
        padding: 1rem 0.75rem !important;
        margin: 0 !important;
    }

    .auth-centered-page > [class*="col-"] {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        max-width: 100%;
    }

    .auth-centered-card {
        padding: 1.25rem 1rem !important;
        border-radius: 1rem !important;
    }

    .auth-centered-card .form-control {
        font-size: 16px;
    }
}

/* ─── Very small screens ─── */
@media (max-width: 374.98px) {
    .auth-progress-label {
        font-size: 0.5625rem !important;
    }

    .auth-split-page .progress-step {
        width: 26px;
        height: 26px;
        font-size: 0.6875rem;
    }

    .auth-back-btn span {
        display: none;
    }

    .auth-back-btn {
        right: 12px;
    }
}

/* ─── Safe area (notched phones) ─── */
@supports (padding: max(0px)) {
    @media (max-width: 767.98px) {
        .auth-form-column {
            padding-bottom: max(1rem, env(safe-area-inset-bottom)) !important;
        }

        .auth-back-btn {
            top: max(12px, env(safe-area-inset-top));
            right: max(16px, env(safe-area-inset-right));
        }

        .auth-centered-page {
            padding-bottom: max(1rem, env(safe-area-inset-bottom)) !important;
        }
    }
}
