/* ============================================================
   MODERN FORMS CSS
   File: modern-forms.css
   Prefix: auth-
   Description: Shared styles for all modern auth/form pages —
   login, register, password reset, and any future form pages.
   Requires Google Fonts (loaded in the page or layout):
     DM Sans 300/400/500/600 + Syne 700/800
   ============================================================ */


/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    --mf-primary:        #6366f1;   /* indigo */
    --mf-primary-dark:   #4f46e5;
    --mf-blue:           #3b82f6;
    --mf-blue-dark:      #2563eb;
    --mf-violet:         #8b5cf6;

    --mf-success-bg:     #ecfdf5;
    --mf-success-border: #6ee7b7;
    --mf-success-text:   #065f46;

    --mf-error-bg:       #fff1f2;
    --mf-error-border:   #fda4af;
    --mf-error-text:     #9f1239;

    --mf-warning-bg:     #fffbeb;
    --mf-warning-border: #fcd34d;
    --mf-warning-text:   #92400e;

    --mf-info-bg:        #eff6ff;
    --mf-info-border:    #93c5fd;
    --mf-info-text:      #1e40af;

    --mf-text-dark:      #0f172a;
    --mf-text-body:      #475569;
    --mf-text-muted:     #64748b;
    --mf-text-faint:     #94a3b8;

    --mf-border:         #e2e8f0;
    --mf-bg-page:        #f0f4ff;
    --mf-bg-card:        rgba(255,255,255,0.85);

    --mf-radius-card:    24px;
    --mf-radius-input:   10px;
    --mf-radius-btn:     12px;
    --mf-radius-alert:   10px;

    --mf-font-body:      'DM Sans', sans-serif;
    --mf-font-display:   'Syne', sans-serif;
}


/* ── Page Shell ─────────────────────────────────────────────── */
/*
   Wraps the entire page. Centres the card vertically and
   horizontally with the gradient background.
*/
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(59,130,246,.13) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 90%, rgba(139,92,246,.10) 0%, transparent 60%),
        var(--mf-bg-page);
    font-family: var(--mf-font-body);
}


/* ── Card ───────────────────────────────────────────────────── */
/*
   Base card — use .auth-card-sm (login, reset) or
   .auth-card-md (register, wider forms) on the same element
   to control max-width.
*/
.auth-card {
    width: 100%;
    background: var(--mf-bg-card);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-radius: var(--mf-radius-card);
    border: 1px solid rgba(255,255,255,0.9);
    box-shadow:
        0 4px 6px rgba(0,0,0,0.04),
        0 20px 48px rgba(59,130,246,0.10),
        0 1px 0 rgba(255,255,255,0.9) inset;
    overflow: hidden;
    animation: mfCardIn 0.5s cubic-bezier(.22,1,.36,1) both;
}

/* Width modifiers */
.auth-card-sm { max-width: 460px; }   /* login, password reset */
.auth-card-md { max-width: 500px; }   /* register */
.auth-card-lg { max-width: 600px; }   /* future wide forms */

@keyframes mfCardIn {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ── Card Header ────────────────────────────────────────────── */
.auth-header {
    padding: 36px 40px 28px;
    border-bottom: 1px solid rgba(59,130,246,0.08);
    text-align: center;
    position: relative;
}

/* Accent gradient bar at top of header */
.auth-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--mf-blue) 0%, var(--mf-primary) 50%, var(--mf-violet) 100%);
}

/* Icon ring inside header */
.auth-logo-ring {
    width: 62px;
    height: 62px;
    margin: 0 auto 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--mf-blue) 0%, var(--mf-primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(99,102,241,0.30);
}

/* Variant: violet ring (used on register) */
.auth-logo-ring--violet {
    background: linear-gradient(135deg, var(--mf-primary) 0%, var(--mf-violet) 100%);
    box-shadow: 0 8px 20px rgba(139,92,246,0.30);
}

.auth-logo-ring svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-title {
    font-family: var(--mf-font-display);
    font-size: 22px;
    font-weight: 800;
    color: var(--mf-text-dark);
    letter-spacing: -0.3px;
    margin: 0 0 6px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--mf-text-muted);
    font-weight: 400;
    margin: 0;
}


/* ── Card Body ──────────────────────────────────────────────── */
.auth-body {
    padding: 32px 40px 36px;
}


/* ── Back Link ──────────────────────────────────────────────── */
.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--mf-primary);
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 24px;
    transition: gap 0.2s ease, color 0.2s ease;
}

.auth-back:hover {
    color: var(--mf-primary-dark);
    gap: 10px;
}


