/* GOM — Surcharges minimales */

.success-msg {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.error-msg {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* Cards accueil */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.home-card {
  text-align: center;
  padding: 2rem 1rem;
}

.home-card h3 {
  margin-bottom: 0.5rem;
}

/* Tableaux */
table {
  width: 100%;
}

/* Filtres inline */
.filters {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 1rem;
}

.filters label {
  flex: 1;
  min-width: 150px;
}

input[type="file"] {
  padding: 0.75rem;
  cursor: pointer;
}

/* ===== COMPTEUR ANXIOGÈNE ===== */
.compteur-attente {
  text-align: center;
  padding: 1.5rem 1rem;
  margin-bottom: 1rem;
}

.compteur-attente .compteur-nombre {
  display: block;
  font-size: 3rem;
  font-weight: bold;
  color: #d32f2f;
  line-height: 1;
}

.compteur-attente .compteur-label {
  display: block;
  font-size: 1.1rem;
  color: #d32f2f;
  font-weight: 600;
}

.compteur-attente.zero .compteur-nombre,
.compteur-attente.zero .compteur-label {
  color: #2e7d32;
}

.compteur-inline {
  font-size: 1.5rem;
  font-weight: bold;
  color: #d32f2f;
}

.compteur-inline.zero {
  color: #2e7d32;
}

/* ===== CATÉGORIES (cases cliquables) ===== */
.category-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.category-card {
  text-align: center;
  padding: 0.75rem 0.5rem;
  border: 2px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  cursor: pointer;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

.category-card:hover {
  border-color: var(--pico-primary);
}

.category-card.selected {
  border-color: var(--pico-primary);
  background: var(--pico-primary-focus);
}

.category-card-icon {
  font-size: 2rem;
  line-height: 1;
}

.category-card-name {
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* ===== BADGES ===== */
.badge-urgent {
  display: inline-block;
  background: #d32f2f;
  color: white;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: bold;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 0.25rem;
}

.badge-attente {
  display: inline-block;
  background: #f57c00;
  color: white;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  vertical-align: middle;
}

.badge-traitee {
  display: inline-block;
  background: #2e7d32;
  color: white;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  vertical-align: middle;
}

.badge-encours {
  display: inline-block;
  background: #1565c0;
  color: white;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  vertical-align: middle;
}

.badge-refusee {
  display: inline-block;
  background: #757575;
  color: white;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  vertical-align: middle;
}

/* ===== NOTIFICATION BADGE ===== */
.notif-badge {
  display: none;
  background: #d32f2f;
  color: white;
  border-radius: 50%;
  padding: 0.1rem 0.4rem;
  font-size: 0.65rem;
  font-weight: bold;
  vertical-align: super;
  margin-left: 0.15rem;
  min-width: 1rem;
  text-align: center;
  line-height: 1.2;
}

/* ===== COMMENTS ===== */
.comments-section {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--pico-muted-border-color);
  border-radius: 4px;
}

.comment-item {
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.comment-item:last-of-type {
  border-bottom: none;
}

.comment-form {
  display: none;
  margin-top: 0.5rem;
}

.comment-form-row {
  display: flex;
  gap: 0.5rem;
  align-items: end;
}

.comment-form-row select {
  max-width: 160px;
  margin: 0;
}

.comment-form-row input {
  flex: 1;
  margin: 0;
}

.comment-form-row button {
  margin: 0;
  white-space: nowrap;
}

.toggle-comment-form {
  cursor: pointer;
  color: var(--pico-primary);
  font-size: 0.85rem;
  background: none;
  border: none;
  padding: 0.5rem 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  text-decoration: underline;
}

/* ===== EN COURS CARD ===== */
.demande-card-encours {
  border-left: 3px solid #1565c0;
}

/* ===== DASHBOARD ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  text-align: center;
  padding: 1rem;
}

.kpi-card .kpi-value {
  display: block;
  font-size: 2rem;
  font-weight: bold;
  line-height: 1.2;
}

.kpi-card .kpi-label {
  font-size: 0.85rem;
  color: var(--pico-muted-color);
}

.kpi-card .kpi-sub {
  font-size: 0.75rem;
  color: var(--pico-muted-color);
}

.stat-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0;
}

.stat-bar-label {
  min-width: 120px;
  font-size: 0.85rem;
}

.stat-bar-fill {
  height: 20px;
  background: var(--pico-primary);
  border-radius: 3px;
  min-width: 2px;
  transition: width 0.3s;
}

.stat-bar-count {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 30px;
}

.stock-low {
  color: #d32f2f;
  font-weight: 600;
}

.stock-ok {
  color: #2e7d32;
}

/* ===== TREATMENT ACTIONS (inline buttons) ===== */
.treatment-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.treatment-actions button {
  flex: 1;
  min-width: 100px;
}

.btn-refuse {
  background: #757575;
  border-color: #757575;
}

.btn-refuse:hover {
  background: #616161;
  border-color: #616161;
}

.btn-encours {
  background: #1565c0;
  border-color: #1565c0;
}

.btn-encours:hover {
  background: #0d47a1;
  border-color: #0d47a1;
}

/* ===== AUTOCOMPLÉTION ===== */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--pico-muted-border-color);
  border-top: none;
  max-height: 40vh;
  overflow-y: auto;
  z-index: 10;
  border-radius: 0 0 var(--pico-border-radius) var(--pico-border-radius);
}

.autocomplete-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  min-height: 44px;
}

.autocomplete-item:hover {
  background: var(--pico-primary-focus);
}

/* ===== SECTIONS EN ATTENTE / TRAITÉES ===== */
.section-header {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0.75rem 1rem;
  margin: 1.5rem -1rem 0.75rem;
  border-radius: 4px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-header-pending {
  background: var(--pico-primary-focus);
  color: var(--pico-primary);
  border-left: 4px solid var(--pico-primary);
}

.section-header-done {
  background: #e8f5e9;
  color: #2e7d32;
  border-left: 4px solid #2e7d32;
  margin-top: 2.5rem;
}

.section-header .section-count {
  font-size: 1.3rem;
}

/* ===== DEMANDE CARD ===== */
.demande-card {
  padding: 1rem;
}

.demande-card-pending {
  border-left: 3px solid var(--pico-primary);
}

.demande-card-done {
  border-left: 3px solid #ccc;
  opacity: 0.6;
  background: #f5f5f5;
}

.demande-card-refused {
  border-left: 3px solid #d32f2f;
  opacity: 0.6;
  background: #f5f5f5;
}

/* ===== PHOTO BUTTONS ===== */
.photo-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.photo-buttons button {
  flex: 1;
  font-size: 0.9rem;
}

/* ===== PHOTOS ===== */
.photos-preview {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.photo-thumb {
  position: relative;
  display: inline-block;
}

.photo-thumb .photo-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #d32f2f;
  color: white;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  min-height: unset;
}

.photo-preview {
  max-width: 100px;
  max-height: 100px;
  border-radius: 4px;
  object-fit: cover;
  cursor: pointer;
}

/* ===== LIGHTBOX ===== */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 95%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  color: white;
  font-size: 2rem;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
}

/* ===== ORDER BUTTONS (categories) ===== */
.order-buttons {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}

.order-buttons form {
  margin: 0;
}

.order-btn {
  display: block;
  width: 44px;
  height: 32px;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 0.8rem !important;
  line-height: 1;
  min-height: unset !important;
  text-align: center;
}

.order-btn-placeholder {
  display: block;
  width: 44px;
  height: 32px;
}

/* ===== USER INFO & LOGOUT ===== */
.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--pico-muted-color);
}

