/* ================================================================
   Kartivo — Unified Auth Pages Stylesheet
   Used by: login, signup, forgot-password, reset-password
           + portal/login, portal/register, portal/forgot, portal/reset
   ================================================================ */

/* ── CSS Variables ── */
:root {
    /* Seller theme (warm brand) */
    --auth-brand: #ff6b35;
    --auth-brand-deep: #e55a2b;
    --auth-brand-glow: #ff9a6c;
    --auth-gradient-start: #1a1a2e;
    --auth-gradient-mid: #16213e;
    --auth-gradient-end: #0f3460;

    /* Shared tokens */
    --auth-surface: #ffffff;
    --auth-surface-alt: #f8f9fc;
    --auth-ink: #1e1b4b;
    --auth-ink-muted: #6b7280;
    --auth-ink-faint: #9ca3af;
    --auth-border: #e5e7eb;
    --auth-danger: #dc2626;
    --auth-success: #059669;
    --auth-radius: 10px;
}

/* Portal theme override */
.auth-theme-portal {
    --auth-brand: #4f46e5;
    --auth-brand-deep: #3730a3;
    --auth-brand-glow: #818cf8;
    --auth-gradient-start: #1e1b4b;
    --auth-gradient-mid: #312e81;
    --auth-gradient-end: #4f46e5;
}

/* ── Reset & Base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    font-family: 'DM Sans', sans-serif;
    background: var(--auth-surface);
    color: var(--auth-ink);
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ── Split Layout Shell ── */
.auth-shell {
    display: flex;
    min-height: 100vh;
}

/* ── Left Brand Panel ── */
.auth-brand {
    flex: 0 0 46%;
    background: linear-gradient(160deg, var(--auth-gradient-start) 0%, var(--auth-gradient-mid) 40%, var(--auth-gradient-end) 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem 3.5rem;
}

/* Geometric decorations */
.auth-brand::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -120px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    border: 60px solid rgba(255, 255, 255, 0.03);
}

.auth-brand::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -60px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
}

.brand-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 60% at 30% 50%, black 20%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 30% 50%, black 20%, transparent 100%);
}

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

.brand-logo-wrap {
    margin-bottom: 3rem;
}

.brand-logo-wrap img {
    height: 36px;
    filter: brightness(0) invert(1);
}

.auth-brand h1 {
    font-family: 'DM Serif Display', serif;
    font-size: 2.75rem;
    line-height: 1.15;
    color: #fff;
    margin-bottom: 1.25rem;
    letter-spacing: -0.01em;
}

.auth-brand p.brand-desc {
    font-size: 1.05rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.6);
    max-width: 400px;
    font-weight: 300;
}

/* Brand features list */
.brand-features {
    list-style: none;
    padding: 0;
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.brand-features li {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
}

.brand-features li i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--auth-brand-glow);
    flex-shrink: 0;
}

/* Stats row */
.brand-stats {
    display: flex;
    gap: 2.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-stats .stat-num {
    font-family: 'DM Serif Display', serif;
    font-size: 1.75rem;
    color: var(--auth-brand-glow);
}

.brand-stats .stat-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.15rem;
}

/* Brand screenshot */
.brand-screenshot {
    margin-top: 2.5rem;
    position: relative;
}

.brand-screenshot img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── Right Form Panel ── */
.auth-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    background: var(--auth-surface);
    position: relative;
    overflow-y: auto;
}

.auth-form-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--auth-border), transparent);
}

.auth-form-wrap {
    width: 100%;
    max-width: 440px;
    animation: authFadeUp 0.5s ease-out both;
}

.auth-form-wrap.auth-form-wide {
    max-width: 480px;
}

/* Mobile logo */
.mobile-logo {
    display: none;
    text-align: center;
    margin-bottom: 2rem;
}

.mobile-logo img {
    height: 32px;
}

/* ── Form Heading ── */
.form-heading {
    margin-bottom: 0.5rem;
}

.form-heading h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.85rem;
    color: var(--auth-ink);
    letter-spacing: -0.01em;
    margin: 0;
}

