/* ============================================================
   AUTH PAGES — login / register
   ============================================================ */
.auth-page { background: var(--clr-bg-alt); }

.auth-main {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  position: relative;
  overflow: hidden;
}

.auth-card {
  background: var(--clr-surface);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--clr-border-sub);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  padding: 40px 36px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 2;
}
.auth-card--wide { max-width: 600px; }

.auth-card__header {
  text-align: center;
  margin-bottom: 36px;
}
.auth-avatar {
  font-size: 2.4rem;
  color: var(--clr-accent);
  margin-bottom: 16px;
  display: block;
}
.auth-card__title {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.auth-card__sub {
  color: var(--clr-text-muted);
  font-size: .92rem;
}

/* Form fields */
.auth-form .form-group { margin-bottom: 20px; }
.auth-form .form-group label {
  display: flex;
  justify-content: space-between;
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: 7px;
}
.label-link {
  font-weight: 500;
  color: var(--clr-accent);
  font-size: .83rem;
}
.label-link:hover { text-decoration: underline; }

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap input,
.input-wrap textarea {
  width: 100%;
  padding: 12px 44px 12px 42px;
  border: 0.5px solid var(--clr-border-sub);
  border-radius: 8px;
  font-family: var(--font);
  font-size: .95rem;
  background: rgba(255,255,255,0.03);
  color: var(--clr-text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-wrap textarea {
  resize: vertical;
  min-height: 80px;
  padding-left: 16px;
}
.input-wrap input:focus,
.input-wrap textarea:focus {
  outline: none;
  border-color: rgba(255,215,0,0.3);
  box-shadow: 0 0 0 3px rgba(255,215,0,0.06);
  background: rgba(255,255,255,0.04);
}
.input-wrap input.error { border-color: #e74c3c; }

.input-icon {
  position: absolute;
  left: 13px;
  color: var(--clr-text-muted);
  display: flex;
  pointer-events: none;
}

.toggle-pw {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--clr-text-muted);
  padding: 4px;
  display: flex;
  cursor: pointer;
  transition: color var(--transition);
}
.toggle-pw:hover { color: var(--clr-text); }

/* Without icon (profile form) */
.profile-form .input-wrap input,
.profile-form .input-wrap textarea { padding-left: 14px; }

.field-error {
  display: none;
  color: #e74c3c;
  font-size: .8rem;
  margin-top: 5px;
}
.field-error.show { display: block; }

.auth-error {
  display: none;
  background: rgba(255,80,80,0.07);
  border: 0.5px solid rgba(255,80,80,0.3);
  color: rgba(255,100,100,0.9);
  padding: 11px 14px;
  border-radius: 8px;
  font-size: .88rem;
  margin-bottom: 18px;
}
.auth-error.show { display: block; }

/* Checkbox */
.form-check { margin-bottom: 22px; }
.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: .88rem;
  color: var(--clr-text);
  user-select: none;
}
.check-label input[type="checkbox"] { display: none; }
.check-box {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--clr-border);
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--clr-surface);
  position: relative;
  transition: all var(--transition);
}
.check-label input:checked + .check-box {
  background: var(--clr-accent);
  border-color: var(--clr-accent);
}
.check-label input:checked + .check-box::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 6px; height: 10px;
  border: 2px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}

/* Password strength */
.pw-strength { margin-bottom: 18px; }
.pw-strength__bar {
  height: 4px;
  background: var(--clr-border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}
.pw-strength__fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  transition: width .3s ease, background .3s ease;
}
.pw-strength__label {
  font-size: .78rem;
  color: var(--clr-text-muted);
  font-weight: 500;
}

/* Full-width btn */
.btn--full { width: 100%; justify-content: center; padding: 14px; }

