:root {
  --bg: #f5f7fa;
  --bg-elevated: #ffffff;
  --border-subtle: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --accent: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.08);
  --danger: #ef4444;
  --warning: #f59e0b;
    --success: #4bf367;
  --info: #8073f9;
  --radius-lg: 1.1rem;
  --radius-md: 0.75rem;
  --radius-sm: 0.5rem;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.12);
  --shadow-subtle: 0 8px 20px rgba(15, 23, 42, 0.06);
  --sidebar-width: 260px;
}

[data-theme="dark"] {
  --bg: #0b1020;
  --bg-elevated: #151a2c;
  --border-subtle: #1f2937;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --accent: #8b5cf6;
  --accent-soft: rgba(139, 92, 246, 0.12);
  --danger: #f97373;
  --success: #4bf367;
  --info: #8073f9;
  --warning: #fbbf24;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.6);
  --shadow-subtle: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* Reset simple */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  background: radial-gradient(circle at top left, #e0e7ff 0, var(--bg) 40%);
  color: var(--text);
}
body.login-page {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: radial-gradient(circle at top left, #dbeafe 0, var(--bg) 40%);
  color: var(--text);
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-container {
  width: 100%;
  max-width: 440px;
  padding: 1rem;
}

.login-card {
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  padding: 3.2rem 3rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  margin-top: 0.5rem;
}

.form-field {
  text-align: left;
}

.form-field label {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.95rem;
  font-weight: 500;
}

.form-field input {
  width: 100%;
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: 0.2s ease;
}

[data-theme="dark"] .form-field input {
  background: rgba(255, 255, 255, 0.08);
}

.form-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.checkbox-field {
  display: flex;
  align-items: center;
}

.checkbox-field label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.btn-login {
  width: 100%;
  padding: 1rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #4f46e5, #0ea5e9);
  color: white;
  font-size: 1.05rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: 0.2s ease;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.5);
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(37, 99, 235, 0.7);
}
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
}

.theme-toggle button {
  border: none;
  background: var(--card-bg);
  border-radius: 999px;
  width: 42px;
  height: 42px;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: 0.2s ease;
}

.theme-toggle button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}



/* Layout principal */
.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #020617, #020617 40%, #020617);
  color: #e5e7eb;
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.25rem 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 1rem;
  background: radial-gradient(circle at 20% 0, #4f46e5, #0ea5e9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: white;
  box-shadow: 0 12px 30px rgba(59, 130, 246, 0.6);
}

.logo-text {
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.nav-item {
  border: none;
  background: transparent;
  color: #cbd5f5;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.nav-item i {
  font-size: 1.2rem;
}

.nav-item:hover {
  background: rgba(148, 163, 184, 0.18);
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(90deg, #4f46e5, #0ea5e9);
  color: white;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.7);
}

/* Sidebar footer */
.sidebar__footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 0.75rem;
  color: #9ca3af;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.uf-select label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
}

.uf-select select {
  width: 100%;
  border-radius: 0.6rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: #020617;
  color: #e5e7eb;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
}

/* Main */
.main {
  flex: 1;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-subtle);
}

[data-theme="dark"] .header {
  background: rgba(15, 23, 42, 0.9);
}

.header__left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header__title {
  font-size: 1.1rem;
  font-weight: 600;
}

.header__center {
  flex: 1;
}

.header__right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Search */
.search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border-subtle);
}

.search input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 0.9rem;
  color: var(--text);
}

