/**
 * Parcours identité ACDC — styles de base (login, modale inscription, mot de passe oublié / réinitialisation)
 * puis overrides tokens marque (html[data-brand="acdc"]). Charger après les éventuels styles globaux du layout.
 */

/* --- Animations communes --- */
@keyframes auth-card-slide-up {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes auth-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes auth-register-modal-slide-up {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========== Login (deux colonnes) ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, #667eea 0%, #767ab6 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.login-container {
    flex: 1;
    max-width: 400px;
    margin: auto;
    padding: 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.logo-icon {
    font-size: 2rem;
}

.logo-text {
    font-size: 1.75rem;
    font-weight: 700;
    color: #3B82F6;
    margin: 0;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.5rem;
}

.login-subtitle {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
}

.flash-messages {
    margin-bottom: 1.5rem;
}

.flash-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.flash-message .flash-text {
    flex: 1;
    min-width: 0;
}

.flash-message .flash-close {
    flex-shrink: 0;
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem 0.45rem;
    line-height: 1;
    font-size: 1.25rem;
    opacity: 0.75;
    border-radius: 4px;
}

.flash-message .flash-close:hover {
    opacity: 1;
}

.flash-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.flash-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.flash-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.login-form-container {
    margin-bottom: 1.5rem;
}

.form-field {
    margin-bottom: 1.5rem;
}

.field-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.label-required {
    color: #ef4444;
}

/* Login : groupe champ en « barre » unique */
.login-page .input-group {
    display: flex;
    align-items: center;
    width: 100%;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-page .input-group:focus-within {
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.login-page .input-icon {
    flex-shrink: 0;
    padding: 0 0.75rem;
    color: #6b7280;
    font-size: 1rem;
    line-height: 1;
}

.login-page .field-input {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0;
    font-size: 1rem;
    background: transparent;
}

.login-page .field-input:focus {
    outline: none;
}

.login-page .password-toggle {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
}

.field-errors {
    margin-top: 0.5rem;
}

.error-text {
    display: block;
    color: #ef4444;
    font-size: 0.75rem;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #6b7280;
}

.checkbox-input {
    display: none;
}

.checkbox-custom {
    width: 1rem;
    height: 1rem;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s;
}

.checkbox-input:checked + .checkbox-custom {
    background: #3B82F6;
    border-color: #3B82F6;
}

.checkbox-input:checked + .checkbox-custom::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.75rem;
}

.forgot-link {
    color: #3B82F6;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.forgot-link:hover {
    color: #2563eb;
}

.login-button {
    width: 100%;
    background: #3B82F6;
    color: white;
    border: none;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.login-button:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.login-button:active {
    transform: translateY(0);
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
}

.footer-text {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0 0 1rem;
}

.footer-link {
    color: #3B82F6;
    text-decoration: none;
    font-weight: 500;
}

.footer-link:hover {
    color: #2563eb;
}

.help-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.help-link {
    color: #6b7280;
    text-decoration: none;
    font-size: 0.75rem;
    transition: color 0.2s;
}

.help-link:hover {
    color: #374151;
}

.info-section {
    flex: 1;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-title {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin: 0 0 1rem;
}

.info-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.125rem;
    line-height: 1.6;
    margin: 0 0 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.feature-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.feature-icon {
    font-size: 1.5rem;
}

.feature-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    margin: 0 0 0.25rem;
}

.feature-desc {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

@media (max-width: 768px) {
    .login-page {
        flex-direction: column;
    }

    .info-section {
        display: none;
    }

    .login-container {
        margin: 1rem;
        max-width: none;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }
}

/* Modal inscription (login) */
.register-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    animation: auth-fade-in 0.3s ease;
}

.register-modal-container {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.register-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    padding: 2rem;
    animation: auth-register-modal-slide-up 0.3s ease;
    position: relative;
}

.register-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.register-modal-header .logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.register-modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.register-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    transition: all 0.2s;
    border-radius: 4px;
}

.register-modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.register-form {
    margin-top: 1rem;
}

.register-modal .input-group {
    display: flex;
    align-items: center;
    width: 100%;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.register-modal .input-group:focus-within {
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.register-modal .input-icon {
    flex-shrink: 0;
    padding: 0 0.75rem;
    color: #6b7280;
    font-size: 1rem;
    line-height: 1;
}

.register-modal .field-input {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0;
    font-size: 1rem;
    background: transparent;
}

.register-modal .field-input:focus {
    outline: none;
}

.register-modal .password-toggle {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
}

.register-button {
    width: 100%;
    background: #3B82F6;
    color: white;
    border: none;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.register-button:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.register-button:active {
    transform: translateY(0);
}

.register-modal-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.register-modal-container::-webkit-scrollbar {
    width: 8px;
}

.register-modal-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.register-modal-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.register-modal-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

@media (max-width: 768px) {
    .register-modal {
        padding: 1.5rem;
    }

    .register-modal-container {
        max-height: 95vh;
    }
}

/* ========== Mot de passe oublié + inscription page + réinitialisation (carte centrée) ========== */
.forgot-password-page,
.reset-password-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding: 2rem;
}

.forgot-password-container,
.reset-password-container {
    width: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
    animation: auth-card-slide-up 0.3s ease;
}

.forgot-password-container {
    max-width: 450px;
}

.forgot-password-container.wide {
    max-width: 520px;
}

.reset-password-container {
    max-width: 500px;
}

.forgot-password-header,
.reset-password-header {
    text-align: center;
    margin-bottom: 2rem;
}

.forgot-password-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.5rem;
}

.forgot-password-subtitle {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.5;
}

.reset-password-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.5rem;
}

.reset-password-subtitle {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.5;
}

.forgot-password-form-container,
.reset-password-form-container {
    margin-bottom: 1.5rem;
}

.forgot-password-page .input-group,
.reset-password-page .input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.forgot-password-page .input-icon,
.reset-password-page .input-icon {
    position: absolute;
    left: 0.75rem;
    z-index: 1;
    color: #6b7280;
    font-size: 1rem;
}

.forgot-password-page .field-input,
.reset-password-page .field-input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    background: white;
}

.forgot-password-page .field-input:focus,
.reset-password-page .field-input:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.reset-password-page .password-toggle {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    font-size: 1rem;
    padding: 0.25rem;
}

.forgot-password-page .submit-button,
.reset-password-page .submit-button {
    width: 100%;
    background: #3B82F6;
    color: white;
    border: none;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.forgot-password-page .submit-button:hover,
.reset-password-page .submit-button:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.forgot-password-page .submit-button:active,
.reset-password-page .submit-button:active {
    transform: translateY(0);
}

.forgot-password-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.forgot-password-footer .footer-text {
    margin: 0;
}

.forgot-password-footer .footer-link {
    margin-left: 0.25rem;
}

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

.reset-password-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.reset-password-footer .footer-text {
    margin: 0;
}

.reset-password-footer .footer-link {
    margin-left: 0.25rem;
}

.reset-password-footer .footer-link:hover {
    text-decoration: underline;
}

.password-requirements {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid #3B82F6;
}

.requirements-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.5rem;
}

.requirements-list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.6;
}

.requirements-list li {
    margin-bottom: 0.25rem;
}

@media (max-width: 768px) {
    .forgot-password-page,
    .reset-password-page {
        padding: 1rem;
    }

    .forgot-password-container,
    .reset-password-container {
        padding: 1.5rem;
    }
}

html[data-brand="acdc"]).
 * Chargé après les styles legacy des pages login / mot de passe / inscription pour override.
 */

