/* Hérité de N-Joy styles.css (2026-07-15) — palette adaptée « Mon Assistant » */
:root {
  /* Color Palette (Premium Dark Theme) */
  --bg-color: #020617; /* Slate 950 (Plus sombre pour le fond) */
  --bg-surface: #1E293B; /* Slate 800 (Zone de travail) */
  --bg-surface-glass: rgba(30, 41, 59, 0.85); /* Plus opaque pour mieux ressortir */
  
  --primary: #0EA5E9; /* Sky 500 — palette « foyer » bleu clair */
  --primary-hover: #0284C7;
  --primary-light: rgba(14, 165, 233, 0.15);
  --gradient-primary: linear-gradient(135deg, #7DD3FC 0%, #0EA5E9 100%); /* dégradé bleu clair */
  
  --secondary: #FB923C; /* Orange 400 — chaleur familiale */
  --accent: #F59E0B; /* Amber 500 */
  --success: #10B981; /* Emerald 500 */
  --danger: #EF4444; /* Red 500 */
  
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #7C8BA1; /* éclairci depuis #64748B pour repasser au-dessus du ratio AA 4.5:1 sur fond sombre (audit UX point 8) */
  
  --border-color: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.05);
  
  /* Typography */
  --font-body: 'Inter', sans-serif;
  --font-heading: 'Poppins', sans-serif;
  
  /* Effects */
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --blur-glass: blur(12px);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 8px;
  
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

[data-theme="light"] {
  --bg-color: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-glass: rgba(255, 255, 255, 0.8);
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #5B6472;                 /* assez foncé pour rester lisible sur blanc (AA) */
  --border-color: rgba(0, 0, 0, 0.1);
  --border-light: rgba(0, 0, 0, 0.06);   /* les bordures fines étaient invisibles sur blanc */
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
}
/* La barre de navigation basse est codée en dur en sombre → version claire cohérente */
[data-theme="light"] .bottom-nav {
  background: rgba(255, 255, 255, 0.85);
  border-top-color: rgba(0, 0, 0, 0.08);
}
/* Champs de saisie : fond très sombre par défaut → gris clair en thème clair */
[data-theme="light"] .input-field {
  background: rgba(0, 0, 0, 0.04);
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-primary);
}

button {
  font-family: var(--font-body);
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

input, textarea, select {
  font-family: var(--font-body);
}

/* ===== Accessibilité (audit UX — points 2, 6, 8) ===== */

/* Point 2 — indicateur de focus clavier visible et cohérent (WCAG 2.4.7).
   :focus-visible ne s'affiche qu'à la navigation clavier, pas au clic souris/tactile. */
:where(button, a, input, select, textarea, [tabindex], .nav-item, .tab-btn, .event-card):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Point 6 — cibles tactiles ≥ 44×44 px (WCAG 2.5.5 / Apple HIG) sur les boutons icône.
   min-width/height s'appliquent même avec un padding inline plus petit. */
button[class*="btn-edit"], button[class*="btn-delete"], button[class*="btn-del-"],
button[class*="btn-remove"], button[class*="btn-approve"], button[class*="btn-reject"],
button[class*="btn-close"], button[id*="btn-close"],
.btn-sync-budget, .btn-ack-task, .btn-add-payment, .btn-leave-event,
.btn-archive-event, .btn-backup-event, .pw-toggle {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Point 8 — respecter la préférence système « réduire les animations » (vestibulaire). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Utilities */
.hidden { display: none !important; }
.glass-panel {
  background: var(--bg-surface-glass);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glass);
}
.glass-panel-lg {
  border-radius: var(--radius-lg);
}
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* App Container */
#app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 80px; /* Space for bottom nav */
}

/* Global Background Decoration */
#app-container::before {
  content: '';
  position: fixed;
  top: -100px;
  right: -100px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: var(--primary);
  filter: blur(100px);
  opacity: 0.2;
  z-index: -1;
}
#app-container::after {
  content: '';
  position: fixed;
  bottom: -100px;
  left: -50px;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: var(--secondary);
  filter: blur(100px);
  opacity: 0.15;
  z-index: -1;
}

/* View Container */
.view-container {
  flex: 1;
  width: 100%;
  max-width: 600px; /* Mobile optimal width constraints */
  margin: 0 auto;
  padding: 20px;
  animation: fadeIn 0.4s ease;
}

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