.logout-btn {
  background: none;
  border: 1px solid var(--pico-muted-border-color);
  color: var(--pico-muted-color);
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--pico-border-radius);
  cursor: pointer;
  min-height: unset;
  line-height: 1.5;
}

.logout-btn:hover {
  border-color: #d32f2f;
  color: #d32f2f;
}

/* --- Menu hamburger mobile --- */
nav .nav-toggle-label {
  display: none !important;
  cursor: pointer;
  font-size: 1.5rem;
  padding: 0.5rem;
  line-height: 1;
}

/* ===== FEEDBACK / SUGGESTION ===== */

/* Bouton flottant (FAB) */
.feedback-fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--pico-primary);
  color: white;
  border: none;
  cursor: pointer;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s, box-shadow 0.2s;
  padding: 0;
  min-height: unset;
}

.feedback-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.feedback-fab-icon {
  font-size: 1.6rem;
  line-height: 1;
}

/* Panel de suggestion */
.feedback-panel {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  width: 340px;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--pico-card-background-color, #fff);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  z-index: 901;
  padding: 0;
}

.feedback-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.feedback-panel-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--pico-muted-color);
  padding: 0;
  min-height: unset;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feedback-panel-close:hover {
  color: #d32f2f;
}

.feedback-panel .feedback-form {
  padding: 1rem;
}