/* Loader spinner inside button */
.btn-loader {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Switch link */
.auth-switch {
  text-align: center;
  font-size: .88rem;
  color: var(--clr-text-muted);
  margin-top: 24px;
}
.auth-switch__link {
  color: var(--clr-accent);
  font-weight: 600;
}
.auth-switch__link:hover { text-decoration: underline; }

/* Deco background shapes */
.auth-deco { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.deco-shape {
  position: absolute;
  border-radius: 50%;
  background: var(--clr-accent);
  opacity: .05;
}
.deco-shape--1 { width: 500px; height: 500px; top: -200px; right: -150px; }
.deco-shape--2 { width: 300px; height: 300px; bottom: -100px; left: -80px; }

/* ============================================================
   ACCOUNT PAGE
   ============================================================ */
.account-main { padding: 40px 0 80px; background: var(--clr-bg-alt); min-height: calc(100vh - 64px); overflow-x: hidden; }

.account-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  align-items: start;
}

/* Empêche les enfants de grille de déborder de leur colonne */
.account-sidebar,
.account-content { min-width: 0; }

/* Sidebar */
.account-sidebar {
  background: var(--clr-bg-alt);
  border-radius: var(--radius-lg);
  padding: 20px 0;
  border: 0.5px solid rgba(255,255,255,0.05);
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
}
.account-avatar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 18px;
  border-bottom: 0.5px solid rgba(255,255,255,0.05);
  margin-bottom: 14px;
}
.avatar-upload {
  position: relative;
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  border-radius: 50%;
}
.avatar-upload__cam {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 18px; height: 18px;
  background: var(--clr-accent-navy);
  color: #fff;
  border-radius: 50%;
  border: 1.5px solid var(--clr-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.avatar-upload:hover .avatar-upload__cam { opacity: 1; }
.avatar-circle {
  width: 50px; height: 50px;
  background: linear-gradient(135deg, rgba(255,215,0,0.18), rgba(26,95,168,0.25));
  border: 1.5px solid rgba(255,215,0,0.25);
  color: var(--clr-accent);
  font-weight: 600;
  font-size: 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-circle img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.avatar-name  { font-weight: 500; font-size: .9rem; }
.avatar-email { font-size: .75rem; color: rgba(255,255,255,0.3); margin-top: 2px; }

.account-nav { display: flex; flex-direction: column; gap: 1px; }
.account-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-radius: 0;
  border-left: 2px solid transparent;
  border-top: none; border-right: none; border-bottom: none;
  font-size: .85rem;
  font-weight: 400;
  color: rgba(255,255,255,0.45);
  background: none;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
  width: 100%;
}
.account-nav__item:hover { background: rgba(255,255,255,0.03); color: rgba(255,255,255,0.8); }
.account-nav__item.active { border-left-color: var(--clr-accent); background: rgba(255,215,0,0.05); color: var(--clr-accent); }
.account-nav__item--danger { color: rgba(255,80,80,0.5); margin-top: 8px; }
.account-nav__item--danger:hover { background: rgba(255,80,80,0.06); color: rgba(255,80,80,0.85); }
.account-nav__item--admin { color: var(--clr-accent-blue); border-left-color: rgba(91,163,232,0.4); background: rgba(91,163,232,0.05); margin-bottom: 4px; }
.account-nav__item--admin:hover { background: rgba(91,163,232,0.08); }

/* Content panels */
.account-content {
  background: var(--clr-bg);
  border-radius: var(--radius-lg);
  padding: 30px 32px;
  border: 0.5px solid rgba(255,255,255,0.04);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-title { font-size: 1.3rem; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 4px; }
.tab-sub { color: rgba(255,255,255,0.35); font-size: .88rem; margin-bottom: 24px; }

/* Dashboard stats */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.dash-stat {
  background: var(--clr-surface);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
  border: 0.5px solid var(--clr-border-sub);
  min-width: 0;
  overflow: hidden;
}
.dash-stat__icon { font-size: 1.6rem; display: block; margin-bottom: 8px; }
.dash-stat__num  { font-size: 1.6rem; font-weight: 600; color: var(--clr-accent); display: block; line-height: 1; margin-bottom: 4px; }
.dash-stat__label { font-size: .72rem; color: rgba(255,255,255,0.3); font-weight: 400; text-transform: uppercase; letter-spacing: .08em; }

.dash-card { border: 0.5px solid var(--clr-border-sub); border-radius: var(--radius); padding: 18px; background: var(--clr-surface); }
.dash-card__title { font-size: 1rem; font-weight: 600; margin-bottom: 20px; }

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state__icon { font-size: 3rem; display: block; margin-bottom: 12px; opacity: .5; }
.empty-state p { color: var(--clr-text-muted); font-size: .95rem; }

/* Orders filters */
.orders-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.filter-btn {
  padding: 7px 16px;
  border-radius: 100px;
  border: 1.5px solid var(--clr-border);
  background: none;
  font-size: .85rem;
  font-weight: 500;
  color: var(--clr-text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-btn:hover { border-color: var(--clr-accent); color: var(--clr-accent); }
.filter-btn.active { background: var(--clr-accent); border-color: var(--clr-accent); color: #fff; }

/* Profile form */
.profile-form .form-group { margin-bottom: 20px; }
.profile-form .form-group label { font-size: .88rem; font-weight: 600; display: block; margin-bottom: 7px; }
.profile-form .input-wrap input,
.profile-form .input-wrap textarea {
  padding: 11px 14px;
  border: 1.5px solid var(--clr-border);
  border-radius: 8px;
  font-family: var(--font);
  font-size: .95rem;
  width: 100%;
  background: var(--clr-surface);
  color: var(--clr-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
}
.profile-form .input-wrap input:focus,
.profile-form .input-wrap textarea:focus {
  outline: none;
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px rgba(255,215,0,0.06);
  background: var(--clr-surface);
}
.profile-form__actions { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.save-success { color: var(--clr-accent); font-weight: 600; font-size: .88rem; opacity: 0; transition: opacity .3s; }
.save-success.show { opacity: 1; }

/* Danger zone */
.danger-zone {
  margin-top: 40px;
  border: 0.5px solid rgba(255,80,80,0.25);
  border-radius: var(--radius);
  padding: 24px;
  background: rgba(255,80,80,0.04);
}
.danger-zone h3 { font-size: 1rem; font-weight: 700; color: rgba(255,80,80,0.8); margin-bottom: 8px; }
.danger-zone p { font-size: .88rem; color: rgba(255,255,255,0.4); margin-bottom: 16px; }
.btn--danger {
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.btn--danger:hover { background: #b91c1c; }

/* Account header link */
.account-link { color: var(--clr-accent) !important; }
.account-link.active { background: rgba(255,215,0,0.06) !important; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--clr-bg);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  max-height: 88vh;
  overflow-y: auto;
}
.modal h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 10px; }
.modal p  { color: var(--clr-text-muted); font-size: .92rem; margin-bottom: 28px; line-height: 1.6; }
.modal__actions { display: flex; gap: 12px; justify-content: flex-end; }

/* Grille favoris */
.fav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ── Tablette (≤ 860px) ──────────────────────────────────── */
@media (max-width: 860px) {
  /* Account layout : sidebar au dessus du contenu */
  .account-main { padding: 24px 0 60px; }
  .account-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .account-sidebar {
    position: static;
    padding: 20px;
  }
  .account-avatar { padding-bottom: 16px; margin-bottom: 16px; }

  /* Nav en grille 2 colonnes — même approche que dashboard-stats */
  .account-nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .account-nav__item {
    width: auto;
    min-width: 0;
    padding: 8px 10px;
    gap: 6px;
    font-size: .83rem;
    justify-content: center;
    text-align: center;
    white-space: normal;
  }
  .account-nav__item svg { display: none; }

  .account-content { padding: 28px 24px; }
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .dash-stat { padding: 18px 12px; }
}

/* ── Grand mobile (≤ 680px) ──────────────────────────────── */
@media (max-width: 680px) {
  /* Pages login / register */
  .auth-main { padding: 24px 16px; align-items: flex-start; padding-top: 32px; }
  .auth-card { padding: 28px 20px; border-radius: var(--radius); }
  .auth-card--wide { max-width: 100%; }
  .auth-card__title { font-size: 1.4rem; }
  .auth-card__sub   { font-size: .85rem; }
  .auth-avatar      { font-size: 2rem; margin-bottom: 10px; }

  /* Auth form */
  .auth-form .form-row { grid-template-columns: 1fr; }
  .input-wrap input    { font-size: .9rem; padding: 11px 40px 11px 38px; }

  /* Deco shapes hidden on mobile to save space */
  .auth-deco { display: none; }

  /* Account */
  .account-content  { padding: 20px 16px; }
  .tab-title        { font-size: 1.2rem; }
  .tab-sub          { font-size: .85rem; margin-bottom: 20px; }

  .dashboard-stats  { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .dash-stat        { padding: 14px 8px; }
  .dash-stat__icon  { font-size: 1.4rem; margin-bottom: 6px; }
  .dash-stat__num   { font-size: 1.3rem; }
  .dash-stat__label { font-size: .68rem; }

  .profile-form .form-row { grid-template-columns: 1fr; }

  /* Modal */
  .modal { padding: 28px 20px; }
  .modal__actions { flex-direction: column-reverse; }
  .modal__actions .btn { width: 100%; justify-content: center; }

  /* Danger zone */
  .danger-zone { padding: 18px; }
}

/* ── Mobile (≤ 480px) ────────────────────────────────────── */
@media (max-width: 480px) {
  .auth-main    { padding: 16px 12px; }
  .auth-card    { padding: 24px 16px; box-shadow: none; border: 1px solid var(--clr-border); }

  .account-main     { padding: 16px 0 48px; }
  .account-sidebar  { padding: 14px; }
  .account-content  { padding: 16px 14px; }

  /* Avatar compact */
  .account-avatar   { gap: 10px; padding-bottom: 12px; margin-bottom: 12px; }
  .avatar-circle    { width: 44px; height: 44px; font-size: .9rem; }
  .avatar-name      { font-size: .85rem; }
  .avatar-email     { font-size: .72rem; }

  /* Nav tabs compact */
  .account-nav { gap: 5px; }
  .account-nav__item { width: auto; padding: 7px 8px; font-size: .76rem; }

  .dashboard-stats  { grid-template-columns: 1fr 1fr; gap: 6px; }
  .dash-stat        { padding: 12px 6px; }
  .dash-stat__icon  { font-size: 1.3rem; margin-bottom: 4px; }
  .dash-stat__num   { font-size: 1.2rem; }

  .tab-sub          { margin-bottom: 16px; }
  .tab-title        { font-size: 1.1rem; }

  .orders-filters   { gap: 6px; }
  .filter-btn       { padding: 6px 12px; font-size: .78rem; }

  .profile-form__actions { flex-direction: column; align-items: flex-start; }
  .profile-form__actions .btn { width: 100%; justify-content: center; }

  /* Favoris : 1 colonne sur mobile */
  .fav-grid { grid-template-columns: 1fr; gap: 10px; }
}

/* ── Très petit mobile (≤ 380px) ─────────────────────────── */
@media (max-width: 380px) {
  .account-nav__item  { padding: 6px 6px; font-size: .71rem; }
  .account-content    { padding: 14px 12px; }
  .filter-btn         { padding: 5px 10px; font-size: .74rem; }
  .avatar-circle      { width: 38px; height: 38px; font-size: .82rem; }
  .fav-grid           { grid-template-columns: 1fr; gap: 8px; }
}