/* Loader */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}
.loader {
  text-align: center;
  color: var(--primary);
}
.loader span.material-symbols-rounded {
  font-size: 48px;
  animation: pulse 1.5s infinite;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.loader p {
  margin-top: 16px;
  font-weight: 500;
  color: var(--text-secondary);
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 70px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(15, 23, 42, 0.85); /* Slightly darker for contrast */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

@media (min-width: 600px) {
  .bottom-nav {
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 4px;
  padding: 8px;
  transition: var(--transition-fast);
  border-radius: var(--radius-sm);
  width: 64px;
}

.nav-item span.material-symbols-rounded {
  font-size: 24px;
  transition: var(--transition-fast);
}

.nav-item span:not(.material-symbols-rounded) {
  font-size: 10px;
  font-weight: 500;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active span.material-symbols-rounded {
  font-variation-settings: 'FILL' 1;
  transform: translateY(-2px);
}

/* Onboarding : le coach réserve sa place au lieu de masquer le contenu.
   --coach-h est mesuré dynamiquement en JS (hauteur réelle de la carte). */
body.tutorial-active #app-container {
  padding-bottom: calc(var(--coach-h, 160px) + 88px);
}
/* La vue Chat a une hauteur basée sur le viewport : on la réduit d'autant pour
   que la zone de saisie remonte au-dessus du coach au lieu d'être cachée. */
body.tutorial-active .chat-shell {
  height: calc(100vh - 200px - var(--coach-h, 160px)) !important;
}

/* Tutorial highlight on nav items */
.nav-item.tutorial-highlight {
  color: var(--primary);
  animation: tutorialPulse 1.3s ease-in-out infinite;
}
@keyframes tutorialPulse {
  0%, 100% {
    background: rgba(14, 165, 233, 0.15);
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.5);
  }
  50% {
    background: rgba(14, 165, 233, 0.28);
    box-shadow: 0 0 0 8px rgba(14, 165, 233, 0);
  }
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end; /* Bottom sheet on mobile */
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 100%;
  max-width: 600px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition-fast);
  width: 100%;
}
.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}
.btn-primary:active {
  transform: scale(0.98);
}
.btn-secondary {
  background: var(--bg-surface-glass);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

/* Form Elements */
.input-group {
  margin-bottom: 20px;
}
.input-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}
.input-field {
  width: 100%;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  transition: var(--transition-fast);
}
.input-field:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(0,0,0,0.3);
}

/* Badges */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-express {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}
.badge-grand {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent);
}

/* Sections */
.section-title {
  font-size: 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .material-symbols-rounded {
  color: var(--primary);
}

/* Text Center Utility */
.text-center {
  text-align: center;
}

/* Disabled Button */
.btn[disabled] {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

/* Select Styling */
select.input-field {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%2394A3B8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* "More" popup menu */
.more-menu {
  position: absolute;
  bottom: 78px;
  right: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
  padding: 8px;
  min-width: 200px;
  z-index: 200;
  animation: slideUpMenu 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.more-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.more-menu-item:hover,
.more-menu-item:active {
  background: rgba(255, 255, 255, 0.05);
}

.more-menu-item .material-symbols-rounded {
  font-size: 20px;
  color: var(--text-secondary);
}

/* Action Cards (Dashboard) */
.action-card:hover {
  transform: translateY(-2px);
}
.action-card:active {
  transform: scale(0.97);
}

/* Vendor Action Button */
.vendor-action-btn:hover {
  background: rgba(16, 185, 129, 0.2) !important;
}

/* Guest item hover */
.guest-item:hover,
.task-item:hover,
.expense-item:hover,
.vendor-card:hover {
  border-color: var(--primary);
}

/* Fade in animation class */
.fade-in {
  animation: fadeIn 0.4s ease;
}

/* Textarea resize */
textarea.input-field {
  resize: vertical;
  min-height: 60px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

/* Touch ripple effect (subtle) */
@keyframes ripple {
  from { transform: scale(0); opacity: 0.4; }
  to { transform: scale(4); opacity: 0; }
}

/* Archived / Read-Only Mode */
.archived-mode input:not(.nav-item),
.archived-mode textarea,
.archived-mode select,
.archived-mode .btn,
.archived-mode button:not(.nav-item):not(.more-menu-item):not(#btn-close-modal-task):not(#btn-close-edit-location):not(.tab-btn) {
  pointer-events: none !important;
  opacity: 0.5 !important;
}

/* Hide specific action buttons in archive mode to clean up UI */
.archived-mode .btn-delete-task,
.archived-mode .btn-edit-task,
.archived-mode .btn-sync-budget,
.archived-mode .btn-delete-expense,
.archived-mode .btn-edit-expense,
.archived-mode .btn-delete-guest,
.archived-mode .btn-edit-guest,
.archived-mode .btn-delete-vendor,
.archived-mode .btn-edit-vendor,
.archived-mode .btn-delete-contribution,
.archived-mode #btn-add-task,
.archived-mode #btn-save-target {
  display: none !important;
}