.feedback-form textarea {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.feedback-media-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.feedback-media-btn {
  flex: 1;
  background: none;
  border: 1px solid var(--pico-muted-border-color);
  color: var(--pico-color);
  padding: 0.5rem;
  font-size: 0.85rem;
  border-radius: var(--pico-border-radius);
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.feedback-media-btn:hover {
  border-color: var(--pico-primary);
  color: var(--pico-primary);
}

.feedback-media-btn.recording {
  background: #d32f2f;
  color: white;
  border-color: #d32f2f;
  animation: pulse-recording 1.5s infinite;
}

@keyframes pulse-recording {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.feedback-audio-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: var(--pico-muted-border-color);
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.feedback-audio-status audio {
  flex: 1;
  height: 36px;
}

.feedback-audio-remove {
  background: #d32f2f;
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  min-height: unset;
}

/* ===== VALIDATION BANNER (articles à valider) ===== */
.validation-banner {
  display: block;
  text-align: center;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffcc80;
  border-radius: var(--pico-border-radius);
  text-decoration: none;
  font-size: 0.95rem;
}

.validation-banner:hover {
  background: #ffe0b2;
  color: #e65100;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
  pointer-events: none;
}

.toast {
  padding: 0.75rem 1rem;
  border-radius: var(--pico-border-radius);
  color: white;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  animation: toast-in 0.3s ease;
  pointer-events: auto;
  cursor: pointer;
}

.toast-success { background: #2e7d32; }
.toast-error { background: #d32f2f; }
.toast-info { background: #1565c0; }
.toast-warning { background: #f57c00; }

.toast.toast-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-1rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-1rem); }
}

/* ===== ACTIVE NAV LINK ===== */
.nav-link-active {
  font-weight: 700 !important;
  text-decoration: underline !important;
  text-underline-offset: 4px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--pico-muted-color);
}

.empty-state-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.5rem;
}

/* ===== AUTO-DISMISS MESSAGES ===== */
.success-msg, .error-msg {
  transition: opacity 0.5s ease, max-height 0.5s ease, padding 0.5s ease, margin 0.5s ease;
}

/* ===== MES ARTICLES PROPOSES ===== */
.my-articles-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.my-articles-item:last-child {
  border-bottom: none;
}

.badge-a-valider {
  display: inline-block;
  background: #f57c00;
  color: white;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-valide {
  display: inline-block;
  background: #2e7d32;
  color: white;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ===== FEEDBACK TYPE TOGGLE ===== */
.feedback-type-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.feedback-type-btn {
  flex: 1;
  padding: 0.4rem 0.5rem;
  border: 2px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  background: transparent;
  color: var(--pico-muted-color);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: unset;
}

.feedback-type-btn.active {
  border-color: var(--pico-primary);
  color: var(--pico-primary);
  background: var(--pico-primary-focus);
}

.feedback-type-btn[data-type="bug"].active {
  border-color: #d32f2f;
  color: #d32f2f;
  background: #ffebee;
}

/* ===== FEEDBACK TYPE BADGES (admin) ===== */
.badge-bug {
  display: inline-block;
  background: #d32f2f;
  color: white;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.25rem;
}

.badge-suggestion {
  display: inline-block;
  background: var(--pico-primary);
  color: white;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 0.25rem;
}

@media (max-width: 768px) {
  /* Hamburger visible, aligné à droite */
  nav .nav-toggle-label {
    display: block !important;
    margin-left: auto;
    order: 2;
  }

  /* Liens cachés par défaut */
  .nav-links {
    display: none !important;
    flex-direction: column;
    width: 100%;
    padding: 0;
    order: 3;
  }

  /* Liens affichés quand toggle activé */
  .nav-toggle:checked ~ .nav-links {
    display: flex !important;
  }

  .nav-links li {
    width: 100%;
    text-align: center;
    padding: 0.25rem 0;
  }

  nav {
    flex-wrap: wrap;
  }

  /* Grilles en colonne unique sauf catégories */
  .grid {
    grid-template-columns: 1fr !important;
  }

  /* Catégories : 3 colonnes compactes sur mobile */
  .category-cards {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
  }

  .category-card {
    min-height: 60px;
    padding: 0.5rem 0.25rem;
  }

  .category-card-icon {
    font-size: 1.5rem;
  }

  .category-card-name {
    font-size: 0.75rem;
  }

  /* Boutons tactiles */
  button, [role="button"], input[type="submit"] {
    min-height: 44px;
    padding: 0.75rem 1rem;
  }

  /* Empêche le zoom iOS/Android sur les inputs */
  input, select, textarea {
    font-size: 16px;
  }

  /* Cards accueil en colonne */
  .home-grid {
    grid-template-columns: 1fr;
  }

  /* Filtres pleine largeur sur mobile */
  .filters {
    flex-direction: column;
  }

  .filters label {
    min-width: unset;
    width: 100%;
  }

  .filters button {
    width: 100%;
  }

  /* Tableaux scrollables sur mobile */
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
  }

  .table-scroll table {
    min-width: 480px;
  }

  table button {
    font-size: 0.8rem !important;
    padding: 0.3rem 0.5rem !important;
    white-space: nowrap;
  }

  /* Bandeau section — pas sticky sur mobile */
  .section-header {
    position: relative;
    margin: 1rem -1rem 0.5rem;
  }

  /* Comment form : stack vertical sur mobile */
  .comment-form-row {
    flex-direction: column;
  }

  .comment-form-row select {
    max-width: none;
    width: 100%;
  }

  /* Labels plus compacts sur mobile */
  label {
    margin-bottom: 0.5rem;
  }

  /* Formulaire de demande compact */
  article {
    padding: 0.75rem;
  }

  /* Compteur plus compact sur mobile */
  .compteur-attente {
    padding: 1rem 0.5rem;
  }

  .compteur-attente .compteur-nombre {
    font-size: 2.5rem;
  }

  /* Details (traiter demande) */
  details summary {
    padding: 0.5rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* User info responsive */
  .user-info {
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0;
  }

  .logout-btn {
    min-height: 44px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  /* Emoji input — pas de max-width contraint sur mobile */
  input[maxlength="2"] {
    max-width: none !important;
    width: 100% !important;
    font-size: 1.5rem !important;
    text-align: center;
  }

  /* Panel feedback pleine largeur sur mobile */
  .feedback-panel {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 4.5rem;
    width: auto;
  }

  .feedback-fab {
    bottom: 1rem;
    right: 1rem;
  }

  /* Toast pleine largeur sur mobile */
  .toast-container {
    left: 1rem;
    right: 1rem;
    max-width: none;
  }
}
