/* xfoodorder PWA - Style principal */
:root {
  --header-bg: #1a1a1a;
  --header-text: #fff;
  --nav-bottom-bg: #1a1a1a;
  --nav-text: #fff;
  --nav-active: #4CAF50;
  --card-bg: #fff;
  --body-bg: #f5f5f5;
  --text: #212121;
  --text-muted: #757575;
  --border: #e0e0e0;
  --primary: #2196F3;
  --accent: #FF9800;
  --danger: #f44336;
  --success: #4CAF50;
  --badge-pre: #4CAF50;
  --sidebar-bg: #fafafa;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--body-bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 70px;
}

/* Header fixe */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--header-bg);
  color: var(--header-text);
  display: flex;
  align-items: center;
  padding: 0 12px;
  z-index: 100;
  box-shadow: var(--shadow);
}
.app-header .menu-toggle {
  background: none;
  border: none;
  color: inherit;
  padding: 8px;
  margin-right: 8px;
  cursor: pointer;
  font-size: 1.25rem;
}
.app-header .title {
  flex: 1;
  font-weight: 600;
  font-size: 1.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header .badge-pre {
  background: var(--badge-pre);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 8px;
}
.app-header .header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.app-header .header-actions button {
  background: none;
  border: none;
  color: inherit;
  padding: 8px;
  cursor: pointer;
  position: relative;
}
.app-header .header-actions .notif-dot::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: #2196F3;
  border-radius: 50%;
}

/* Sous-titre de section (retour + titre) */
.section-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 56px;
}
.section-header .back-link {
  color: inherit;
  text-decoration: none;
  padding: 4px;
}
.section-header .section-title {
  flex: 1;
  font-weight: 600;
  font-size: 1.1rem;
}
.section-header .section-actions button {
  background: none;
  border: none;
  color: inherit;
  padding: 4px 8px;
  cursor: pointer;
}

/* Contenu principal */
.main-content {
  padding: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Cartes */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.card-title {
  font-weight: 600;
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title .edit-icon {
  color: var(--text-muted);
  cursor: pointer;
}

/* Barre de navigation basse */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--nav-bottom-bg);
  color: var(--nav-text);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.7rem;
  padding: 8px;
  min-width: 52px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}
.bottom-nav a:hover, .bottom-nav a.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
}
.bottom-nav a.active {
  font-weight: 600;
}
.bottom-nav svg {
  width: 24px;
  height: 24px;
  margin-bottom: 2px;
}

/* Menu latéral (drawer) */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.sidebar-overlay.open {
  opacity: 1;
  visibility: visible;
}
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: var(--sidebar-bg);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform 0.25s;
  overflow-y: auto;
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}
.sidebar.open {
  transform: translateX(0);
}
.sidebar-profile {
  padding: 24px 16px;
  background: var(--header-bg);
  color: var(--header-text);
}
.sidebar-profile .avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #424242;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 8px;
}
.sidebar-profile .name { font-weight: 600; font-size: 1rem; }
.sidebar-profile .email { font-size: 0.85rem; opacity: 0.9; }
.sidebar-nav {
  padding: 8px 0;
}
.sidebar-nav a, .sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 1rem;
  cursor: pointer;
}
.sidebar-nav a:hover, .sidebar-nav button:hover {
  background: rgba(0,0,0,0.05);
}
.sidebar-nav .logout { color: var(--danger); font-weight: 500; }
.sidebar-nav .menu-item-icon { width: 24px; height: 24px; opacity: 0.8; flex-shrink: 0; }
.sidebar-nav .menu-divider { height: 1px; background: var(--border); margin: 8px 16px; }

/* Grille actions rapides */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.actions-grid .btn-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  box-shadow: var(--shadow);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn-action:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.btn-action .icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(33,150,243,0.12);
  color: var(--primary);
}
.btn-action .icon-wrap.orange { background: rgba(255,152,0,0.2); color: var(--accent); }
.btn-action .icon-wrap.green { background: rgba(76,175,80,0.2); color: var(--success); }
.btn-action .icon-wrap.purple { background: rgba(156,39,176,0.15); color: #9C27B0; }

/* État vide (aucune donnée) */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state h3 { color: var(--text); margin: 0 0 8px 0; font-size: 1.1rem; }
.empty-state p { margin: 0 0 20px 0; font-size: 0.9rem; }

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s;
}
.btn:hover { opacity: 0.9; }
.btn-primary { background: var(--header-bg); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-block { width: 100%; }

/* Liste de liens (profil, paramètres) */
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { border-bottom: 1px solid var(--border); }
.link-list li:last-child { border-bottom: none; }
.link-list a, .link-list button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-size: 1rem;
  cursor: pointer;
}
.link-list a:hover, .link-list button:hover { background: rgba(0,0,0,0.02); }
.link-list .link-desc { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.link-list .link-arrow { margin-left: auto; color: var(--text-muted); }
.link-list .link-icon { width: 24px; height: 24px; opacity: 0.7; }

/* Formulaire */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* Onglets (Rapports) */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tabs a, .tabs button {
  padding: 12px 16px;
  white-space: nowrap;
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 1rem;
  cursor: pointer;
}
.tabs a.active, .tabs button.active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* Filtres (Restaurant / Hôtel, période) */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.filter-bar select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

/* Cartes KPIs (rapports) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.kpi-card.gray { background: #f5f5f5; }
.kpi-card.green { background: #E8F5E9; }
.kpi-card.yellow { background: #FFF8E1; }
.kpi-card .kpi-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }
.kpi-card .kpi-value { font-size: 1.5rem; font-weight: 700; }
.kpi-card .kpi-change { font-size: 0.8rem; color: var(--success); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--card-bg);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  transform: translateY(100%);
  transition: transform 0.25s;
}
.modal-overlay.open .modal {
  transform: translateY(0);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-header h2 { margin: 0; font-size: 1.25rem; }
.modal-header .close-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-muted);
}

/* FAB */
.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--header-bg);
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  cursor: pointer;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

/* Utilitaires */
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 16px; }

@media (min-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .actions-grid { grid-template-columns: repeat(4, 1fr); }
}
