/* ============================================================
   KBMB UX – Style global (front)
   Palette :
   - Bleu principal : #2c3e50
   - Or : #d4af37
   - Fond doux : #fffaf3
   ============================================================ */

:root {
  --kb-color-primary: #2c3e50;
  --kb-color-accent:  #d4af37;
  --kb-color-text:    #1f2933;
  --kb-color-muted:   #6b7280;
  --kb-bg-soft:       #fffaf3;
  --kb-border-soft:   rgba(0,0,0,0.06);
  --kb-shadow-soft:   0 24px 60px rgba(15,23,42,0.16);
}

/* ====== WRAPPER GÉNÉRIQUE ====== */

.kb-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
  box-sizing: border-box;
}

/* ====== CARDS (liquid glass) ====== */

.kb-card {
  position: relative;
  border-radius: 26px;
  padding: 24px 24px 28px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.96), rgba(255,247,230,0.96));
  box-shadow: var(--kb-shadow-soft);
  border: 1px solid rgba(255,255,255,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Petites cartes (boutons "Mettre à jour" etc.) */
.kb-chip-card {
  border-radius: 999px;
  padding: 8px 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.95), rgba(249,250,251,0.95));
  box-shadow: 0 10px 25px rgba(15,23,42,0.16);
}

/* ====== TEXTE GÉNÉRAL ====== */

.kb-card h2,
.kb-card h3,
.kb-card h4 {
  margin: 0 0 18px;
  font-weight: 600;
  color: var(--kb-color-primary);
}

.kb-muted {
  font-size: 13px;
  color: var(--kb-color-muted);
}

/* ====== GRILLE / COLONNES ====== */

.kb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.kb-col {
  flex: 1 1 0;
  min-width: 260px;
}

/* ====== FORMULAIRES ====== */

.kb-form .kb-field {
  margin-bottom: 14px;
}

.kb-form .kb-field label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--kb-color-text);
}

.kb-form input[type="text"],
.kb-form input[type="email"],
.kb-form input[type="password"],
.kb-form input[type="date"],
.kb-form input[type="number"],
.kb-form select,
.kb-form textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,0.6);
  padding: 9px 12px;
  font-size: 14px;
  line-height: 1.3;
  box-sizing: border-box;
  background: rgba(255,255,255,0.96);
  color: var(--kb-color-text);
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.kb-form input:focus,
.kb-form select:focus,
.kb-form textarea:focus {
  outline: none;
  border-color: rgba(44,62,80,0.85);
  box-shadow: 0 0 0 3px rgba(44,62,80,0.08);
  background: #ffffff;
}

/* Cases à cocher */

.kb-form .kb-accept {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--kb-color-text);
}

.kb-form .kb-accept input[type="checkbox"] {
  margin-top: 2px;
}

/* ====== BOUTONS ====== */

.kb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  background: var(--kb-color-primary);
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(15,23,42,0.35);
  transition: transform .12s ease, box-shadow .12s ease, background .18s ease, color .18s ease;
}

.kb-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(15,23,42,0.45);
}

.kb-btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 22px rgba(15,23,42,0.35);
}

/* Variante or (CTA principal) */

