<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@phosphor-icons/web@2.1.1/src/regular/style.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@phosphor-icons/web@2.1.1/src/fill/style.css">
<link href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css" rel="stylesheet">

<style>
/* ==========================================================================
   DEWA HOSTING - ULTRA PREMIUM RESPONSIVE AUTHENTICATION DESIGN SYSTEM
   Pixel-Perfect on Android, iOS (iPhone), Tablet & Desktop
   ========================================================================== */

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

:root {
    --auth-primary: #2563eb;
    --auth-primary-hover: #1d4ed8;
    --auth-primary-light: #eff6ff;
    --auth-primary-glow: rgba(37, 99, 235, 0.18);
    --auth-accent: #0ea5e9;
    --auth-dark: #0f172a;
    --auth-dark-mesh: linear-gradient(155deg, #091a38 0%, #0c2352 45%, #1e40af 100%);
    --auth-surface: #ffffff;
    --auth-bg: #f8fafc;
    --auth-border: #e2e8f0;
    --auth-border-hover: #cbd5e1;
    --auth-border-focus: #2563eb;
    --auth-text-title: #0f172a;
    --auth-text-body: #334155;
    --auth-text-muted: #64748b;
    --auth-text-sub: #94a3b8;
    --auth-radius-card: 24px;
    --auth-radius-input: 12px;
    --auth-radius-btn: 12px;
}

html, body {
    min-height: 100%;
    background-color: #f8fafc;
    color: #334155;
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ── DEFENSIVE LOGO & IMAGE CONSTRAINTS ─────────────────── */
img {
    max-width: 100%;
    height: auto;
}

.brand-logo-img {
    width: 42px !important;
    height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    object-fit: cover !important;
    display: inline-block !important;
    border-radius: 50% !important;
    aspect-ratio: 1 / 1 !important;
    overflow: hidden !important;
    flex-shrink: 0;
}

.brand-logo-fallback {
    width: 42px !important;
    height: 42px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    overflow: hidden !important;
    aspect-ratio: 1 / 1 !important;
    flex-shrink: 0;
}

/* ── PAGE LAYOUT WRAPPER ────────────────────────────────── */
.auth-page-wrapper {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 20px;
    background: radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.07) 0px, transparent 50%),
                radial-gradient(at 100% 100%, rgba(14, 165, 233, 0.07) 0px, transparent 50%),
                #f8fafc;
}

.auth-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

.auth-container-wide {
    max-width: 1140px;
}

.auth-container-compact {
    max-width: 920px;
}

/* ── MASTER CARD SHELL ──────────────────────────────────── */
.auth-master-card {
    display: flex;
    flex-direction: row;
    background: #ffffff;
    border-radius: var(--auth-radius-card);
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 50px -12px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.05);
    overflow: hidden;
    width: 100%;
}

/* ── LEFT BRAND PANEL (DESKTOP) ─────────────────────────── */
.auth-brand-section {
    width: 400px;
    flex-shrink: 0;
    background: var(--auth-dark-mesh);
    color: #ffffff;
    padding: 44px 36px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.auth-container-wide .auth-brand-section {
    width: 380px;
}

.auth-brand-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 28px 28px;
    opacity: 0.8;
    pointer-events: none;
}

.auth-brand-section::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: linear-gradient(90deg, #2563eb, #38bdf8, #10b981);
}

.brand-header-box {
    position: relative;
    z-index: 2;
}

.brand-logo-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.brand-logo-link:hover {
    color: #ffffff;
}

.brand-body-box {
    position: relative;
    z-index: 2;
    padding: 24px 0;
}

.brand-badge-kicker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    background: rgba(37, 99, 235, 0.35);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 9999px;
    color: #7dd3fc;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.brand-badge-kicker .pulse-dot {
    width: 7px;
    height: 7px;
    background: #38bdf8;
    border-radius: 50%;
    box-shadow: 0 0 8px #38bdf8;
}

.brand-hero-title {
    color: #ffffff;
    font-size: clamp(1.5rem, 2vw, 2rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
}

.brand-hero-title .highlight {
    background: linear-gradient(90deg, #60a5fa, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-hero-desc {
    color: rgba(226, 232, 240, 0.85);
    font-size: 0.90rem;
    line-height: 1.6;
    margin-bottom: 22px;
}

.brand-feature-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.brand-feature-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.brand-feature-card .feat-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.brand-feature-card .feat-text {
    font-size: 0.84rem;
    color: #f1f5f9;
    font-weight: 600;
}

.brand-footer-box {
    position: relative;
    z-index: 2;
    padding-top: 16px;
}

.brand-trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #cbd5e1;
    font-weight: 600;
}

.brand-trust-badge .stars {
    color: #fbbf24;
    letter-spacing: 1px;
}

.brand-footer-copy {
    color: rgba(148, 163, 184, 0.7);
    font-size: 0.75rem;
    margin-top: 6px;
}

/* ── RIGHT FORM WORKSPACE ───────────────────────────────── */
.auth-form-section {
    flex: 1;
    padding: 44px 48px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.auth-container-wide .auth-form-section {
    padding: 38px 42px;
}

.auth-form-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.auth-form-header-main {
    flex: 1;
}

.auth-form-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--auth-text-title);
    letter-spacing: -0.025em;
    margin-bottom: 6px;
}

