/**
 * CSS — Pages d'authentification AEEPS Auth
 *
 * Design system "Clarté par le vide"
 * Standalone — pas de dépendance au thème WP
 */

/* ─── Reset & Base ─────────────────────────────────────────── */

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

html {
    font-size: 16px !important;
    -webkit-text-size-adjust: 100%;
}

body.aeeps-auth-page {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f6f3f2;
    color: #1b1c1c;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Tokens ───────────────────────────────────────────────── */

:root {
    --aeeps-primary: #4d6700;
    --aeeps-primary-hover: #3d5200;
    --aeeps-primary-container: #87ac2b;
    --aeeps-secondary-container: #d5e7a7;
    --aeeps-surface: #fcf9f8;
    --aeeps-surface-container-low: #f6f3f2;
    --aeeps-surface-container: #f0eded;
    --aeeps-surface-container-high: #eae7e7;
    --aeeps-on-surface: #1b1c1c;
    --aeeps-on-surface-variant: #46483d;
    --aeeps-outline: #757966;
    --aeeps-outline-variant: #c5c8b8;
    --aeeps-error: #ba1a1a;
    --aeeps-error-container: #ffdad6;
    --aeeps-info: #0061a4;
    --aeeps-info-container: #d1e4ff;
    --aeeps-success: #2e6b2e;
    --aeeps-success-container: #c8f0c8;

    --aeeps-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --aeeps-radius-sm: 6px;
    --aeeps-radius-md: 8px;
    --aeeps-radius-lg: 12px;
    --aeeps-radius-xl: 16px;
    --aeeps-shadow: 0px 10px 40px rgba(27, 28, 28, 0.06);
    --aeeps-shadow-lg: 0px 20px 60px rgba(27, 28, 28, 0.1);
}

/* ─── Container ────────────────────────────────────────────── */

.aeeps-auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* ─── Card ─────────────────────────────────────────────────── */

.aeeps-auth-card {
    background: var(--aeeps-surface);
    border-radius: var(--aeeps-radius-xl);
    box-shadow: var(--aeeps-shadow-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
}

.aeeps-auth-card--wide {
    max-width: 560px;
}

/* ─── Logo ─────────────────────────────────────────────────── */

.aeeps-auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.aeeps-auth-logo-mark {
    font-size: 28px;
    font-weight: 800;
    color: var(--aeeps-primary);
    letter-spacing: -0.5px;
}

.aeeps-auth-logo-sub {
    font-size: 12px;
    color: var(--aeeps-outline);
    margin-top: 4px;
    letter-spacing: 0.2px;
}

/* ─── Title ────────────────────────────────────────────────── */

.aeeps-auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--aeeps-on-surface);
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.aeeps-auth-subtitle {
    font-size: 0.875rem;
    color: var(--aeeps-on-surface-variant);
    text-align: center;
    margin-bottom: 28px;
    line-height: 1.5;
}

/* ─── Section title ────────────────────────────────────────── */

.aeeps-auth-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--aeeps-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 24px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--aeeps-secondary-container);
}

.aeeps-auth-section-title .aeeps-auth-optional {
    font-weight: 400;
    text-transform: none;
    color: var(--aeeps-outline);
    font-size: 0.75rem;
}

/* ─── Form ─────────────────────────────────────────────────── */

.aeeps-auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.aeeps-auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.aeeps-auth-field label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--aeeps-on-surface);
}

.aeeps-auth-field label .required {
    color: var(--aeeps-error);
}

/* ─── Input ────────────────────────────────────────────────── */

.aeeps-auth-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--aeeps-surface-container-low);
    border-radius: var(--aeeps-radius-md);
    padding: 0 14px;
    transition: background 0.2s, box-shadow 0.2s;
    border: 1.5px solid transparent;
}

.aeeps-auth-input-wrap:focus-within {
    background: var(--aeeps-surface);
    border-color: var(--aeeps-primary-container);
    box-shadow: 0 0 0 3px rgba(135, 172, 43, 0.15);
}

.aeeps-auth-input-wrap .material-symbols-outlined {
    font-size: 20px;
    color: var(--aeeps-outline);
    flex-shrink: 0;
}

.aeeps-auth-input-wrap input,
.aeeps-auth-input-wrap select {
    flex: 1;
    border: none;
    background: transparent;
    padding: 13px 0;
    font-size: 0.9375rem;
    font-family: var(--aeeps-font);
    color: var(--aeeps-on-surface);
    outline: none;
    width: 100%;
}

.aeeps-auth-input-wrap select {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.aeeps-auth-input-wrap input::placeholder {
    color: var(--aeeps-outline-variant);
}

/* ─── Toggle password ──────────────────────────────────────── */

.aeeps-auth-toggle-password {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--aeeps-outline);
    display: flex;
    align-items: center;
}

.aeeps-auth-toggle-password:hover {
    color: var(--aeeps-on-surface-variant);
}

/* ─── Password strength ───────────────────────────────────── */

.aeeps-auth-password-strength {
    height: 3px;
    border-radius: 2px;
    background: var(--aeeps-surface-container);
    overflow: hidden;
    transition: opacity 0.3s;
}