html[data-brand="acdc"] .login-page,
html[data-brand="acdc"] .forgot-password-page,
html[data-brand="acdc"] .reset-password-page {
  background: var(--acdc-gradient-primary);
  font-family: var(--acdc-font-paragraph);
}

html[data-brand="acdc"] .login-container,
html[data-brand="acdc"] .forgot-password-container,
html[data-brand="acdc"] .reset-password-container {
  background: var(--acdc-surface);
  border-radius: var(--acdc-radius-lg);
  box-shadow: var(--acdc-shadow-md);
  border: 1px solid var(--acdc-border);
}

html[data-brand="acdc"] .logo-text {
  color: var(--acdc-bleu-democratique);
}

html[data-brand="acdc"] .login-title,
html[data-brand="acdc"] .forgot-password-title,
html[data-brand="acdc"] .reset-password-title {
  color: var(--acdc-text);
  font-family: var(--acdc-font-title);
}

html[data-brand="acdc"] .login-subtitle,
html[data-brand="acdc"] .forgot-password-subtitle,
html[data-brand="acdc"] .reset-password-subtitle {
  color: var(--acdc-text-muted);
}

/* Champs */
html[data-brand="acdc"] .field-input {
  border-color: var(--acdc-border-strong);
  color: var(--acdc-text);
}

html[data-brand="acdc"] .field-input:focus {
  border-color: var(--acdc-bleu-democratique);
  box-shadow: var(--acdc-ring);
}

