/**
 * Authentication Modal Component - Mobile-First Responsive
 * La Fille du Fleuriste
 */

/* ===== Auth Overlay ===== */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  display: none;
  z-index: var(--z-notification);
  transition: opacity var(--transition-slow) ease;
  opacity: 0;
}

.auth-overlay.show {
  display: block;
  opacity: 1;
}

/* ===== Auth Modal ===== */
.auth-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  opacity: 0;
  display: none;
  z-index: calc(var(--z-notification) + 100);
  transition: all var(--transition-slow) cubic-bezier(0.25, 0.8, 0.25, 1);
  max-width: 520px;
  width: calc(100% - 2 * var(--space-md));
  max-height: calc(100vh - 2 * var(--space-md));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.auth-modal.show {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ===== Modal Content ===== */
.auth-modal-content {
  background: #fdfcfa;
  border-radius: 12px;
  padding: 28px 28px 24px;
  position: relative;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

/* Close Button */
.auth-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  color: rgba(178, 138, 131, 0.5);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-base);
  line-height: 1;
  padding: 0;
}

.auth-close:hover {
  color: #B28A83;
}

/* ===== Auth Header ===== */
.auth-header {
  text-align: center;
  margin-bottom: 16px;
}

.auth-header h1 {
  font-family: var(--font-display);
  font-size: 22px;
  color: #B28A83;
  margin-bottom: 6px;
  font-style: italic;
  font-weight: 700;
}

.auth-header p {
  color: rgba(178, 138, 131, 0.6);
  font-size: 12px;
  margin: 0;
}

/* ===== Auth Tabs ===== */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(194, 196, 182, 0.4);
}

.auth-tab {
  flex: 1;
  padding: 10px var(--space-md);
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 13px;
  color: rgba(178, 138, 131, 0.5);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  min-height: auto;
}

.auth-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: #C2B254;
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

.auth-tab.active {
  color: #B28A83;
  font-weight: 600;
}

.auth-tab.active::after {
  transform: scaleX(1);
}

.auth-tab:hover {
  color: #B28A83;
}

/* ===== Auth Forms ===== */
.auth-form-container {
  position: relative;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: fadeIn var(--transition-base) ease;
}

.auth-form h2 {
  margin-bottom: var(--space-md);
  color: var(--color-primary);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-style: italic;
  text-align: center;
  font-weight: var(--font-semibold);
}

.auth-form input,
.auth-form select,
.auth-form .form-group input,
.auth-form .form-group select {
  width: 100%;
  padding: 5px 0;
  margin-bottom: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(194, 196, 182, 0.6);
  border-radius: 0;
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.4;
  color: #6C6A5D;
  outline: none;
  transition: border-bottom-color 0.2s;
  box-sizing: border-box;
  min-height: auto;
  -webkit-appearance: none;
  appearance: none;
}

.auth-form input::placeholder {
  color: rgba(178, 138, 131, 0.4);
  opacity: 1;
}

.auth-form input:focus,
.auth-form select:focus,
.auth-form .form-group input:focus,
.auth-form .form-group select:focus {
  border-bottom-color: #C2B254;
  box-shadow: none;
  outline: none;
}

.auth-form input:hover:not(:focus),
.auth-form select:hover:not(:focus),
.auth-form .form-group input:hover:not(:focus),
.auth-form .form-group select:hover:not(:focus) {
  border-bottom-color: rgba(194, 196, 182, 0.9);
}

.auth-form input.error,
.auth-form select.error,
.auth-form .form-group input.error,
.auth-form .form-group select.error {
  border-bottom-color: var(--color-error);
}

.password-toggle-wrap {
  position: relative;
}

.password-toggle-wrap input {
  padding-right: 28px;
}

.password-toggle-btn {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-light);
  padding: 0;
}

.password-toggle-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-toggle-btn:hover {
  color: var(--color-primary);
}

.auth-submit-btn {
  width: 100%;
  padding: 8px var(--space-md);
  min-height: auto;
  background: transparent;
  color: #C2B254;
  border: 1px solid #C2B254;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  margin-top: 16px;
  box-shadow: none;
  letter-spacing: 0.04em;
}

.auth-submit-btn:hover {
  background: #C2B254;
  color: #fff;
  transform: none;
  box-shadow: none;
}

.auth-submit-btn:active {
  background: #b0a147;
  color: #fff;
}

.auth-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: transparent;
  color: #C2B254;
}

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

/* ===== Form Groups ===== */
.form-group {
  margin-bottom: 10px;
}

/* Auth forms : espacement aéré type "contact" + inputs compacts */
.auth-form .form-group {
  margin-bottom: 14px;
}

