/*
 * Sign-in pages (login, register, forgot, reset) - light, in the dashboard's
 * Insights style: soft green-tinted brand panel on the left, a white card
 * with clear labels and one green action on the right. Shared by all four
 * pages (brand markup: includes/auth_brand.php).
 */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', -apple-system, 'Segoe UI', sans-serif; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { min-height: 100%; }
body { background: #f1f5f9; color: #334155; -webkit-font-smoothing: antialiased; }
a { color: #15803d; }

/* dvh = the screen actually visible; plain vh on phones/tablets includes the
   space behind the address bar, which made short pages scroll. */
.auth-wrapper { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

/* ---------- brand panel ---------- */
.brand-panel { position: relative; display: flex; align-items: center; justify-content: center; padding: 3rem 3.5rem; overflow: hidden;
    background: linear-gradient(155deg, #ecfdf5 0%, #f0fdf9 40%, #eff6ff 100%); border-right: 1px solid #e2e8f0; }
.brand-panel::before { content: ''; position: absolute; inset: 0; pointer-events: none;
    background-image: radial-gradient(rgba(15, 23, 42, .09) 1px, transparent 1px); background-size: 22px 22px;
    -webkit-mask-image: radial-gradient(ellipse at 30% 20%, #000 0%, transparent 70%); mask-image: radial-gradient(ellipse at 30% 20%, #000 0%, transparent 70%); }
.brand-panel::after { content: ''; position: absolute; width: 420px; height: 420px; right: -140px; bottom: -160px; border-radius: 50%;
    background: radial-gradient(circle, rgba(34, 197, 94, .16), transparent 65%); pointer-events: none; }
.brand-content { position: relative; z-index: 1; width: 100%; max-width: 460px; }
.brand-top { display: flex; align-items: center; gap: .8rem; margin-bottom: 2.4rem; }
.brand-logo { width: 52px; height: 52px; border-radius: 50%; object-fit: contain; background: #fff; box-shadow: 0 4px 14px rgba(15, 23, 42, .12); }
.brand-title { display: block; font-size: 17px; font-weight: 700; color: #0f172a; letter-spacing: -.2px; }
.brand-subtitle { display: block; font-size: 12.5px; color: #64748b; }
.brand-headline { font-size: 30px; line-height: 1.22; font-weight: 700; color: #0f172a; letter-spacing: -.6px; margin-bottom: .8rem; }
.brand-headline span { color: #16a34a; }
.brand-lead { font-size: 14px; line-height: 1.65; color: #475569; margin-bottom: 1.8rem; }
.brand-points { list-style: none; display: grid; gap: .7rem; }
.brand-points li { display: flex; align-items: flex-start; gap: .85rem; padding: .85rem 1rem; background: rgba(255, 255, 255, .78);
    border: 1px solid #e2e8f0; border-radius: 12px; backdrop-filter: blur(4px); }
.point-icon { width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; background: rgba(22, 163, 74, .12); color: #15803d; }
.point-icon.blue { background: rgba(14, 165, 233, .12); color: #0369a1; }
.point-icon.purple { background: rgba(168, 85, 247, .12); color: #7e22ce; }
.brand-points div > strong { display: block; font-size: 13.5px; font-weight: 600; color: #0f172a; }
.brand-points div > span { display: block; margin-top: .1rem; font-size: 12.5px; line-height: 1.5; color: #64748b; }
.brand-foot { display: flex; align-items: center; gap: .5rem; margin-top: 1.6rem; font-size: 12px; color: #64748b; }
.brand-foot i { color: #16a34a; }

/* ---------- form side ---------- */
.form-panel { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; background: #f8fafc; }
.form-container { width: 100%; max-width: 440px; }
.mobile-logo { display: none; }
.auth-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 2.1rem 2rem 1.8rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 18px 40px -18px rgba(15, 23, 42, .18); }

.form-header { margin-bottom: 1.5rem; }
.form-header h1 { font-size: 23px; font-weight: 700; color: #0f172a; letter-spacing: -.4px; margin-bottom: .3rem;
    background: none; -webkit-text-fill-color: currentColor; }
.form-header p { font-size: 13px; line-height: 1.55; color: #64748b; }
.form-header strong { color: #0f172a !important; font-weight: 600; }

.alert { display: flex; align-items: flex-start; gap: .6rem; padding: .75rem .9rem; margin-bottom: 1.1rem; border: 1px solid transparent;
    border-radius: 10px; font-size: 12.5px; line-height: 1.5; }
.alert i { margin-top: .15rem; }
.alert ul { margin: .25rem 0 0 1rem; }
.alert-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }

.form-group { margin-bottom: 1rem; }
.field-label, .form-label { display: block; margin-bottom: .4rem; font-size: 12.5px; font-weight: 600; color: #0f172a; }
.form-label i { margin-right: .25rem; font-size: 11px; color: #94a3b8; }
.input-wrapper { position: relative; }
.input-icon { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); font-size: 13px; color: #94a3b8; pointer-events: none; transition: color .15s; }
.form-input { width: 100%; height: 44px; padding: 0 .9rem 0 2.6rem; background: #fff; border: 1px solid #d5dce5; border-radius: 10px;
    color: #0f172a; font-size: 13.5px; transition: border-color .15s, box-shadow .15s; }
.input-wrapper:not(:has(.input-icon)) .form-input { padding-left: .9rem; }
.form-input:hover { border-color: #cbd5e1; }
.form-input:focus { outline: none; border-color: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .15); }
.input-wrapper:focus-within .input-icon { color: #16a34a; }
.form-input::placeholder { color: #94a3b8; }
.password-toggle { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); padding: .35rem .45rem; border: 0; border-radius: 6px;
    background: none; color: #94a3b8; cursor: pointer; }
.password-toggle:hover { color: #0f172a; background: #f1f5f9; }
.form-hint { margin-top: .4rem; font-size: 11.5px; color: #64748b; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; }

.form-options { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; font-size: 12.5px; }
.checkbox-wrapper { display: flex; align-items: center; gap: .55rem; font-size: 12.5px; color: #334155; cursor: pointer; }
.checkbox-wrapper input { width: 16px; height: 16px; accent-color: #16a34a; flex-shrink: 0; }
.checkbox-wrapper a, .forgot-link { color: #15803d; font-weight: 600; text-decoration: none; }
.checkbox-wrapper a:hover, .forgot-link:hover { text-decoration: underline; }

.btn-submit { width: 100%; height: 46px; display: flex; align-items: center; justify-content: center; gap: .5rem; border: 0; border-radius: 10px;
    background: #16a34a; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
    box-shadow: 0 1px 2px rgba(22, 163, 74, .25), 0 8px 18px -10px rgba(22, 163, 74, .6); transition: background .15s, box-shadow .15s; }
.btn-submit:hover { background: #15803d; }
.btn-submit:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(16, 185, 129, .3); }
.btn-submit:disabled { opacity: .65; cursor: default; }
.btn-outline { width: auto; background: #fff; color: #0f172a; border: 1px solid #d5dce5; box-shadow: none; }
.btn-outline:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-row { display: flex; gap: .6rem; }
.btn-row .btn-submit:not(.btn-outline) { flex: 1; }
.btn-link-plain { padding: .4rem; border: 0; background: none; color: #64748b; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.btn-link-plain:hover { color: #15803d; }

.welcome-line { display: flex; align-items: center; gap: .7rem; padding: .75rem .9rem; margin-bottom: 1rem; background: #f0fdf4;
    border: 1px solid #bbf7d0; border-radius: 10px; font-size: 13px; line-height: 1.4; color: #334155; }
.welcome-line i { font-size: 18px; color: #16a34a; }

.form-footer { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid #eef1f5; text-align: center; font-size: 13px; color: #64748b; }
.form-footer p { margin-bottom: .45rem; }
.form-footer p:last-child { margin-bottom: 0; }
.form-footer a { color: #15803d; font-weight: 600; text-decoration: none; }
.form-footer a:hover { text-decoration: underline; }
.back-link { display: inline-flex; align-items: center; gap: .4rem; margin-top: .3rem; color: #64748b !important; font-size: 12.5px; font-weight: 500 !important; }
.back-link:hover { color: #15803d !important; }

/* one-time code */
.otp-boxes { display: flex; justify-content: center; gap: .55rem; margin: .4rem 0; }
.otp-box { width: 48px; height: 56px; text-align: center; font-size: 20px; font-weight: 700; color: #0f172a; background: #fff;
    border: 1px solid #d5dce5; border-radius: 12px; transition: border-color .15s, box-shadow .15s; }
.otp-box:focus { outline: none; border-color: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .15); }
.otp-box.filled { border-color: #86efac; background: #f0fdf4; }
.otp-actions { display: flex; justify-content: space-between; margin-top: 1rem; }

/* register steps + password strength */
.step-indicator { display: flex; align-items: center; gap: .6rem; margin: -.3rem 0 1.4rem; }
.step-chip { display: flex; align-items: center; gap: .45rem; font-size: 12px; font-weight: 600; color: #94a3b8; }
.step-chip:has(.step-dot.active) { color: #0f172a; }
.step-dot { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
    background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.step-dot.active { background: #16a34a; border-color: #16a34a; color: #fff; }
.step-line { flex: 1; max-width: 64px; height: 2px; border-radius: 2px; background: #e2e8f0; }
.password-strength { height: 5px; margin-top: .5rem; border-radius: 999px; background: #f1f5f9; overflow: hidden; }
.strength-bar { width: 0; height: 100%; border-radius: 999px; transition: width .3s, background .3s; }
.strength-bar.weak { width: 25%; background: #ef4444; }
.strength-bar.fair { width: 50%; background: #f59e0b; }
.strength-bar.good { width: 75%; background: #0ea5e9; }
.strength-bar.strong { width: 100%; background: #16a34a; }
.strength-text { min-height: 1em; margin-top: .3rem; font-size: 11.5px; color: #64748b; }

/* Phone-only extras (markup: includes/auth_brand.php) - hidden until the
   phone breakpoint below turns them on. */
.m-pill, .m-hero-icon, .m-features, .m-steps { display: none; }

/* ---------- tablets: card only, compact logo row above it ---------- */
@media (max-width: 992px) {
    .auth-wrapper { grid-template-columns: minmax(0, 1fr); }
    .brand-panel { display: none; }
    .form-panel { min-height: 100vh; min-height: 100dvh; background: linear-gradient(180deg, #ecfdf5 0%, #f8fafc 260px); }
    .mobile-logo { display: flex; align-items: center; justify-content: center; gap: .7rem; margin-bottom: 1.25rem; }
    .mobile-logo img { width: 44px; height: 44px; border-radius: 50%; background: #fff; box-shadow: 0 3px 10px rgba(15, 23, 42, .12); }
    .mobile-logo strong { display: block; font-size: 15px; font-weight: 700; line-height: 1.25; color: #0f172a; letter-spacing: -.2px; }
    .mobile-logo span { display: block; font-size: 11.5px; color: #64748b; }
}

/* ---------- phones: all white - logo row, then the form flat on the page
   (no card edges), compact type. No minimum heights: the page is exactly as
   tall as its content and scrolls only when the content is longer. ---------- */
@media (max-width: 576px) {
    body { background: #fff; }
    html, body, .auth-wrapper { min-height: 0; }
    .form-panel { display: block; min-height: 0; padding: 0; background: #fff; }
    .form-container { max-width: none; }
    .mobile-logo { justify-content: flex-start; gap: .6rem; margin: 0; padding: 1rem 1.15rem 1.35rem; }
    .mobile-logo img { width: 34px; height: 34px; }
    .mobile-logo strong { font-size: 13.5px; }
    .mobile-logo span { font-size: 10.5px; }
    .auth-card { border: 0; border-radius: 0; padding: .4rem 1.15rem 1.75rem; box-shadow: none; }

    .form-header { margin-bottom: 1.1rem; }
    .form-header h1 { font-size: 18px; letter-spacing: -.3px; margin-bottom: .15rem; }
    .form-header p { font-size: 12px; }
    .alert { font-size: 11.5px; padding: .6rem .75rem; margin-bottom: .9rem; border-radius: 9px; }
    .form-group { margin-bottom: .75rem; }
    .field-label, .form-label { font-size: 11.5px; margin-bottom: .3rem; }
    .form-input { height: 40px; padding-left: 2.35rem; font-size: 13px; border-radius: 9px; }
    .input-icon { left: .85rem; font-size: 12px; }
    .password-toggle { font-size: 12.5px; }
    .form-hint, .strength-text { font-size: 10.5px; }
    .form-options { margin-bottom: 1rem; }
    .form-options, .checkbox-wrapper { font-size: 11.5px; }
    .checkbox-wrapper input { width: 15px; height: 15px; }
    .btn-submit { height: 42px; font-size: 13px; border-radius: 9px; }
    .btn-link-plain { font-size: 11.5px; }
    .welcome-line { font-size: 12px; padding: .6rem .75rem; margin-bottom: .85rem; }
    .welcome-line i { font-size: 15px; }
    .form-footer { margin-top: 1.1rem; padding-top: .95rem; font-size: 12px; }
    .back-link { font-size: 11.5px; }
    .step-indicator { margin: -.2rem 0 1rem; }
    .step-chip { font-size: 11px; }
    .step-dot { width: 20px; height: 20px; font-size: 10px; }
    .form-grid-2 { grid-template-columns: 1fr; }
    .form-options { flex-direction: row; }
    .otp-box { width: 40px; height: 48px; font-size: 17px; border-radius: 10px; }
}
/* ---------- phones: details that keep the white page from looking flat ---------- */
@media (max-width: 576px) {
    .auth-card { position: relative; padding-top: 1.3rem; overflow: hidden; }
    .auth-card > * { position: relative; z-index: 1; }
    .auth-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 200px; pointer-events: none;
        background-image: radial-gradient(rgba(15, 23, 42, .085) 1px, transparent 1px); background-size: 18px 18px;
        -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 100%); mask-image: linear-gradient(180deg, #000 0%, transparent 100%); }
    .auth-card::after { content: ''; position: absolute; top: -70px; left: -60px; width: 240px; height: 240px; border-radius: 50%;
        background: radial-gradient(circle, rgba(34, 197, 94, .13), transparent 65%); pointer-events: none; }

    /* header row: hairline under it, pill link on the right */
    .mobile-logo { position: relative; z-index: 2; padding: .8rem 1.15rem; border-bottom: 1px solid #eef2f6; background: #fff; }
    .m-pill { display: inline-flex; align-items: center; gap: .4rem; margin-left: auto; height: 30px; padding: 0 .8rem;
        border: 1px solid #e2e8f0; border-radius: 999px; background: #fff; color: #0f172a; font-size: 11.5px; font-weight: 600;
        text-decoration: none; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); white-space: nowrap; }
    .m-pill i { font-size: 10.5px; color: #16a34a; }
    .m-pill:active { background: #f1f5f9; }

    /* badge above the title */
    .m-hero-icon { display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; margin-bottom: .85rem;
        border-radius: 14px; background: linear-gradient(135deg, #22c55e, #15803d); color: #fff; font-size: 17px;
        box-shadow: 0 0 0 6px rgba(34, 197, 94, .1), 0 10px 20px -8px rgba(21, 128, 61, .55); }
    .form-header h1 { font-size: 19px; }

    /* softer fields on white */
    .form-input { background: #f8fafc; border-color: #e2e8f0; }
    .form-input:hover { border-color: #d5dce5; }
    .form-input:focus { background: #fff; }

    /* section label with hairlines either side */
    .m-section-title { display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem; font-size: 10px; font-weight: 600;
        letter-spacing: .09em; text-transform: uppercase; color: #94a3b8; }
    .m-section-title::before, .m-section-title::after { content: ''; flex: 1; height: 1px; background: #e8edf3; }

    /* login: three feature tiles */
    .m-features { display: block; margin-top: 1.3rem; }
    .m-features ul { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
    .m-features li { display: flex; flex-direction: column; align-items: center; gap: .45rem; padding: .8rem .35rem .75rem;
        border: 1px solid #eef2f6; border-radius: 12px; background: linear-gradient(180deg, #fff 0%, #fafcfb 100%);
        text-align: center; font-size: 10.5px; font-weight: 600; line-height: 1.3; color: #334155; }
    .m-features li i { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 9px;
        font-size: 12.5px; background: rgba(22, 163, 74, .1); color: #15803d; }
    .m-features li:nth-child(2) i { background: rgba(14, 165, 233, .1); color: #0369a1; }
    .m-features li:nth-child(3) i { background: rgba(168, 85, 247, .1); color: #7e22ce; }

    /* forgot: connected steps */
    .m-steps { display: block; margin-top: 1.3rem; padding: .95rem 1rem 1rem; border: 1px solid #eef2f6; border-radius: 12px; background: #fbfcfd; }
    .m-steps ol { list-style: none; display: grid; gap: .8rem; }
    .m-steps li { position: relative; display: flex; align-items: flex-start; gap: .7rem; }
    .m-steps li:not(:last-child)::after { content: ''; position: absolute; left: 11px; top: 25px; bottom: -.75rem; width: 1px; background: #d1fae5; }
    .m-steps b { flex-shrink: 0; width: 23px; height: 23px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
        background: #fff; border: 1px solid #bbf7d0; color: #15803d; font-size: 10.5px; font-weight: 700; }
    .m-steps strong { display: block; font-size: 12px; font-weight: 600; color: #0f172a; }
    .m-steps span { display: block; margin-top: .05rem; font-size: 11px; line-height: 1.45; color: #64748b; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