/* ── Alert / Status Messages ────────────────────────────────── */
/* Base */
.auth-alert {
    border-radius: var(--mf-radius-alert);
    padding: 12px 16px;
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Variants */
.auth-alert-success {
    background: var(--mf-success-bg);
    border: 1px solid var(--mf-success-border);
    color: var(--mf-success-text);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.auth-alert-error {
    background: var(--mf-error-bg);
    border: 1px solid var(--mf-error-border);
    color: var(--mf-error-text);
}

.auth-alert-error ul {
    margin: 0;
    padding-left: 18px;
}

.auth-alert-warning {
    background: var(--mf-warning-bg);
    border: 1px solid var(--mf-warning-border);
    color: var(--mf-warning-text);
}

.auth-alert-info {
    background: var(--mf-info-bg);
    border: 1px solid var(--mf-info-border);
    color: var(--mf-info-text);
}


/* ── Form Fields ────────────────────────────────────────────── */
.auth-field {
    margin-bottom: 20px;
}

.auth-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--mf-text-body);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
}

/* Input wrapper — needed to position icon and eye button */
.auth-input-wrap {
    position: relative;
}

/* Leading icon inside input */
.auth-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--mf-text-faint);
    pointer-events: none;
}

/* The input itself */
.auth-input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 1.5px solid var(--mf-border);
    border-radius: var(--mf-radius-input);
    font-family: var(--mf-font-body);
    font-size: 15px;
    color: var(--mf-text-dark);
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

/* Input without a leading icon (no padding offset needed) */
.auth-input--plain {
    padding-left: 14px;
}

.auth-input:focus {
    outline: none;
    border-color: var(--mf-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.auth-input.is-invalid {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248,113,113,0.12);
}

/* Validation error message under a field */
.auth-invalid-msg {
    font-size: 12px;
    color: #dc2626;
    margin-top: 5px;
}

/* Hint / helper text under a field */
.auth-hint {
    font-size: 12px;
    color: var(--mf-text-faint);
    margin-top: 5px;
}


/* ── Password Eye Toggle ────────────────────────────────────── */
.auth-eye {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--mf-text-faint);
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    transition: color 0.2s ease;
}

.auth-eye:hover { color: var(--mf-primary); }


/* ── Password Strength Bar ──────────────────────────────────── */
.auth-strength {
    margin-top: 8px;
}

.auth-strength-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--mf-border);
    overflow: hidden;
}

.auth-strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: width 0.3s ease, background 0.3s ease;
}

.auth-strength-label {
    font-size: 11px;
    color: var(--mf-text-faint);
    margin-top: 4px;
}


/* ── Remember Me + Forgot Password Row ─────────────────────── */
.auth-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 8px;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--mf-text-body);
    cursor: pointer;
}

.auth-remember input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--mf-primary);
    cursor: pointer;
}

.auth-forgot {
    font-size: 13px;
    color: var(--mf-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.auth-forgot:hover {
    color: var(--mf-primary-dark);
    text-decoration: underline;
}


/* ── Submit Button ──────────────────────────────────────────── */
.auth-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--mf-primary) 0%, var(--mf-blue) 100%);
    color: #fff;
    border: none;
    border-radius: var(--mf-radius-btn);
    font-family: var(--mf-font-display);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 4px 14px rgba(99,102,241,0.35);
    position: relative;
    overflow: hidden;
}

/* Glass sheen overlay */
.auth-submit::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
    pointer-events: none;
}

.auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(99,102,241,0.45);
}

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

/* Disabled state */
.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}


/* ── Divider ────────────────────────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
}

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

.auth-divider span {
    font-size: 12px;
    color: var(--mf-text-faint);
    white-space: nowrap;
}


/* ── Footer / Cross-link ────────────────────────────────────── */
.auth-footer-link {
    text-align: center;
    font-size: 13px;
    color: var(--mf-text-muted);
}

.auth-footer-link a {
    color: var(--mf-primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer-link a:hover { text-decoration: underline; }


/* ── Two-column layout helper (register / wider forms) ──────── */
.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Forces a field to span both columns inside .auth-row */
.auth-field--full {
    grid-column: 1 / -1;
}


/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    .auth-header,
    .auth-body {
        padding-left: 24px;
        padding-right: 24px;
    }

    .auth-header {
        padding-top: 28px;
    }

    .auth-title {
        font-size: 20px;
    }

    .auth-row {
        grid-template-columns: 1fr;
    }

    .auth-submit {
        font-size: 14px;
        padding: 13px;
    }
}