.auth-form-sub {
    font-size: 0.88rem;
    color: var(--auth-text-muted);
    line-height: 1.5;
}

.auth-switch-link {
    font-size: 0.85rem;
    color: var(--auth-text-muted);
    white-space: nowrap;
    text-align: right;
    padding-top: 4px;
}

.auth-switch-link a {
    color: var(--auth-primary);
    font-weight: 700;
    text-decoration: none;
}

.auth-switch-link a:hover {
    color: var(--auth-primary-hover);
    text-decoration: underline;
}

/* ── GOOGLE SSO BUTTON ──────────────────────────────────── */
.btn-google-sso {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 11px 18px;
    background: #ffffff;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-btn);
    color: var(--auth-text-title);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-google-sso:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--auth-text-title);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.btn-google-sso.disabled-sso {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f1f5f9;
}

/* ── OR DIVIDER ─────────────────────────────────────────── */
.auth-or-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 18px 0;
}

.auth-or-divider::before,
.auth-or-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

.auth-or-divider span {
    color: var(--auth-text-sub);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── ALERT BOXES ────────────────────────────────────────── */
.auth-alert-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.45;
    margin-bottom: 20px;
    font-weight: 500;
}

.auth-alert-err {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #e11d48;
}

.auth-alert-err i {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.auth-alert-ok {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #059669;
}

/* ── FORM FIELDS & INPUTS ───────────────────────────────── */
.form-field-group {
    margin-bottom: 16px;
}

.form-field-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--auth-text-title);
    margin-bottom: 6px;
}

.form-field-label .req {
    color: #e11d48;
    font-weight: 700;
    margin-left: 3px;
}

.form-field-label .forgot-link {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--auth-primary);
    text-decoration: none;
}

.form-field-label .forgot-link:hover {
    color: var(--auth-primary-hover);
    text-decoration: underline;
}

.form-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input-icon {
    position: absolute;
    left: 14px;
    color: var(--auth-text-sub);
    font-size: 1.15rem;
    pointer-events: none;
    z-index: 2;
}

.form-input-ctrl {
    width: 100%;
    height: 48px;
    padding: 10px 14px 10px 42px;
    background: #ffffff;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-input);
    color: var(--auth-text-title);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    outline: none;
    transition: all 0.2s ease;
}

.form-input-ctrl::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.form-input-ctrl:focus {
    border-color: var(--auth-border-focus);
    background: #ffffff;
    box-shadow: 0 0 0 3.5px var(--auth-primary-glow);
}

.form-input-wrap:focus-within .form-input-icon {
    color: var(--auth-primary);
}

.form-input-ctrl.no-icon {
    padding-left: 14px;
}

textarea.form-input-ctrl {
    height: auto;
    min-height: 76px;
    padding-left: 42px;
    resize: vertical;
}

select.form-input-ctrl {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    padding-right: 36px;
    cursor: pointer;
}

.form-pass-toggle {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    padding: 8px 10px;
    color: var(--auth-text-muted);
    font-size: 1.15rem;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.form-pass-toggle:hover {
    color: var(--auth-primary);
}

.form-input-ctrl.has-pass-toggle {
    padding-right: 46px;
}

/* ── PHONE INPUT GROUP ──────────────────────────────────── */
.phone-input-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.phone-input-group .phone-code-select {
    width: 98px;
    flex-shrink: 0;
    height: 48px;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-input);
    padding: 0 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--auth-text-title);
    background-color: #f8fafc;
    cursor: pointer;
    outline: none;
}

.phone-input-group .phone-code-select:focus {
    border-color: var(--auth-border-focus);
    box-shadow: 0 0 0 3px var(--auth-primary-glow);
}

/* ── SECTION TITLE BAR (FOR SIGNUP) ─────────────────────── */
.form-section-heading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--auth-primary);
    background: var(--auth-primary-light);
    border: 1px solid #dbeafe;
    padding: 5px 12px;
    border-radius: 8px;
    margin: 18px 0 12px 0;
}

.form-section-heading i {
    font-size: 1.1rem;
}

.form-section-heading:first-of-type {
    margin-top: 0;
}

/* ── GRID SYSTEM FOR FORMS ──────────────────────────────── */
.auth-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.auth-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.auth-col-full {
    grid-column: 1 / -1;
}

/* ── CAPTCHA CARD ───────────────────────────────────────── */
.auth-captcha-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-captcha-badge {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border: 1px solid #cbd5e1;
    border-radius: var(--auth-radius-input);
    font-family: monospace;
    font-size: 1.05rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: 2px;
    flex-shrink: 0;
}

/* ── CHECKBOX STYLES ────────────────────────────────────── */
.auth-check-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--auth-text-body);
    line-height: 1.45;
    cursor: pointer;
    user-select: none;
}