html[data-brand="acdc"] .login-page .field-input:focus-visible,
html[data-brand="acdc"] .forgot-password-page .field-input:focus-visible,
html[data-brand="acdc"] .reset-password-page .field-input:focus-visible,
html[data-brand="acdc"] .login-page .login-button:focus-visible,
html[data-brand="acdc"] .login-page .register-button:focus-visible,
html[data-brand="acdc"] .forgot-password-page .submit-button:focus-visible,
html[data-brand="acdc"] .reset-password-page .submit-button:focus-visible {
  outline: 3px solid var(--acdc-bleu-democratique);
  outline-offset: 2px;
}

html[data-brand="acdc"] .login-button,
html[data-brand="acdc"] .submit-button,
html[data-brand="acdc"] .register-button {
  background: var(--acdc-gradient-primary);
  color: var(--acdc-blanc-pur);
}

html[data-brand="acdc"] .login-button:hover,
html[data-brand="acdc"] .submit-button:hover,
html[data-brand="acdc"] .register-button:hover {
  filter: brightness(1.05);
}

/* Flash — lisibilité sur surface ACDC */
html[data-brand="acdc"] .flash-message.flash-success {
  background: color-mix(in srgb, var(--acdc-vert-citoyen) 16%, var(--acdc-surface));
  color: var(--acdc-bleu-minuit);
  border: 1px solid color-mix(in srgb, var(--acdc-vert-citoyen) 40%, transparent);
}

html[data-brand="acdc"] .flash-message.flash-error {
  background: color-mix(in srgb, var(--acdc-rouge-action) 12%, var(--acdc-surface));
  color: var(--acdc-rouge-action-dark);
  border: 1px solid color-mix(in srgb, var(--acdc-rouge-action) 35%, transparent);
}

html[data-brand="acdc"] .flash-message.flash-warning {
  background: color-mix(in srgb, var(--acdc-or-civique) 18%, var(--acdc-surface));
  color: var(--acdc-bleu-minuit);
  border: 1px solid color-mix(in srgb, var(--acdc-or-civique) 45%, transparent);
}

html[data-brand="acdc"] .flash-message.flash-info {
  background: color-mix(in srgb, var(--acdc-bleu-democratique) 12%, var(--acdc-surface));
  color: var(--acdc-bleu-minuit);
  border: 1px solid color-mix(in srgb, var(--acdc-bleu-democratique) 30%, transparent);
}

/* Liens footer auth */
html[data-brand="acdc"] .footer-link,
html[data-brand="acdc"] .forgot-link {
  color: var(--acdc-bleu-democratique);
}

/* Hub « Mon compte » */
.acdc-account-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  padding: 0 1rem 2.5rem;
  max-width: 960px;
  margin: 0 auto;
}

a.acdc-account-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 1.35rem;
  background: var(--acdc-surface, #fff);
  border: 1px solid var(--acdc-border, rgba(15, 26, 46, 0.12));
  border-radius: var(--acdc-radius-md, 14px);
  box-shadow: var(--acdc-shadow-sm, 0 6px 18px rgba(15, 26, 46, 0.08));
  text-decoration: none;
  color: var(--acdc-text, #0f1a2e);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.acdc-account-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--acdc-shadow-md, 0 10px 30px rgba(15, 26, 46, 0.12));
}

a.acdc-account-card:focus-visible {
  outline: 3px solid var(--acdc-bleu-democratique, #2243a2);
  outline-offset: 2px;
}

.acdc-account-card-title {
  font-family: var(--acdc-font-title, Montserrat, sans-serif);
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.acdc-account-card-desc {
  margin: 0;
  font-size: 0.875rem;
  color: var(--acdc-text-muted, rgba(15, 26, 46, 0.72));
  line-height: 1.45;
}

.acdc-account-card-muted {
  opacity: 0.85;
  border-style: dashed;
}

/* Parcours compte : cibles tactiles + pied de page support (config CONTACT / SUPPORT) */
html[data-brand="acdc"] .login-footer .help-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 0.5rem;
  box-sizing: border-box;
}

html[data-brand="acdc"] .login-button,
html[data-brand="acdc"] .submit-button,
html[data-brand="acdc"] .register-button {
  min-height: 44px;
}

.acdc-account-support {
  max-width: 960px;
  margin: 0 auto 2rem;
  padding: 0 1rem;
  text-align: center;
}

.acdc-account-support-text {
  margin: 0;
  font-size: 0.875rem;
  color: var(--acdc-text-muted, rgba(15, 26, 46, 0.72));
}

.acdc-account-support-link {
  color: var(--acdc-bleu-democratique, #2243a2);
  font-weight: 600;
}

.acdc-account-support-link:focus-visible {
  outline: 3px solid var(--acdc-bleu-democratique, #2243a2);
  outline-offset: 2px;
  border-radius: 4px;
}
