/* ==========================================================================
   STYLE.CSS — GLOBALS UNIQUEMENT (Reset, Variables, Layout, Modal, Forms)
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0b0908;
  --surface: #14100e;
  --surface2: #1c1613;
  --surface3: #261e1a;
  --border: rgba(200, 160, 100, 0.12);
  --border-strong: rgba(200, 160, 100, 0.30);
  --gold: #c8a064;
  --gold2: #e8c88a;
  --gold3: #f5dfa0;
  --gold-dim: rgba(200, 160, 100, 0.10);
  --rose: #b64366;
  --rose-light: #e28da7;
  --rose-dim: rgba(182, 67, 102, 0.08);
  --text: #f3ede4;
  --muted: #8c7b6c;
  --done-text: #9cb28f;
  --done-border: rgba(156, 178, 143, 0.35);
  --done-bg: rgba(65, 85, 52, 0.12);
  --danger: #b84d4d;
  --radius: 6px;
  --bottom-nav-height: 60px;
}

body {
  font-family: 'Jost', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ─── BOUTONS ─── */
.btn-action-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: transparent;
  color: var(--gold2);
  border: 1px solid var(--border-strong);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 30px;
  transition: all 0.3s ease;
  font-family: 'Jost', sans-serif;
  white-space: nowrap;
}

.btn-action-main:hover {
  border-color: var(--gold);
  color: var(--gold3);
  box-shadow: 0 0 15px rgba(200, 160, 100, 0.2);
  transform: translateY(-1px);
}

.btn-dialog-cancel {
  padding: 9px 20px;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-family: 'Jost', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.2s;
}

.btn-dialog-cancel:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-dialog-submit {
  padding: 9px 24px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--gold);
  font-size: 11px;
  font-family: 'Jost', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  border-radius: 20px;
  transition: all 0.2s;
}

.btn-dialog-submit:hover {
  border-color: var(--gold);
  color: var(--gold3);
  background: var(--gold-dim);
}

/* ─── BARRE DE NAVIGATION SUPÉRIEURE ─── */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 150;
  background: rgba(11, 9, 8, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

@media (min-width: 768px) {
  .top-bar {
    padding: 0 2rem;
  }
}

.top-bar-left {
  display: flex;
  align-items: center;
}

.brand {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.brand em {
  font-style: italic;
  color: var(--rose-light);
}

/* Navigation onglets (desktop seulement) */
.tab-nav {
  display: none;
  align-items: stretch;
  height: 56px;
}

@media (min-width: 600px) {
  .tab-nav {
    display: flex;
  }
}

.tab-nav a {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-nav a:hover,
.tab-nav a.active {
  color: var(--gold);
}

.tab-nav a.active {
  border-bottom-color: var(--gold);
}

/* Zone profil */
.profile-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 0.8rem;
  border-left: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.profile-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  color: var(--gold);
  font-weight: bold;
  transition: border-color 0.2s;
}

.profile-area:hover .profile-badge {
  border-color: var(--gold);
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--surface2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px;
  min-width: 190px;
  z-index: 160;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: all 0.2s ease;
}

.profile-dropdown.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: rgba(200, 160, 100, 0.06);
}

/* ─── CONTENU DE PAGE ─── */
.page {
  padding: 1.5rem 1rem;
  max-width: 1000px;
  margin: 0 auto;
  padding-bottom: calc(var(--bottom-nav-height) + 1.5rem);
}

@media (min-width: 600px) {
  .page {
    padding-bottom: 2.5rem;
  }
}

@media (min-width: 768px) {
  .page {
    padding: 2.5rem 2rem;
  }
}

.page-header-flex {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 2rem;
}

@media (min-width: 580px) {
  .page-header-flex {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.page-title-romantic {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 300;
  line-height: 1.2;
}

.page-title-romantic em {
  color: var(--rose-light);
  font-style: italic;
}

/* Titre de section partagé entre plusieurs pages */
.section-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.45rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.section-title em {
  font-style: italic;
  text-transform: none;
  font-size: 1.6rem;
  color: var(--text);
}

.section-block {
  margin-bottom: 2.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.section-label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.section-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Boutons d'action icône */
.action-icon-btn {
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
}

.action-icon-btn:hover {
  color: var(--danger);
  background: rgba(184, 77, 77, 0.08);
}

/* ─── OVERLAY ET MODALES ─── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 4, 3, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 250;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  width: 100%;
  max-width: 500px;
  padding: 2rem;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  /* Scrollbar discrète */
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.modal::-webkit-scrollbar {
  width: 4px;
}

.modal::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 2px;
}

/* En-tête modal */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.8rem;
  gap: 12px;
}

.modal-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 300;
  line-height: 1.2;
  flex: 1;
}

/* Sous-titre dans le titre du modal (ex: <span>Configuration</span>Titre) */
.modal-title span {
  display: block;
  font-family: 'Jost', sans-serif;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  font-weight: 400;
  margin-bottom: 3px;
}

/* Bouton de fermeture de modal */
.modal-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  min-width: 30px;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
  font-size: 1rem;
}