.auth-form .form-group label,
.auth-form label {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  color: rgba(178, 138, 131, 0.7);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Hérite du style underline défini sur .auth-form input / select — pas de redéfinition box */
.auth-form .form-group input,
.auth-form .form-group select {
  /* styles hérités de .auth-form input / .auth-form select */
}


.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Error Message */
.error-message {
  display: none;
  color: var(--color-error);
  font-size: var(--text-xs);
  margin-top: var(--space-xs);
}

.error-message.show {
  display: block;
}

/* Form Actions */
.form-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

/* Submit Button */

/* Forgot Password Link */
.forgot-password {
  text-align: center;
  margin-top: 6px;
  margin-bottom: 10px;
}

.forgot-password a,
.forgot-password button {
  color: var(--color-primary);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color var(--transition-base);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.forgot-password a:hover,
.forgot-password button:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

.password-criteria {
  margin-top: 2px;
  margin-bottom: 6px;
  padding: 4px 6px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: #fcfaf7;
}

.password-criteria-title {
  font-size: 9px;
  color: var(--color-text-light);
  margin-bottom: 2px;
}

.password-criteria ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
}

.password-criteria li {
  font-size: 9px;
  color: #8c8c8c;
  line-height: 1.2;
}

.password-criteria li::before {
  content: "○ ";
}

.password-criteria li.valid {
  color: #2e7d32;
}

.password-criteria li.valid::before {
  content: "✓ ";
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: var(--space-xl) 0;
  color: var(--color-text-light);
  font-size: var(--text-sm);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--color-border);
}

.auth-divider span {
  padding: 0 var(--space-md);
}

/* ===== Auth Message (confirmation, erreur, info) ===== */
.auth-message {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  margin-top: 10px;
  text-align: center;
  border: 1px solid transparent;
}

.auth-message.success {
  background: #edf7ed;
  color: #2e7d32;
  border-color: #a5d6a7;
}

.auth-message.error {
  background: #fdecea;
  color: #c62828;
  border-color: #ef9a9a;
}

.auth-message.info {
  background: #e8f4fd;
  color: #1565c0;
  border-color: #90caf9;
}

/* ===== Success Message ===== */

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

/* ===== Auth Page Overrides (for modal) ===== */
.auth-modal .auth-page {
  min-height: auto;
  padding: 0;
  background: transparent;
}

.auth-modal .auth-container {
  box-shadow: none;
  padding: 0;
  max-width: 100%;
}

/* ===== Tablet (768px+) ===== */
@media (min-width: 768px) {
  .auth-modal {
    width: 90%;
  }

  .auth-modal-content {
    padding: 32px 32px 28px;
    border-radius: 14px;
  }

  .auth-header h1 {
    font-size: 24px;
  }
}

/* ===== Desktop (1024px+) ===== */
@media (min-width: 1024px) {
  .auth-modal-content {
    padding: 32px 32px 28px;
    border-radius: 14px;
  }
}

/* ===== Mobile (480px and below) — touch-friendly ===== */
@media (max-width: 480px) {
  .auth-modal {
    width: calc(100% - 2 * var(--space-sm));
  }

  .auth-modal-content {
    padding: 24px 20px 20px;
    border-radius: 10px;
  }

  .auth-close {
    top: 12px;
    right: 14px;
  }

  .auth-header h1 {
    font-size: 20px;
  }

  /* Inputs compacts sur mobile */
  .auth-form input,
  .auth-form select,
  .auth-form .form-group input,
  .auth-form .form-group select {
    font-size: 16px; /* évite le zoom auto sur iOS */
    padding: 5px 0;
    min-height: auto;
  }

  .auth-form .form-group {
    margin-bottom: 10px;
  }

  .auth-form .form-group label,
  .auth-form label {
    font-size: 10px;
  }

  .auth-submit-btn {
    font-size: 13px;
    padding: 9px var(--space-md);
    margin-top: 12px;
  }
}

/* ===== Signup Success Animation ===== */
.signup-success-overlay {
  text-align: center;
  padding: 20px 0 12px;
  animation: fadeIn 0.3s ease-out both;
}

.signup-success-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
}

.signup-success-icon svg {
  width: 100%;
  height: 100%;
}

.success-circle {
  stroke-dasharray: 214;
  stroke-dashoffset: 214;
  animation: successCircleDraw 0.7s ease-out 0.1s forwards;
}

.success-check {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: successCheckDraw 0.4s ease-out 0.75s forwards;
}

@keyframes successCircleDraw {
  to { stroke-dashoffset: 0; }
}

@keyframes successCheckDraw {
  to { stroke-dashoffset: 0; }
}

.signup-success-text {
  font-size: 13px;
  color: #4a6741;
  line-height: 1.55;
  max-width: 260px;
  margin: 0 auto;
  opacity: 0;
  animation: fadeInUp 0.4s ease-out 0.9s forwards;
}

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

/* ===== Prevent Body Scroll ===== */
body.modal-open {
  overflow: hidden;
  height: 100vh;
}