.kb-btn--accent {
  background: linear-gradient(135deg, #f5d778, var(--kb-color-accent));
  color: #1f2933;
  box-shadow: 0 12px 30px rgba(212,175,55,0.45);
}

.kb-btn--accent:hover {
  background: linear-gradient(135deg, #ffe38f, #e6c458);
}

/* Variante secondaire (contour) */

.kb-btn--secondary {
  background: transparent;
  color: var(--kb-color-primary);
  border: 1px solid rgba(148,163,184,0.8);
  box-shadow: none;
}

.kb-btn--secondary:hover {
  background: rgba(148,163,184,0.06);
}

/* ====== NOTICES (erreur / succès) ====== */

.kb-notice {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.kb-notice--success {
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.kb-notice--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

/* ====== GAUGE MOT DE PASSE ====== */

#kbmb-pass-meter {
  width: 120px;
  height: 7px;
  border-radius: 999px;
}

#kbmb-pass-meter::-webkit-meter-bar {
  border-radius: 999px;
  background: #e5e7eb;
}

#kbmb-pass-meter::-webkit-meter-optimum-value {
  background: linear-gradient(90deg,#f97373,#facc15,#22c55e);
  border-radius: 999px;
}

/* ====== LIENS ====== */

.kb-link,
.kb-form a {
  color: #c24157;
  text-decoration: none;
  font-size: 13px;
}

.kb-link:hover,
.kb-form a:hover {
  text-decoration: underline;
}

/* ============================================================
   BLOC AUTH (widget connexion / création de compte)
   ============================================================ */

.kb-auth-widget {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 24px 40px;
  box-sizing: border-box;
}

.kb-auth-widget .kb-card {
  margin-bottom: 24px;
}

/* Titre des blocs login / register */

.kb-auth-widget h4 {
  margin-bottom: 16px;
  font-size: 20px;
}

/* Alignement du lien "mot de passe oublié" */
.kb-auth-widget .kb-forgot {
  margin-top: 8px;
}

/* ============================================================
   PROFIL / HUB UTILISATEUR
   ============================================================ */


.kb-prof-widget {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 40px;
  box-sizing: border-box;
}

/* Mini widget profil (barre indépendante pour lien profil + logout) */

.kb-prof-mini-widget {
  max-width: 1120px;
  margin: 0 auto 24px;
  padding: 0 24px;
  box-sizing: border-box;
}

.kb-prof-mini-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-radius: 999px;
  background:
    linear-gradient(120deg, rgba(44,62,80,0.95), rgba(44,62,80,0.85));
  color: #f9fafb;
  box-shadow: 0 14px 40px rgba(15,23,42,0.55);
}

.kb-prof-mini-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kb-prof-mini-title {
  font-size: 16px;
  font-weight: 600;
}

.kb-prof-mini-sub {
  font-size: 12px;
  opacity: 0.9;
}

.kb-prof-mini-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.kb-prof-mini-right .kb-btn {
  padding-inline: 18px;
}

.kb-prof-mini-right .kb-btn--accent {
  background: linear-gradient(135deg,#f6e08c,#d4af37);
  color: #1f2933;
}

.kb-prof-inner {
  border-radius: 30px;
  padding: 24px 24px 32px;
  background:
    radial-gradient(circle at 0% 0%, rgba(212,175,55,0.16), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(44,62,80,0.09), transparent 60%),
    linear-gradient(135deg, #fffaf3, #f8fafc);
  box-shadow: var(--kb-shadow-soft);
  border: 1px solid rgba(255,255,255,0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Header "Mon espace personnel" */

.kb-prof-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 26px;
  border-radius: 999px;
  background:
    linear-gradient(120deg, rgba(44,62,80,0.95), rgba(44,62,80,0.85));
  color: #f9fafb;
  box-shadow: 0 14px 40px rgba(15,23,42,0.55);
}

.kb-prof-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kb-prof-title {
  font-size: 18px;
  font-weight: 600;
}

.kb-prof-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  opacity: 0.9;
}

/* Petits badges dans la barre (Email non vérifié, Free, etc.) */

.kb-badge-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  background: rgba(15,23,42,0.6);
  border: 1px solid rgba(148,163,184,0.7);
}

.kb-badge-pill--free {
  background: rgba(22,163,74,0.15);
  border-color: rgba(34,197,94,0.5);
  color: #bbf7d0;
}

.kb-badge-pill--warning {
  background: rgba(248,250,252,0.06);
  border-color: rgba(248,250,252,0.45);
}

.kb-badge-pill--beta {
  background: linear-gradient(135deg, rgba(245, 215, 120, 0.25), rgba(212, 175, 55, 0.35));
  border-color: rgba(250, 204, 21, 0.85);
  color: #111827;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* Statut e-mail dans le header (lisible sur fond sombre) */
.kb-badge-pill--email-ok {
  background: rgba(22, 163, 74, 0.24);
  border-color: rgba(34, 197, 94, 0.9);
  color: #bbf7d0;
}

.kb-badge-pill--email-pending {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(248, 113, 113, 0.9);
  color: #fee2e2;
}

/* Boutons de droite dans le header */

.kb-prof-header-right .kb-btn {
  padding-inline: 18px;
}

.kb-prof-header-right .kb-btn--accent {
  background: linear-gradient(135deg,#f6e08c,#d4af37);
  color: #1f2933;
}

/* Grille du formulaire profil (2 colonnes) */

.kb-prof-grid {
  display: grid;
  grid-template-columns: minmax(0,1.15fr) minmax(0,1fr);
  gap: 28px;
  align-items: flex-start;
}

.kb-prof-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Avatar + bouton "mettre à jour la photo" */

.kb-prof-avatar {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 16px;
}

.kb-prof-avatar img {
  width: 82px;
  height: 82px;
  border-radius: 999px;
  object-fit: cover;
  background: #e5e7eb;
}

/* Slider niveau d'ouverture spirituelle */

.kb-prof-widget input[type="range"] {
  width: 100%;
}

/* ESPACEMENT BAS */

.kb-prof-widget .kb-footer-note {
  margin-top: 18px;
  font-size: 12px;
  color: var(--kb-color-muted);
}

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

@media (max-width: 1024px) {
  .kb-prof-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .kb-prof-header-right {
    width: 100%;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
  }

  .kb-prof-grid {
    grid-template-columns: minmax(0,1fr);
  }

  .kb-prof-mini-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .kb-prof-mini-right {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .kb-wrap,
  .kb-auth-widget,
  .kb-prof-widget,
  .kb-prof-mini-widget {
    padding-inline: 16px;
  }

  .kb-card {
    padding-inline: 18px;
  }
}

/* ============================================================
   MEMORYBOARD – Lettres, enveloppes, photos
   ============================================================ */

/* Wrapper principal */

.kbmb-memoryboard {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.kbmb-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.kbmb-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.kbmb-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--kb-color-primary);
  margin: 0;
}

.kbmb-section-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--kb-color-muted);
}

.kbmb-section-meta {
  font-size: 12px;
  color: var(--kb-color-muted);
}

/* Alertes globales (succès / erreur) pour le MemoryBoard */

.kb-alert {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.kb-alert--success {
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.kb-alert--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

/* Boutons MemoryBoard (alias du style kb-btn) */

.kbmb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  background: var(--kb-color-primary);
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(15,23,42,0.35);
  transition: transform .12s ease, box-shadow .12s ease, background .18s ease, color .18s ease;
}

.kbmb-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(15,23,42,0.45);
}

.kbmb-btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 22px rgba(15,23,42,0.35);
}

.kbmb-btn--primary {
  background: linear-gradient(135deg, #f5d778, var(--kb-color-accent));
  color: #1f2933;
  box-shadow: 0 12px 30px rgba(212,175,55,0.45);
}

.kbmb-btn--ghost {
  background: rgba(255,255,255,0.9);
  color: var(--kb-color-primary);
  border: 1px solid rgba(148,163,184,0.8);
  box-shadow: none;
}

.kbmb-btn--danger {
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.7);
  color: #b91c1c;
}

.kbmb-btn--xs {
  padding: 5px 10px;
  font-size: 12px;
}

.kbmb-btn--upload {
  margin-top: 10px;
}

/* Inputs / selects / textarea MemoryBoard (alias du style kb-form) */

.kbmb-input,
.kbmb-textarea,
.kbmb-select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,0.6);
  padding: 9px 12px;
  font-size: 14px;
  line-height: 1.3;
  box-sizing: border-box;
  background: rgba(255,255,255,0.96);
  color: var(--kb-color-text);
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.kbmb-input:focus,
.kbmb-textarea:focus,
.kbmb-select:focus {
  outline: none;
  border-color: rgba(44,62,80,0.85);
  box-shadow: 0 0 0 3px rgba(44,62,80,0.08);
  background: #ffffff;
}