.modal-close-btn:hover {
  color: var(--text);
  background: var(--surface3);
}

/* Pied de modal */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ─── FORMULAIRES ─── */
.form-group {
  margin-bottom: 1.6rem;
}

.form-group-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.6rem;
}

label {
  display: block;
  font-family: 'Jost', sans-serif;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 11px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  /* Empêche le zoom iOS */
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

input[type="date"] {
  color-scheme: dark;
  font-family: 'Jost', sans-serif;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--gold);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* ─── BOÎTES DE DIALOGUE PERSONNALISÉES ─── */
.custom-dialog-box {
  background: var(--surface2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  max-width: 400px;
  width: 100%;
  padding: 2rem;
  text-align: center;
}

.dialog-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  color: var(--gold2);
  margin-bottom: 10px;
}

.dialog-text {
  font-family: 'Jost', sans-serif;
  font-size: 13px;
  color: var(--text);
  opacity: 0.85;
  margin-bottom: 1.8rem;
  line-height: 1.6;
}

.dialog-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Message d'erreur (formulaire PIN, etc.) */
.err-msg {
  color: var(--danger);
  font-size: 12px;
  margin-top: 8px;
  display: none;
}

.err-msg.show {
  display: block;
}

/* ─── ÉTAT VIDE ─── */
.empty-section-text,
.empty-state {
  color: var(--muted);
  font-style: italic;
  font-size: 0.95rem;
  padding: 0.5rem 0;
  font-family: 'Cormorant Garamond', serif;
}

.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  font-size: 1.2rem;
}

/* ─── NAVIGATION MOBILE EN BAS ─── */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 599px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: rgba(11, 9, 8, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--muted);
    font-size: 8px;
    font-family: 'Jost', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    gap: 4px;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-bottom-nav a.active {
    color: var(--gold);
  }

  .mobile-bottom-nav a .nav-icon {
    font-size: 19px;
    line-height: 1;
    transition: filter 0.2s, transform 0.2s;
  }

  .mobile-bottom-nav a.active .nav-icon {
    filter: drop-shadow(0 0 5px rgba(200, 160, 100, 0.6));
    transform: translateY(-1px);
  }

  /* Modales en feuille basse sur mobile */
  .overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    border-radius: 16px 16px 0 0;
    max-width: 100%;
    max-height: 90vh;
    padding: 1.5rem 1.2rem 2rem;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  /* Indicateur de drag */
  .modal::before {
    content: '';
    display: block;
    width: 36px;
    height: 3px;
    background: var(--border-strong);
    border-radius: 2px;
    margin: 0 auto 1.5rem;
  }

  /* Grilles en 1 colonne sur mobile */
  .task-list {
    grid-template-columns: 1fr !important;
  }

  .ratings-grid {
    grid-template-columns: 1fr !important;
  }

  .badges-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Footer modal sticky */
  .modal-footer {
    position: sticky;
    bottom: 0;
    background: var(--surface2);
    padding-bottom: 0.5rem;
    margin-top: 1.5rem;
  }

  /* Boutons plus grands pour le toucher */
  .btn-action-main {
    min-height: 44px;
    padding: 12px 20px;
  }

  .btn-dialog-cancel,
  .btn-dialog-submit {
    min-height: 44px;
    flex: 1;
  }
}

/* ─── TRANSITIONS GLOBALES DE PAGE ─── */
@media (prefers-reduced-motion: no-preference) {
  .page {
    animation: pageFadeIn 0.3s ease both;
  }

  @keyframes pageFadeIn {
    from {
      opacity: 0;
      transform: translateY(6px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}