/* ==========================================================================
   auth.css — Login, Register, Reset Password
   ========================================================================== */

:root {
    --auth-primary: #667eea;
    --auth-gradient-start: #667eea;
    --auth-gradient-end: #764ba2;
    --auth-indigo: #6366F1;
    --auth-text: #1f2937;
    --auth-text-light: #6b7280;
    --auth-bg: #f6f7fb;
    --auth-card-bg: #ffffff;
    --auth-border: #e5e7eb;
    --auth-error-bg: #fef2f2;
    --auth-error-text: #991b1b;
    --auth-error-border: #fecaca;
    --font-family: 'DM Sans', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: var(--auth-bg);
    color: var(--auth-text);
    -webkit-font-smoothing: antialiased;
}

/* --- Page layout --- */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f0f0ff 0%, #f6f7fb 50%, #faf5ff 100%);
}

/* --- Card --- */
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--auth-card-bg);
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
}

.auth-card__logo {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
}

.auth-card__logo a {
    display: inline-flex;
    text-decoration: none;
}

.auth-card__title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 28px;
    color: var(--auth-text);
}

/* --- Form elements --- */
.auth-field {
    margin-bottom: 18px;
}

.auth-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--auth-text);
    margin-bottom: 6px;
}

.auth-input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    font-size: 0.95rem;
    font-family: var(--font-family);
    color: var(--auth-text);
    background: var(--auth-card-bg);
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.auth-input::placeholder {
    color: #9ca3af;
}

/* --- Button --- */
.auth-btn {
    width: 100%;
    height: 48px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-family);
    color: #fff;
    background: linear-gradient(135deg, var(--auth-gradient-start), var(--auth-gradient-end));
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.3);
    margin-top: 8px;
}

.auth-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* --- Error alert --- */
.auth-error {
    background: var(--auth-error-bg);
    color: var(--auth-error-text);
    border: 1px solid var(--auth-error-border);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.auth-field-error {
    font-size: 0.8rem;
    color: #dc2626;
    margin-top: 6px;
}

.auth-field-error ul,
.auth-error ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.auth-field-error li,
.auth-error li {
    margin: 0;
    padding: 0;
}

/* --- Checkbox --- */
.auth-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 18px;
}

.auth-checkbox-row input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    accent-color: var(--auth-indigo);
}

.auth-checkbox-row label {
    font-size: 0.875rem;
    color: var(--auth-text);
    line-height: 1.5;
}

.auth-checkbox-row a {
    color: var(--auth-primary);
    text-decoration: none;
}

.auth-checkbox-row a:hover {
    text-decoration: underline;
}

/* --- Remember me + forgot row --- */
.auth-remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.auth-remember-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--auth-text);
    cursor: pointer;
}

.auth-remember-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--auth-indigo);
}

.auth-forgot-link {
    font-size: 0.875rem;
    color: var(--auth-primary);
    text-decoration: none;
}

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

/* --- Links --- */
.auth-links {
    text-align: center;
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--auth-text-light);
}

.auth-links a {
    color: var(--auth-primary);
    font-weight: 500;
    text-decoration: none;
}

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

/* --- Info text (check email page) --- */
.auth-info {
    font-size: 0.95rem;
    color: var(--auth-text);
    line-height: 1.6;
    margin-bottom: 16px;
}

/* --- Footer --- */
.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 0;
}

.auth-footer__links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.auth-footer__links a {
    font-size: 0.8rem;
    color: var(--auth-text-light);
    text-decoration: none;
}

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

/* --- Responsive --- */
@media (max-width: 480px) {
    .auth-page {
        padding: 24px 16px;
    }

    .auth-card {
        padding: 32px 24px;
        border-radius: 12px;
    }

    .auth-card__title {
        font-size: 1.3rem;
    }
}

/* ==========================================================================
   Native (Hotwire Native WebView) overrides — light only for v1.
   Scoped under body.is-native (set in auth/base.html.twig from the Hotwire
   Native User-Agent), mirroring the app-wide pattern in app.css. The native
   chrome (iOS nav bar / Android toolbar + tab bar) sits OUTSIDE the WebView,
   so we only respect env(safe-area-inset-bottom) — never inset-top. No
   viewport-fit=cover / full-bleed here: the shipped iOS shell keeps the
   WebView between the bars (edgesForExtendedLayout = []), so it would be inert
   and full-bleed under the still-present bar looks worse. Revisit per-platform
   once the native bar-hide ships (see plan Phase 2).
   ========================================================================== */
body.is-native {
    /* System font stack — no render-blocking webfont on cold WebView launch. */
    font-family: -apple-system, BlinkMacSystemFont, Roboto, 'Segoe UI', sans-serif;
    background: #fff;
}

body.is-native .auth-page {
    min-height: 100vh;            /* fallback for older WebViews */
    min-height: 100dvh;           /* keyboard-/chrome-aware viewport */
    justify-content: flex-start;  /* top-anchor so register's lower fields clear the IME */
    background: #fff;             /* drop the marketing gradient */
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

/* Flat surface instead of a floating shadowed card. */
body.is-native .auth-card {
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

/* 16px font-size stops the iOS focus auto-zoom; larger touch target. */
body.is-native .auth-input {
    height: 52px;
    font-size: 16px;
    border-radius: 12px;
    scroll-margin-top: 24px;      /* focused field scrolls clear of the keyboard */
}

/* Press feedback for touch instead of the desktop hover-lift. */
body.is-native .auth-btn {
    height: 56px;
    border-radius: 12px;
    -webkit-tap-highlight-color: transparent;
}

body.is-native .auth-btn:hover {
    transform: none;
    opacity: 1;
}

body.is-native .auth-btn:active {
    transform: scale(0.985);
    opacity: 0.92;
}

body.is-native .auth-forgot-link:active,
body.is-native .auth-links a:active {
    opacity: 0.6;
}

/* Bigger checkbox tap targets. */
body.is-native .auth-checkbox-row input[type="checkbox"],
body.is-native .auth-remember-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

/* The "Remember me" checkbox is dropped on native (remember-me is forced on),
   so right-align the lone "Forgot password?" link. */
body.is-native .auth-remember-row {
    justify-content: flex-end;
}

@media (prefers-reduced-motion: reduce) {
    body.is-native .auth-btn,
    body.is-native .auth-input {
        transition: none;
    }
}