.auth-check-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--auth-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.auth-check-label a {
    color: var(--auth-primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-check-label a:hover {
    text-decoration: underline;
}

/* ── SUBMIT BUTTON ──────────────────────────────────────── */
.btn-auth-primary {
    width: 100%;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--auth-radius-btn);
    font-family: inherit;
    font-size: 0.96rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 20px -3px rgba(37, 99, 235, 0.35);
    transition: all 0.25s ease;
}

.btn-auth-primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 12px 24px -4px rgba(37, 99, 235, 0.45);
    transform: translateY(-1.5px);
    color: #ffffff;
}

.btn-auth-primary:active {
    transform: translateY(0);
}

.btn-auth-primary i {
    font-size: 1.15rem;
    transition: transform 0.2s ease;
}

.btn-auth-primary:hover i {
    transform: translateX(3px);
}

/* ── BOTTOM LINKS & FOOTER ──────────────────────────────── */
.auth-bottom-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 0.88rem;
    color: var(--auth-text-muted);
}

.auth-bottom-switch a {
    color: var(--auth-primary);
    font-weight: 700;
    text-decoration: none;
}

.auth-bottom-switch a:hover {
    color: var(--auth-primary-hover);
    text-decoration: underline;
}

.auth-global-footer {
    text-align: center;
    margin-top: 22px;
    font-size: 0.78rem;
    color: var(--auth-text-sub);
}

.auth-global-footer a {
    color: var(--auth-text-muted);
    text-decoration: none;
    margin: 0 6px;
}

.auth-global-footer a:hover {
    color: var(--auth-primary);
}

.auth-recover-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: var(--auth-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 14px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE OVERHAUL (IOS & ANDROID OPTIMIZED)
   ========================================================================== */
@media (max-width: 960px) {
    .auth-page-wrapper {
        padding: 16px 12px;
        justify-content: flex-start;
    }

    .auth-container,
    .auth-container-wide,
    .auth-container-compact {
        max-width: 520px;
        width: 100%;
    }

    .auth-master-card {
        flex-direction: column;
        border-radius: 18px;
        box-shadow: 0 8px 25px rgba(15, 23, 42, 0.08);
    }

    /* ── STREAMLINED MOBILE HEADER: NO MORE MASSIVE SCROLLING! ── */
    .auth-brand-section {
        width: 100% !important;
        padding: 16px 20px !important;
        background: linear-gradient(135deg, #091a38 0%, #1e40af 100%) !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        min-height: auto !important;
    }

    .brand-header-box {
        margin: 0;
    }

    .brand-logo-link {
        font-size: 1.1rem;
        gap: 10px;
    }

    .brand-logo-img {
        width: 36px !important;
        height: 36px !important;
        max-height: 36px !important;
        max-width: 36px !important;
        border-radius: 50% !important;
        object-fit: cover !important;
        aspect-ratio: 1 / 1 !important;
    }

    .brand-logo-fallback {
        width: 36px !important;
        height: 36px !important;
        font-size: 1.1rem !important;
        border-radius: 50% !important;
        aspect-ratio: 1 / 1 !important;
    }

    /* Hide the tall marketing text on mobile so the form is immediately accessible! */
    .brand-body-box,
    .brand-footer-box {
        display: none !important;
    }

    /* Compact live badge on top right of mobile header */
    .auth-brand-section::after {
        display: none;
    }

    .auth-form-section {
        padding: 24px 20px !important;
    }

    .auth-form-header {
        flex-direction: column;
        gap: 4px;
        margin-bottom: 20px;
    }

    .auth-form-title {
        font-size: 1.45rem;
    }

    .auth-form-sub {
        font-size: 0.85rem;
    }

    .auth-switch-link {
        text-align: left;
        padding-top: 2px;
    }
}

@media (max-width: 640px) {
    .auth-page-wrapper {
        padding: 8px 6px;
    }

    .auth-master-card {
        border-radius: 16px;
        border: 1px solid #e2e8f0;
    }

    .auth-brand-section {
        padding: 14px 16px !important;
        border-radius: 16px 16px 0 0;
    }

    .auth-form-section {
        padding: 20px 16px !important;
    }

    /* Stack all multi-column grids cleanly into 1 column on phone */
    .auth-grid-2,
    .auth-grid-3 {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* 16px font size on inputs to strictly prevent iOS Safari auto-zoom on tap */
    .form-input-ctrl {
        height: 48px;
        font-size: 16px !important;
        padding-left: 40px;
    }

    textarea.form-input-ctrl {
        font-size: 16px !important;
    }

    select.form-input-ctrl {
        font-size: 16px !important;
    }

    .phone-input-group .phone-code-select {
        height: 48px;
        font-size: 15px !important;
    }

    .btn-auth-primary {
        height: 48px;
        font-size: 15px;
    }

    .btn-google-sso {
        font-size: 0.88rem;
        padding: 10px 14px;
    }

    .auth-captcha-wrapper {
        flex-direction: row;
    }

    .auth-captcha-badge {
        height: 48px;
        font-size: 1rem;
        padding: 0 12px;
    }

    .form-section-heading {
        width: 100%;
        justify-content: flex-start;
        margin: 14px 0 10px 0;
    }
}
</style>