.form-heading p {
    color: var(--auth-ink-muted);
    font-size: 0.95rem;
    margin-top: 0.35rem;
    margin-bottom: 0;
}

/* ── Alerts ── */
.auth-alert {
    border-radius: var(--auth-radius);
    padding: 0.85rem 1.1rem;
    font-size: 0.88rem;
    border: none;
    margin-top: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.auth-alert i {
    margin-top: 2px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.auth-alert.alert-danger {
    background: #fef2f2;
    color: var(--auth-danger);
}

.auth-alert.alert-success {
    background: #ecfdf5;
    color: var(--auth-success);
}

.auth-alert.alert-info {
    background: #eff6ff;
    color: #1d4ed8;
}

.auth-alert.alert-warning {
    background: #fffbeb;
    color: #92400e;
}

.auth-alert ul {
    margin: 0;
    padding-left: 1rem;
}

/* ── Form ── */
.auth-form {
    margin-top: 2rem;
}

/* ── Field Groups ── */
.field-group {
    margin-bottom: 1.25rem;
}

.field-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--auth-ink);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.45rem;
}

.field-input-wrap {
    position: relative;
}

.field-input-wrap .field-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-ink-faint);
    font-size: 0.9rem;
    transition: color 0.2s;
    pointer-events: none;
    z-index: 1;
}

.field-input {
    width: 100%;
    padding: 0.82rem 1rem 0.82rem 2.75rem;
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-radius);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: var(--auth-ink);
    background: var(--auth-surface);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.field-input.no-icon {
    padding-left: 1rem;
}

.field-input::placeholder {
    color: var(--auth-ink-faint);
    font-weight: 300;
}

.field-input:focus {
    border-color: var(--auth-brand);
    box-shadow: 0 0 0 3px rgba(var(--auth-brand-rgb, 79, 70, 229), 0.1);
}

.auth-theme-portal .field-input:focus {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.auth-shell:not(.auth-theme-portal) .field-input:focus {
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.field-input:focus ~ .field-icon {
    color: var(--auth-brand);
}

.field-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--auth-ink-faint);
    margin-top: 0.35rem;
}

/* Two-column row */
.field-row {
    display: flex;
    gap: 1rem;
}

.field-row .field-group {
    flex: 1;
}

/* ── Password Toggle ── */
.toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--auth-ink-faint);
    cursor: pointer;
    padding: 0;
    font-size: 0.95rem;
    transition: color 0.2s;
    z-index: 1;
}

.toggle-password:hover {
    color: var(--auth-brand);
}

/* ── Remember / Forgot row ── */
.form-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    margin-top: 0.25rem;
}

.custom-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.custom-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--auth-brand);
    cursor: pointer;
}

.custom-check span {
    font-size: 0.88rem;
    color: var(--auth-ink-muted);
    user-select: none;
}

.forgot-link {
    font-size: 0.88rem;
    color: var(--auth-brand);
    font-weight: 500;
    transition: color 0.2s;
}

.forgot-link:hover {
    color: var(--auth-brand-deep);
}

/* ── Submit Button ── */
.btn-auth {
    width: 100%;
    padding: 0.9rem;
    border: none;
    border-radius: var(--auth-radius);
    background: var(--auth-brand);
    color: #fff;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-auth:hover {
    background: var(--auth-brand-deep);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.btn-auth:active {
    transform: scale(0.985);
}

.btn-auth i {
    font-size: 0.85rem;
}

/* ── Social Login Buttons ── */
.social-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--auth-ink-faint);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

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

.social-buttons {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0;
}

.social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 0.5rem;
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-radius);
    background: var(--auth-surface);
    color: var(--auth-ink);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.social-btn:hover {
    border-color: var(--auth-ink-faint);
    background: var(--auth-surface-alt);
    color: var(--auth-ink);
}

.social-btn i {
    font-size: 1rem;
}

