/* ============================================================
   drawer.css — panneau latéral (drawer) remplaçant modal-dans-modal
   À fusionner dans style.css ou importer séparément.
   ============================================================ */

/* Overlay sombre derrière le drawer */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(4px);
  z-index: 80; /* sous le modal (z:90) */
  display: flex;
  justify-content: flex-end;
}

.drawer-overlay.hidden {
  display: none !important;
}

/* Panneau latéral droit */
.drawer-panel {
  width: min(520px, 92vw);
  height: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(246,250,247,.98));
  border-left: 1px solid rgba(217, 226, 236, 0.95);
  box-shadow: -24px 0 80px rgba(23, 33, 43, 0.14);
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-panel.drawer-open {
  transform: translateX(0);
}

.drawer-panel.hidden {
  display: none !important;
}

/* En-tête du drawer */
.drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid rgba(217, 226, 236, 0.9);
  background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(248,251,249,.96));
  backdrop-filter: blur(12px);
}

.drawer-header h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.5rem);
}

/* Corps scrollable */
.drawer-body {
  padding: 22px 24px 32px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Message drawer */
#drawerMessage {
  margin: 0 24px;
}

/* Quand le drawer est ouvert, bloquer le scroll du body */
body.drawer-active {
  overflow: hidden;
}

/* Section inline dans le drawer (remplace sous-modal) */
.drawer-section {
  border: 1px solid rgba(217, 226, 236, 0.8);
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  padding: 16px;
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.drawer-section-title {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--primary, #3f7b5d);
}

/* Panneau auth inline (remplace modal auth) */
.auth-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(246,250,247,.98));
  border-left: 1px solid rgba(217, 226, 236, 0.9);
  box-shadow: -20px 0 60px rgba(23, 33, 43, 0.12);
  z-index: 100;
  overflow-y: auto;
  padding: 28px 24px 32px;
  display: grid;
  gap: 20px;
  align-content: start;
}

.auth-panel.hidden {
  display: none !important;
}

.auth-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(217, 226, 236, 0.8);
}

.auth-form {
  margin-top: 0;
}

/* Responsive */
@media (max-width: 640px) {
  .drawer-panel {
    width: 100vw;
    border-left: none;
    border-top: 1px solid rgba(217, 226, 236, 0.9);
    border-radius: 20px 20px 0 0;
    height: 90vh;
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    transform: translateY(100%);
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .drawer-panel.drawer-open {
    transform: translateY(0);
  }

  .drawer-overlay {
    align-items: flex-end;
    justify-content: stretch;
  }
}