.kbmb-textarea {
  min-height: 160px;
  resize: vertical;
}

.kbmb-label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--kb-color-text);
}

.kbmb-label--small {
  font-size: 12px;
  color: var(--kb-color-muted);
}

.kbmb-form-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Carte Lettres – layout 2 colonnes */

.kbmb-card--letters {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.kbmb-letters-editor,
.kbmb-letters-envelopes {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.kbmb-letters-envelopes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Toolbar éditeur simple */

.kbmb-editor-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.kbmb-editor-btn {
  border-radius: 999px;
  border: 1px solid rgba(209,213,219,0.9);
  background: rgba(255,255,255,0.96);
  font-size: 11px;
  padding: 4px 8px;
  cursor: default; /* boutons visuels pour l’instant */
}

/* Grille enveloppes : 2 par ligne sur desktop */

.kbmb-envelopes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.kbmb-envelope {
  position: relative;
  border-radius: 22px;
  background: linear-gradient(145deg, #fefefe, #f4f5fb);
  box-shadow: 0 18px 45px rgba(148,163,184,0.35);
  padding: 22px 22px 64px; /* place pour les boutons en bas */
  overflow: hidden;
}

.kbmb-envelope-inner {
  position: relative;
}

.kbmb-envelope-flap {
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 160%;
  height: 120%;
  background: linear-gradient(to bottom right, #fdfdfd, #e5e7eb);
  clip-path: polygon(0 0, 100% 0, 50% 52%);
  opacity: 0.96;
}

.kbmb-envelope-body {
  position: relative;
  padding-top: 40px;
}

.kbmb-envelope-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  margin-bottom: 6px;
}

.kbmb-envelope-status {
  font-weight: 600;
}

.kbmb-envelope-title {
  margin: 6px 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.kbmb-envelope-excerpt {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #6b7280;
}

.kbmb-envelope-actions {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

/* Normalisation des formulaires d’actions dans les enveloppes */
.kbmb-envelope-actions form {
  margin: 0;
}

.kbmb-envelope-actions .kbmb-envelope-form {
  display: inline-flex;
}

.kbmb-envelope-actions .kb-btn {
  font-size: 12px;
  line-height: 1.2;
  padding: 6px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.kbmb-envelope-actions .kb-btn.kbmb-btn--danger {
  border: 1px solid rgba(239, 68, 68, 0.18);
}

.kbmb-envelope-actions .kbmb-btn--ghost {
  background: #111827;
  color: #f9fafb;
  border: none;
}

.kbmb-envelope-actions .kbmb-btn--disabled {
  opacity: 0.55;
  cursor: default;
}

.kbmb-envelope--status-draft .kbmb-envelope-status {
  color: #f59e0b;
}

.kbmb-envelope--status-ready .kbmb-envelope-status {
  color: #10b981;
}

.kbmb-envelope--status-posted .kbmb-envelope-status {
  color: #6366f1;
}

/* Carte Photos – grille Polaroid */

.kbmb-card--photos {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.kbmb-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
}

.kbmb-photo-polaroid {
  position: relative;
  padding: 10px;
  border-radius: 12px;
  background: #fdfdfb;
  box-shadow: 0 10px 25px rgba(15,23,42,0.25);
  transform: rotate(-1.2deg);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kbmb-photo-polaroid:nth-child(2n) {
  transform: rotate(1.3deg);
}

.kbmb-photo-polaroid:hover {
  transform: translateY(-2px) rotate(0deg);
  box-shadow: 0 16px 40px rgba(15,23,42,0.35);
}

.kbmb-photo-polaroid-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kbmb-photo-polaroid-image {
  overflow: hidden;
  border-radius: 8px;
  background: #e5e7eb;
}

.kbmb-photo-polaroid-image img {
  width: 100%;
  display: block;
}

.kbmb-photo-polaroid-caption {
  padding-top: 4px;
  font-size: 11px;
  color: #6b7280;
}

.kbmb-photo-tags {
  font-size: 11px;
  color: #6b7280;
}

.kbmb-photo-polaroid-actions {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.kbmb-photo-polaroid--favorite {
  border: 2px solid #ec4899;
}

.kbmb-photo-upload {
  margin-top: 4px;
}

.kbmb-photo-limit {
  font-size: 13px;
  color: var(--kb-color-muted);
}

/* Responsive MemoryBoard */

@media (max-width: 1024px) {
  .kbmb-card--letters {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .kbmb-envelope-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .kbmb-envelope-actions a.kb-btn,
  .kbmb-envelope-actions button.kb-btn {
    width: 100%;
    text-align: center;
  }

  .kbmb-envelope-actions .kbmb-envelope-form {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .kbmb-envelopes-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}