/**
 * auth.css — Midway Wholesale Unified Auth Stylesheet
 * Covers: login, register (company/employee), register choice,
 *         forgot/reset password, forgot/reset username,
 *         verify email, approve-user
 *
 * Mobile-first. One file, one look.
 * @version 1.0
 */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&display=swap');

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
    font-family: 'DM Sans', sans-serif;
}

/* ─── Page background ─────────────────────────────────────────
   Same dark navy on every auth page.
──────────────────────────────────────────────────────────────── */
body {
    background: #0d1b3e;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;       /* let content scroll naturally */
    padding: 32px 16px 48px;
    position: relative;
    overflow-x: hidden;
}

/* Subtle grid overlay */
body::before {
    content: '';
    position: fixed; inset: 0;
    background-image:
        linear-gradient(rgba(59,130,246,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59,130,246,0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* Glow blobs */
body::after {
    content: '';
    position: fixed;
    width: 520px; height: 520px;
    background: #1d4ed8;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.13;
    top: -140px; right: -120px;
    pointer-events: none;
    z-index: 0;
}

.blob-br {
    position: fixed;
    width: 420px; height: 420px;
    background: #2563eb;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.12;
    bottom: -90px; left: -90px;
    pointer-events: none;
    z-index: 0;
}

/* ─── Page wrapper ───────────────────────────────────────────── */
.auth-page {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;    /* login / narrow pages */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Wide variant for register forms that need more breathing room */
.auth-page--wide {
    max-width: 560px;
}

/* ─── Logo ───────────────────────────────────────────────────── */
.auth-logo {
    margin-bottom: 24px;
    text-align: center;
}

.auth-logo a { display: inline-block; }

.auth-logo img {
    max-height: 72px;
    width: auto;
    background: #ffffff;
    border-radius: 14px;
    padding: 10px 22px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.30);
    display: block;
}

/* ─── Card ───────────────────────────────────────────────────── */
.auth-card {
    width: 100%;
    background: #ffffff;
    border-radius: 20px;
    padding: 28px 22px 26px;
    box-shadow: 0 28px 72px rgba(0,0,0,0.36),
                0 0 0 1px rgba(255,255,255,0.10);
}

/* ─── Card header ────────────────────────────────────────────── */
.auth-card__title {
    font-size: 22px;
    font-weight: 700;
    color: #0a0f1e;
    text-align: center;
    margin-bottom: 4px;
    line-height: 1.2;
}

.auth-card__subtitle {
    font-size: 13px;
    color: #64748b;
    text-align: center;
    margin-bottom: 22px;
    line-height: 1.5;
}

/* ─── Back link ──────────────────────────────────────────────── */
.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #64748b;
    font-size: 13px;
    text-decoration: none;
    margin-bottom: 14px;
    transition: color 0.2s;
}
.auth-back:hover { color: #2563eb; }

/* ─── Section headings inside forms ─────────────────────────── */
.auth-section-heading {
    color: #1e3a8a;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding-bottom: 9px;
    border-bottom: 2px solid #e0e9ff;
}

.auth-section-heading i,
.auth-section-heading svg {
    color: #3b82f6;
    font-size: 15px;
    flex-shrink: 0;
}

.auth-section-note {
    color: #94a3b8;
    font-size: 12px;
    margin: -8px 0 14px;
}

.auth-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 20px 0;
}

/* ─── Form fields ────────────────────────────────────────────── */
.auth-field {
    margin-bottom: 14px;
    position: relative;
}

.auth-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
}

/* label + forgot link on same row (login) */
.auth-field__label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.auth-field__label-row label { margin-bottom: 0; }
.auth-field__label-row a {
    font-size: 12px;
    font-weight: 500;
    color: #2563eb;
    text-decoration: none;
}
.auth-field__label-row a:hover { text-decoration: underline; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #0f172a;
    font-size: 15px;
    font-family: 'DM Sans', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
select:focus {
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

input::placeholder { color: #94a3b8; }

.auth-field small {
    display: block;
    margin-top: 4px;
    color: #94a3b8;
    font-size: 11px;
    line-height: 1.4;
}

/* ─── Password wrapper ───────────────────────────────────────── */
.auth-pw-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-pw-wrap input { padding-right: 44px; }

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    display: flex;
    align-items: center;
    line-height: 1;
    transition: color 0.2s;
}
.toggle-password:hover { color: #2563eb; }

/* ─── Phone row ──────────────────────────────────────────────── */
.auth-phone-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-phone-row select { width: 100%; }
.auth-phone-row input  { width: 100%; }

/* ─── Two-col grid (always single col on mobile) ─────────────── */
.auth-two-col {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

/* ─── Password strength ──────────────────────────────────────── */
.pw-strength { margin: 7px 0 10px; }

.pw-strength__bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 5px;
}

.pw-strength__fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: width 0.3s, background 0.3s;
}

.pw-strength__text { font-size: 11px; color: #94a3b8; }

/* ─── Password requirements ──────────────────────────────────── */
.pw-requirements {
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 10px;
}

.requirement {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.3;
    transition: color 0.2s;
}

.requirement i { font-size: 14px; color: #ef4444; flex-shrink: 0; transition: color 0.2s; }
.requirement.met       { color: #16a34a; }
.requirement.met i     { color: #16a34a; }

/* ─── Validation feedback ────────────────────────────────────── */
.validation-feedback {
    margin-top: 5px;
    font-size: 12px;
    min-height: 17px;
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1.3;
}
.validation-feedback.success  { color: #16a34a; }
.validation-feedback.error    { color: #ef4444; }
.validation-feedback.checking { color: #f59e0b; }

/* ─── Username suggestions ───────────────────────────────────── */
.username-suggestions { margin-top: 7px; }

.suggestion-btn {
    display: inline-block;
    background: #eff6ff;
    color: #3b82f6;
    padding: 3px 9px;
    border-radius: 99px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #bfdbfe;
    margin: 3px 3px 0 0;
    transition: background 0.2s, color 0.2s;
}
.suggestion-btn:hover { background: #3b82f6; color: #fff; border-color: #3b82f6; }

/* ─── Company verified badge ─────────────────────────────────── */
.company-verified-badge {
    display: none;
    padding: 10px 13px;
    border-radius: 10px;
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    margin-bottom: 14px;
    align-items: center;
    gap: 9px;
}
.company-verified-badge.visible { display: flex; }
.company-verified-badge i   { color: #16a34a; font-size: 18px; flex-shrink: 0; }
.company-verified-badge span { color: #15803d; font-weight: 600; font-size: 13px; }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn-primary {
    display: block;
    width: 100%;
    padding: 13px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    margin-top: 6px;
}
.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37,99,235,0.30);
}
.btn-primary:active  { transform: translateY(0); }
.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px;
    background: #f1f5f9;
    color: #374151;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
.btn-secondary:hover { background: #e2e8f0; transform: translateY(-1px); }
.btn-secondary:active { transform: translateY(0); }

.btn-ghost {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    background: transparent;
    color: #94a3b8;
    border: none;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}
.btn-ghost:hover { color: #2563eb; }

/* ─── Separator ──────────────────────────────────────────────── */
.auth-sep {
    position: relative;
    text-align: center;
    margin: 18px 0;
}
.auth-sep::before {
    content: '';
    position: absolute;
    top: 50%; left: 0;
    width: 100%; height: 1px;
    background: #e2e8f0;
}
.auth-sep span {
    position: relative;
    background: #fff;
    padding: 0 12px;
    color: #94a3b8;
    font-size: 12px;
}

/* ─── Account links row ──────────────────────────────────────── */
.auth-links {
    text-align: center;
    margin-top: 4px;
}
.auth-links p { font-size: 13px; color: #64748b; margin-bottom: 10px; }

/* ─── Alert messages ─────────────────────────────────────────── */
.alert {
    padding: 11px 13px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.4;
}
.alert--success { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }
.alert--error   { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.alert--info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert--warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ─── Success state (after registration / reset / verify) ────── */
.auth-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 0;
    gap: 14px;
}

.auth-success__icon {
    width: 68px; height: 68px;
    border-radius: 50%;
    background: #eff6ff;
    border: 2px solid #bfdbfe;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: auth-pop 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
}
.auth-success__icon i { font-size: 30px; color: #2563eb; }
.auth-success__icon--green { background: #f0fdf4; border-color: #86efac; }
.auth-success__icon--green i { color: #16a34a; }
.auth-success__icon--red { background: #fef2f2; border-color: #fca5a5; }
.auth-success__icon--red i { color: #dc2626; }
.auth-success__icon--amber { background: #fffbeb; border-color: #fde68a; }
.auth-success__icon--amber i { color: #d97706; }

@keyframes auth-pop {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.auth-success__title {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.auth-success__sub {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    margin-top: -6px;
}

.auth-email-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 13px;
    color: #1e40af;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.auth-email-pill i { color: #3b82f6; font-size: 15px; flex-shrink: 0; }

.auth-info-card {
    width: 100%;
    background: #f8fafc;
    border-radius: 12px;
    padding: 14px 16px;
    text-align: left;
    border-left: 3px solid #3b82f6;
}
.auth-info-card p { font-size: 13px; color: #475569; line-height: 1.6; margin: 0; }
.auth-info-card p + p { margin-top: 6px; }

.auth-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

/* ─── Tips list (verify error state) ────────────────────────── */
.auth-tips {
    width: 100%;
    background: #f8fafc;
    border-radius: 12px;
    padding: 14px 16px;
    text-align: left;
    border-left: 3px solid #e2e8f0;
}
.auth-tips h4 { font-size: 13px; font-weight: 700; color: #1e293b; margin-bottom: 8px; }
.auth-tips ul  { list-style: none; padding: 0; margin: 0; }
.auth-tips li  {
    font-size: 12px; color: #64748b;
    padding: 4px 0 4px 14px;
    position: relative; line-height: 1.5;
}
.auth-tips li::before { content: '•'; position: absolute; left: 0; color: #3b82f6; }

/* ─── Register choice cards ──────────────────────────────────── */
.auth-choice-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    width: 100%;
    margin-bottom: 28px;
}

.auth-choice-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    background: rgba(255,255,255,0.09);
    border: 1.5px solid rgba(255,255,255,0.16);
    border-radius: 20px;
    padding: 28px 24px;
    transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s, background 0.3s;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.auth-choice-card:hover {
    border-color: rgba(59,130,246,0.65);
    transform: translateY(-5px);
    box-shadow: 0 20px 56px rgba(37,99,235,0.28);
    background: rgba(255,255,255,0.13);
}

.auth-choice-card__icon {
    width: 64px; height: 64px;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px;
    margin-bottom: 20px;
    background: rgba(59,130,246,0.26);
    color: #93c5fd;
    border: 1px solid rgba(59,130,246,0.32);
}

.auth-choice-card__title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.auth-choice-card__desc {
    font-size: 14px;
    color: #cbd5e1;
    line-height: 1.6;
    flex: 1;
}

.auth-choice-card__arrow {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #60a5fa;
    transition: gap 0.2s;
}
.auth-choice-card:hover .auth-choice-card__arrow { gap: 10px; }

/* choice page footer links */
.auth-choice-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: 14px;
}
.auth-choice-footer a { color: #60a5fa; text-decoration: none; font-weight: 500; }
.auth-choice-footer a:hover { color: #93c5fd; }
.auth-choice-footer .dot { color: #334155; }

/* ─── Approve-user page (standalone, no card—just the outer page) */
.auth-approve-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 20px;
    padding: 36px 28px 32px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.32);
    text-align: center;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (min-width: 480px) {
    body { padding: 40px 20px 56px; }

    .auth-card {
        padding: 40px 36px 36px;
        border-radius: 24px;
    }

    .auth-card__title { font-size: 26px; }

    .auth-logo img { max-height: 80px; }
    .auth-logo { margin-bottom: 28px; }

    .auth-two-col { grid-template-columns: 1fr 1fr; gap: 0 14px; }

    .auth-phone-row { flex-direction: row; }
    .auth-phone-row select { width: 140px; flex-shrink: 0; }
    .auth-phone-row input  { flex: 1; }

    .auth-choice-cards { grid-template-columns: 1fr 1fr; gap: 20px; }
    .auth-choice-card  { padding: 36px 28px; }

    .auth-actions { flex-direction: row; justify-content: center; }
    .auth-actions .btn-secondary { width: auto; min-width: 150px; }
}

@media (min-width: 600px) {
    .auth-page--wide { max-width: 600px; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* ─── phone_input.js injected select override ───────────────── */
.phone-input-wrapper {
    display: flex !important;
    gap: 8px !important;
    width: 100% !important;
}

.phone-input-wrapper .country-code-select,
select.country-code-select {
    flex: 0 0 140px !important;
    width: 140px !important;
    max-width: 140px !important;
    padding: 12px 8px !important;
    border: 2px solid #cbd5e1 !important;
    border-radius: 10px !important;
    background: #1e293b !important;
    color: #fff !important;
    font-size: 13px !important;
    font-family: 'DM Sans', sans-serif !important;
    cursor: pointer;
    box-shadow: none !important;
    transition: border-color 0.2s !important;
    box-sizing: border-box !important;
}

.phone-input-wrapper .country-code-select:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12) !important;
    outline: none;
}

.phone-input-wrapper input[type="tel"] {
    flex: 1 1 0% !important;
    min-width: 0 !important;
}