/* OhDeere Auth — Design System
   Aligned with ohdeere-app theme (MUI-inspired)
   Font: Geologica · Radius: 14px · Palette: forest green + gold */

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

/* ── Design tokens ── */
:root {
    /* Set by Thymeleaf per tenant — fallback to OhDeere */
    --primary: #1a3a2a;
    --primary-light: #2a5a3a;
    --primary-dark: #0a1a0a;
    --secondary: #d4920a;
    --secondary-light: #f0b942;

    /* Neutrals */
    --bg-default: #f5f7f4;
    --bg-paper: #ffffff;
    --divider: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    /* Semantic */
    --error: #dc2626;
    --error-light: #fef2f2;
    --error-border: #fecaca;
    --success: #059669;

    /* Shape */
    --radius: 14px;
    --radius-sm: 8px;

    /* Shadows (MUI-inspired) */
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 4px 12px rgba(26, 58, 42, 0.15);
    --shadow-input-focus: 0 0 0 3px rgba(26, 58, 42, 0.1);

    /* Transitions */
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Typography ── */
body {
    font-family: 'Geologica', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Page layout ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-default);
    padding: 1.5rem;
}

/* ── Card ── */
.auth-card {
    background: var(--bg-paper);
    border-radius: var(--radius);
    border: 1px solid var(--divider);
    box-shadow: var(--shadow-card);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    animation: fadeIn 0.4s ease-out;
}

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

/* ── Logo / Brand ── */
.auth-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-brand-name {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.auth-brand-tagline {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-weight: 400;
}

/* ── Headings ── */
.auth-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1.75rem;
    line-height: 1.5;
}

/* ── Form ── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Input group (label + input) ── */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.input-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--divider);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-paper);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-field::placeholder {
    color: var(--text-muted);
}

.input-field:hover {
    border-color: var(--text-muted);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-input-focus);
}

/* OTP code input — monospace, large, centered */
.input-field--otp {
    font-size: 1.75rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.5em;
    padding: 0.875rem 1rem;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: none;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: -0.25rem 0 0.25rem;
    font-size: 0.9rem;
    color: var(--text-muted, #666);
    cursor: pointer;
    user-select: none;
}

.remember-me input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-light);
    box-shadow: var(--shadow-hover);
}

.btn-primary:active {
    background: var(--primary-dark);
    box-shadow: none;
}

.btn-outlined {
    background: var(--bg-paper);
    color: var(--text-primary);
    border: 1.5px solid var(--divider);
}

.btn-outlined:hover {
    background: var(--bg-default);
    border-color: var(--text-muted);
}

.btn-outlined[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--bg-paper);
    border-color: var(--divider);
}

.btn-outlined[disabled]:hover {
    background: var(--bg-paper);
    border-color: var(--divider);
}

/* Icon inside button */
.btn-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
}

/* ── Divider ── */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.auth-divider::before { margin-right: 0.75rem; }
.auth-divider::after { margin-left: 0.75rem; }

/* ── Social / federated login buttons ── */
.auth-social {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

/* ── Alert / Error ── */
.auth-alert {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
}

/* `display: flex` above wins over the browser's default
   `[hidden] { display: none }` due to specificity. Re-assert here so
   the JS can hide the alert by toggling the attribute. */
.auth-alert[hidden] {
    display: none;
}

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

.auth-alert-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* ── Links ── */
.auth-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition);
}

.auth-link:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

.auth-link__icon {
    opacity: 0.7;
}

.btn--submitting {
    opacity: 0.65;
    cursor: progress;
}

.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
}

/* ── Email highlight ── */
.email-highlight {
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .auth-card {
        padding: 2rem 1.5rem;
        border: none;
        border-radius: var(--radius);
    }

    .auth-brand-name {
        font-size: 1.5rem;
    }

    .input-field--otp {
        font-size: 1.5rem;
        letter-spacing: 0.4em;
    }
}