.social-btn.google i { color: #ea4335; }
.social-btn.facebook i { color: #1877f2; }
.social-btn.whatsapp i { color: #25d366; }

.social-btn.google:hover { border-color: #ea4335; background: #fef2f2; }
.social-btn.facebook:hover { border-color: #1877f2; background: #eff6ff; }
.social-btn.whatsapp:hover { border-color: #25d366; background: #ecfdf5; }

/* ── CAPTCHA Area ── */
.captcha-group {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: var(--auth-surface-alt);
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-radius);
}

.captcha-group .field-group {
    flex: 1;
    margin-bottom: 0;
}

.captcha-group img {
    border-radius: 6px;
    height: 42px;
    flex-shrink: 0;
}

/* ── Plan Info Banner ── */
.plan-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    background: #eff6ff;
    border-radius: var(--auth-radius);
    margin-bottom: 0.5rem;
    margin-top: 1.25rem;
}

.plan-banner i {
    color: #3b82f6;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.plan-banner .plan-banner-text {
    font-size: 0.88rem;
    color: #1e40af;
    line-height: 1.5;
}

.plan-banner .plan-banner-text strong {
    font-weight: 600;
}

.plan-banner .plan-banner-text small {
    display: block;
    color: #3b82f6;
    margin-top: 0.15rem;
}

/* ── Footer Links ── */
.auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--auth-border);
}

.auth-footer p {
    font-size: 0.9rem;
    color: var(--auth-ink-muted);
    margin: 0;
}

.auth-footer a {
    color: var(--auth-brand);
    font-weight: 600;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: var(--auth-brand-deep);
}

.auth-footer .portal-nudge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.85rem;
    font-size: 0.82rem;
    color: var(--auth-ink-faint);
}

.auth-footer .portal-nudge a {
    font-weight: 500;
    color: var(--auth-ink-muted);
}

.auth-footer .portal-nudge a:hover {
    color: var(--auth-brand);
}

/* ── Info Note (portal register) ── */
.auth-info-note {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.85rem 1.1rem;
    background: #fffbeb;
    border-radius: var(--auth-radius);
    font-size: 0.85rem;
    color: #92400e;
    margin-top: 1.25rem;
}

.auth-info-note i {
    margin-top: 2px;
    flex-shrink: 0;
}

/* ── Animations ── */
@keyframes authFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes authFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.brand-content {
    animation: authFadeIn 0.7s ease-out 0.15s both;
}

/* ── Responsive ── */
@media (max-width: 991.98px) {
    .auth-brand {
        display: none;
    }

    .auth-form-panel::before {
        display: none;
    }

    .auth-form-panel {
        background: var(--auth-surface-alt);
        padding: 2rem 1.25rem;
    }

    .auth-form-wrap {
        background: var(--auth-surface);
        padding: 2.25rem 1.75rem;
        border-radius: 16px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
    }

    .mobile-logo {
        display: block;
    }
}

@media (max-width: 480px) {
    .auth-form-wrap {
        padding: 1.75rem 1.25rem;
    }

    .form-heading h2 {
        font-size: 1.5rem;
    }

    .form-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .field-row {
        flex-direction: column;
        gap: 0;
    }

    .social-buttons {
        flex-direction: column;
    }

    .brand-stats {
        gap: 1.5rem;
    }
}

/* ── Password Strength Indicator ── */
.password-strength {
    display: flex;
    gap: 4px;
    margin-top: 0.5rem;
}

.password-strength .strength-bar {
    height: 3px;
    flex: 1;
    border-radius: 2px;
    background: var(--auth-border);
    transition: background 0.3s;
}

.password-strength.weak .strength-bar:nth-child(1) { background: #ef4444; }
.password-strength.medium .strength-bar:nth-child(1),
.password-strength.medium .strength-bar:nth-child(2) { background: #f59e0b; }
.password-strength.strong .strength-bar:nth-child(1),
.password-strength.strong .strength-bar:nth-child(2),
.password-strength.strong .strength-bar:nth-child(3) { background: #10b981; }
.password-strength.very-strong .strength-bar { background: #059669; }