.search i {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.search--small {
  max-width: 260px;
}

/* User */
.user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user__info {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
}

.user__name {
  font-weight: 500;
}

.user__role {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.user__avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, #4f46e5, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: white;
  font-weight: 600;
}

/* Icon button */
.icon-button {
  border: none;
  background: var(--bg-elevated);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.icon-button:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
}

/* Content */
.content {
  flex: 1;
  padding: 1.25rem 0.25rem 1.5rem;
}

.view {
  display: none;
}

.view--active {
  display: block;
}

.view h2 {
  margin: 0 0 0.25rem;
  font-size: 1.3rem;
}

.view-subtitle {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Dashboard / desktop-like tiles */
.desktop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.tile {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.2rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.tile i {
  font-size: 1.8rem;
  color: var(--accent);
}

.tile span {
  font-weight: 600;
  font-size: 0.98rem;
}

.tile p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.25);
  border-color: var(--accent-soft);
}

.tile--small {
  padding: 1rem 0.9rem;
  box-shadow: var(--shadow-subtle);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-field label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.form-field input,
.form-field select,
.form-field textarea {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
  background: var(--bg-elevated);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form-field textarea {
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

/* Buttons */
.btn {
  border-radius: 999px;
  border: none;
  padding: 0.55rem 1.2rem;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #0ea5e9);
  color: white;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.6);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(37, 99, 235, 0.8);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Table */
.table {
  margin-top: 1rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.table__header,
.table__row {
  display: grid;
  grid-template-columns: 1.2fr 2fr 0.7fr 1.2fr 0.8fr;
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  align-items: center;
}

.table__header {
  background: var(--accent-soft);
  font-weight: 600;
}

.table__row:nth-child(odd) {
  background: rgba(148, 163, 184, 0.05);
}

.table__actions {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-start;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 0.9rem 0.9rem;
  border: 1px solid var(--border-subtle);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat-value {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.4rem;
  font-weight: 600;
}

.stat-value--warning {
  color: var(--warning);
}

.stat-value--danger {
  color: var(--danger);
}

/* Admin grid */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -260px;
    z-index: 20;
    transition: left 0.2s ease;
  }

  .sidebar--open {
    left: 0;
  }

  .main {
    padding: 1rem;
  }

  .header {
    flex-wrap: wrap;
  }

  .header__center {
    order: 3;
    width: 100%;
  }
}

/* ════════════════════════════════════════════════════════════════
   MODAL EDIT — DESIGN MATCH
   ════════════════════════════════════════════════════════════════ */

.modal-overlay-edit {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.modal-edit {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    width: 480px;
    max-width: 95vw;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
    animation: modalFadeIn 0.25s ease-out;
}

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

.modal-edit-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-edit-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-edit-body {
    padding: 1.25rem 1.25rem 1.5rem;
}

.modal-edit .form-field input:disabled {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
}

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 12px 30px rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 40px rgba(239, 68, 68, 0.6);
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-subtle);
    z-index: 50;
    display: none;
}

.autocomplete-item {
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.autocomplete-item:hover {
    background: var(--accent-soft);
}


.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(2px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.modal-box {
    background: white;
    padding: 25px 30px;
    border-radius: 10px;
    width: 350px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    animation: pop 0.25s ease-out;
}

.modal-btn {
    margin-top: 15px;
    padding: 10px 20px;
    background: #007bff;
    border: none;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
}

.modal-btn:hover {
    opacity: 0.9;
}

@keyframes pop {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

#modal-new-order {
    position: fixed !important;
    z-index: 2147483647 !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
}


/* ════════════════════════════════════════
   MENU DÉROULANT COMMANDES
   ════════════════════════════════════════ */

.nav-item-dropdown {
    position: relative;
    display: inline-block;
}

/* Bouton principal avec flèche */
.nav-item-dropdown .nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-arrow {
    margin-left: auto;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.nav-item-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Container du menu déroulant */
.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    margin-top: 0.5rem;
    overflow: hidden;
}

.nav-item-dropdown.active .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Items du dropdown */
.dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #64748b;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: #f1f5f9;
    color: #0ea5e9;
}

.dropdown-item:active {
    transform: scale(0.98);
}

.dropdown-item i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.dropdown-item span {
    flex: 1;
}

/* Séparateur optionnel */
.dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0.25rem 0;
}

/* Animation au survol du bouton principal */
.nav-item-dropdown .nav-item:hover {
    background: #f1f5f9;
    color: #0ea5e9;
}

/* État actif sur un item du dropdown */
.dropdown-item.active {
    background: #e0f2fe;
    color: #0ea5e9;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .dropdown-content {
        position: fixed;
        left: 0;
        right: 0;
        top: auto;
        bottom: 0;
        transform: translateY(100%);
        border-radius: 16px 16px 0 0;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .nav-item-dropdown.active .dropdown-content {
        transform: translateY(0);
    }
}


/* ════════════════════════════════════════
   TOAST AVEC BOUTON D'ACTION
   ════════════════════════════════════════ */

.stock-alert-toast {
    cursor: default;
    font-family: inherit;
}

.stock-alert-toast i.bx:first-child {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stock-alert-toast span {
    flex: 1;
}

.toast-action-btn {
    margin-left: auto;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.toast-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateX(2px);
}

.toast-action-btn:active {
    transform: translateX(2px) scale(0.98);
}

.toast-action-btn i {
    font-size: 1.1rem;
}

/* Animation d'entrée */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Animation de sortie */
@keyframes slideDown {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
}

/* ═══════════════════════════════════════════════════════════
   ANALYSIS CARDS (Récapitulatifs)
   ═══════════════════════════════════════════════════════════ */

.analysis-card {
    position: relative;
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.analysis-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, currentColor, transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.analysis-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.analysis-card:hover::before {
    opacity: 0.3;
}

.analysis-icon {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.analysis-card:hover .analysis-icon {
    transform: scale(1.1) rotate(5deg);
}

.analysis-content {
    flex: 1;
    min-width: 0;
}

.analysis-arrow {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.3s ease;
}

.analysis-card:hover .analysis-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Responsive */
@media (max-width: 768px) {
    .analysis-card {
        flex-direction: column;
        text-align: center;
    }
    
    .analysis-icon {
        margin: 0 auto;
    }
    
    .analysis-arrow {
        display: none;
    }
}


/* ═══════════════════════════════════════════════════════════════
   GRAPHIQUES - CONTENEURS
   ═══════════════════════════════════════════════════════════════ */

.charts-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
}

/* Grille pour les graphiques côte à côte */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 992px) {
    .charts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ═══════════════════════════════════════════════════════════════
   CARTES DE GRAPHIQUES
   ═══════════════════════════════════════════════════════════════ */

.stat-card--full {
    grid-column: 1 / -1;
}

.stat-card__header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.stat-card__header h3 i {
    font-size: 1.3rem;
    color: var(--primary-color, #3b82f6);
}

.stat-card__body {
    padding: 1.5rem;
}

/* ═══════════════════════════════════════════════════════════════
   CONTENEURS DE CANVAS CHART.JS
   ═══════════════════════════════════════════════════════════════ */

.chart-container {
    position: relative;
    width: 100%;
    min-height: 500px;
    height: 500px;
}

.chart-container--medium {
    min-height: 450px;
    height: 450px;
}

/* Force le canvas à respecter le conteneur */
.chart-container canvas {
    max-height: 100% !important;
    width: 100% !important;
}

/* ═══════════════════════════════════════════════════════════════
   ÉTAT DE CHARGEMENT
   ═══════════════════════════════════════════════════════════════ */

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    color: var(--text-secondary, #64748b);
}

.loading-state p {
    margin-top: 1rem;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Spinner */
.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color, #e2e8f0);
    border-top-color: var(--primary-color, #3b82f6);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE - MOBILE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .chart-container {
        min-height: 350px;
        height: 350px;
    }
    
    .chart-container--medium {
        min-height: 320px;
        height: 320px;
    }
    
    .stat-card__body {
        padding: 1rem;
    }
    
    .stat-card__header h3 {
        font-size: 1rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   AMÉLIORATION VISUELLE DES GRAPHIQUES
   ═══════════════════════════════════════════════════════════════ */

/* Éviter les débordements */
.stat-card {
    overflow: hidden;
}

/* Améliorer la lisibilité des tooltips */
.chartjs-tooltip {
    opacity: 1 !important;
}

/* Style pour les messages d'erreur */
.chart-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    color: var(--danger-color, #ef4444);
    text-align: center;
    padding: 2rem;
}

.chart-error i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.chart-error p {
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════════
   VARIABLES CSS (si non définies ailleurs)
   ═══════════════════════════════════════════════════════════════ */

/* Badge d'agrégation */
.aggregation-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.aggregation-badge i {
    font-size: 1.1rem;
}

/* ═══════════════════════════════════════════════════════════════
   BOUTON CHANGER DE PRODUIT - STYLE MODERNE
   ═══════════════════════════════════════════════════════════════ */

.btn-clear-product {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.25);
    position: relative;
    overflow: hidden;
}

.btn-clear-product::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-clear-product:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.35);
}

.btn-clear-product:hover::before {
    left: 100%;
}

.btn-clear-product:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.btn-clear-product i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.btn-clear-product:hover i {
    transform: rotate(180deg);
}

/* Variante rouge pour action de suppression/changement */
.btn-clear-product.variant-danger {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 6px rgba(245, 87, 108, 0.25);
}

.btn-clear-product.variant-danger:hover {
    box-shadow: 0 6px 12px rgba(245, 87, 108, 0.35);
}

/* Variante neutre */
.btn-clear-product.variant-neutral {
    background: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%);
    box-shadow: 0 4px 6px rgba(102, 166, 255, 0.25);
}

.btn-clear-product.variant-neutral:hover {
    box-shadow: 0 6px 12px rgba(102, 166, 255, 0.35);
}

/* Version compacte */
.btn-clear-product.compact {
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
}

.btn-clear-product.compact i {
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .btn-clear-product span {
        display: none;
    }
    
    .btn-clear-product {
        padding: 0.6rem;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        justify-content: center;
    }
    
    .btn-clear-product i {
        margin: 0;
    }
}