.aeeps-auth-password-strength::after {
    content: '';
    display: block;
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.3s, background-color 0.3s;
}

.aeeps-auth-password-strength[data-strength="1"]::after { width: 25%; background: var(--aeeps-error); }
.aeeps-auth-password-strength[data-strength="2"]::after { width: 50%; background: #e68a00; }
.aeeps-auth-password-strength[data-strength="3"]::after { width: 75%; background: #c4a600; }
.aeeps-auth-password-strength[data-strength="4"]::after { width: 100%; background: var(--aeeps-success); }

/* ─── Row ──────────────────────────────────────────────────── */

.aeeps-auth-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.aeeps-auth-row-fields {
    display: flex;
    gap: 12px;
}

.aeeps-auth-field--small { flex: 0 0 140px; }
.aeeps-auth-field--large { flex: 1; }

/* ─── Checkbox ─────────────────────────────────────────────── */

.aeeps-auth-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--aeeps-on-surface-variant);
    cursor: pointer;
}

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

/* ─── Link ─────────────────────────────────────────────────── */

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

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

/* ─── Button ───────────────────────────────────────────────── */

.aeeps-auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    border-radius: var(--aeeps-radius-md);
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--aeeps-font);
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1;
}

.aeeps-auth-btn--primary {
    background: linear-gradient(135deg, var(--aeeps-primary) 0%, #5a7a00 100%);
    color: #ffffff;
    margin-top: 8px;
}

.aeeps-auth-btn--primary:hover {
    background: linear-gradient(135deg, var(--aeeps-primary-hover) 0%, var(--aeeps-primary) 100%);
    box-shadow: 0 4px 16px rgba(77, 103, 0, 0.3);
    transform: translateY(-1px);
}

.aeeps-auth-btn--primary:active {
    transform: translateY(0);
    box-shadow: none;
}

.aeeps-auth-btn--primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.aeeps-auth-btn--secondary {
    background: var(--aeeps-surface-container);
    color: var(--aeeps-on-surface);
}

.aeeps-auth-btn--secondary:hover {
    background: var(--aeeps-surface-container-high);
}

.aeeps-auth-btn--oauth {
    background: var(--aeeps-surface);
    color: var(--aeeps-on-surface);
    border: 1.5px solid var(--aeeps-outline-variant);
    font-weight: 500;
}

.aeeps-auth-btn--oauth:hover {
    background: var(--aeeps-surface-container-low);
    border-color: var(--aeeps-outline);
}

.aeeps-auth-btn--oauth svg {
    flex-shrink: 0;
}

.aeeps-auth-btn-loader { display: flex; align-items: center; }

/* ─── Divider ──────────────────────────────────────────────── */

.aeeps-auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
    color: var(--aeeps-outline);
    font-size: 0.8125rem;
}

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

/* ─── Messages ─────────────────────────────────────────────── */

.aeeps-auth-messages {
    margin-bottom: 8px;
}

.aeeps-auth-messages:empty {
    display: none;
}

.aeeps-auth-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--aeeps-radius-md);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 8px;
}

.aeeps-auth-message .material-symbols-outlined {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.aeeps-auth-message--error {
    background: var(--aeeps-error-container);
    color: var(--aeeps-error);
}

.aeeps-auth-message--success {
    background: var(--aeeps-success-container);
    color: var(--aeeps-success);
}

.aeeps-auth-message--info {
    background: var(--aeeps-info-container);
    color: var(--aeeps-info);
}

/* ─── Footer link ──────────────────────────────────────────── */

.aeeps-auth-footer-link {
    text-align: center;
    margin-top: 24px;
    font-size: 0.875rem;
    color: var(--aeeps-on-surface-variant);
}

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

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

/* ─── Page footer ──────────────────────────────────────────── */

.aeeps-auth-page-footer {
    text-align: center;
    margin-top: 32px;
    font-size: 0.75rem;
    color: var(--aeeps-outline);
}

/* ─── Icon large ───────────────────────────────────────────── */

.aeeps-auth-icon-large {
    text-align: center;
    margin-bottom: 16px;
}

.aeeps-auth-icon-large .material-symbols-outlined {
    font-size: 56px;
    color: var(--aeeps-primary-container);
}

.aeeps-auth-icon-large--error .material-symbols-outlined {
    color: var(--aeeps-error);
}

/* ─── Spinner ──────────────────────────────────────────────── */

.aeeps-spin {
    animation: aeeps-spin 1s linear infinite;
}

@keyframes aeeps-spin {
    to { transform: rotate(360deg); }
}

/* ─── Responsive ───────────────────────────────────────────── */

@media (max-width: 600px) {
    .aeeps-auth-container {
        padding: 24px 16px;
    }

    .aeeps-auth-card {
        padding: 32px 24px;
    }

    .aeeps-auth-row-fields {
        flex-direction: column;
    }

    .aeeps-auth-field--small {
        flex: 1;
    }

    .aeeps-auth-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ─── WP Admin Bar ─────────────────────────────────────────── */

html.wp-toolbar body.aeeps-auth-page {
    padding-top: 32px;
}

@media (max-width: 782px) {
    html.wp-toolbar body.aeeps-auth-page {
        padding-top: 46px;
    }
}
