@import url("snowflakes.css");

:root {
  --theme-font-family: "Roboto", sans-serif;
  --theme-body-color: #ffffff;
  --theme-body-background: #262626;
  --theme-navbar-background: #101010 !important;
  --theme-button-color: #333333;
  --theme-button-background: #ef9526;
  --theme-button-second-color: #000000;
  --theme-button-second-background: #ffffff;
  --theme-button-second-background-2: #dfdfdf;
  --theme-dropdown-background: #262626;

  --primary: #ef9526;
  --primary-dark: #d68321;
  --secondary: #ffffff;
  --secondary-dark: #dfdfdf;
  --bg-dark: #101010;
  --bg-darker: #0a0a0a66;
  --bg-light: #1a1a1a;
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.85);
  --glass: rgba(40, 40, 40, 0.59);
  --glass-border: rgba(115, 115, 115, 0.601);
  --gold: #d4af37;
  --warning: #ff4747;
  --warning-hover: #ac3838;
  --forecast: #e74c3c;
  --navbar-height: 60px;
  --footer-height: 60px;
  --transition-speed: 0.25s;

  --trend-up: #4caf50;
  --trend-down: #f44336;
  --trend-stable: #ef9526;

  /* nouveau : variables utilitaires */
  --blur-amount: 1px;
  --card-radius: 6px;
  --card-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

/* unified radius variables (global) */
:root {
  --radius: 10px;
  --radius-pill: var(--radius);
  --radius-sm: 10px;
  --radius-lg: 18px;
  /* keep legacy var for compatibility */
  --card-radius: var(--radius);
}

/* Ensure main surfaces use the global radius */
.navbar,
.sidebar,
.stats-container,
.chart-container,
.modal-content,
.footer {
  border-radius: var(--card-radius) !important;
}

/* Pills, items and buttons use pill radius */
.nav-pill,
.pill,
.item,
.stat-box-main,
.stat-card,
.stat-box,
.btn,
.btn-primary,
.filters-btn,
#excludedItemsBtn,
.chart-title {
  border-radius: var(--radius-pill) !important;
}

/* Small controls use small radius */
.sort-selector,
#search,
.toggle-switch,
.filter-item-tag,
.modal-close {
  border-radius: var(--radius-sm) !important;
}

/* Larger decorative elements (where 18px was used) */
.chart-container.large,
.modal-content.large {
  border-radius: var(--radius-lg) !important;
}

/* Fallbacks to keep consistent look if other rules set radius */
*[style*="border-radius"] {
  border-radius: inherit;
}

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

body {
  font-family: var(--theme-font-family);
  color: var(--text);
  padding-top: var(--navbar-height);
  padding-bottom: var(--footer-height);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  overflow-x: hidden;
}

/* Wallpaper overlay */
body[class^="wallpaper-"]::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.15);
  pointer-events: none;
  z-index: 0;
}

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

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  margin: 10px 10px 0px 10px;
  background: var(--glass);
  backdrop-filter: blur(15px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  z-index: 1000;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.5s ease-out;
}

.navbar-title {
  font-size: 1.5em;
  font-weight: 600;
  background: linear-gradient(90deg, var(--primary), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: all var(--transition-speed) ease;
}

.navbar-title:hover {
  text-shadow: 0 2px 15px rgba(239, 149, 38, 0.5);
}

.navbar-link {
  color: var(--text);
  text-decoration: none;
  font-family: "Fira Code", monospace;
  font-size: 14px;
  transition: all var(--transition-speed) ease;
  position: relative;
}

.navbar-link:hover {
  color: var(--primary);
}

/* navbar actions group (links on the right) */
.nav-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-left: auto;
}

/* pill style for nav links */
.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--card-radius);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  /* box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); */
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

/* small icon inside pill */
.nav-pill .nav-icon {
  font-size: 14px;
  opacity: 0.95;
  display: inline-block;
  line-height: 1;
}

/* hide text on very small screens to save space */
@media (max-width: 480px) {
  .nav-pill .nav-text {
    display: none;
  }
  .nav-actions {
    gap: 8px;
  }
  .nav-pill {
    padding: 8px;
  }
}

/* hover / focus states */
.nav-pill:hover,
.nav-pill:focus {
  transform: translateY(-2px);
  background: linear-gradient(
    90deg,
    rgba(239, 149, 38, 0.12),
    rgba(251, 191, 36, 0.08)
  );
  box-shadow: 0 10px 26px rgba(239, 149, 38, 0.08);
  border-color: rgba(239, 149, 38, 0.18);
  outline: none;
}

/* make gradient-link more visible */
.gradient-link {
  background: linear-gradient(90deg, #ffd580, #f59e0b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
  text-decoration: none;
}
.gradient-link:hover {
  filter: brightness(1.05);
  text-decoration: underline;
}

/* accessible focus ring */
.nav-pill:focus-visible {
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

/* Main Layout */
.main-container {
  display: flex;
  gap: 15px;
  height: calc(100vh - var(--navbar-height) - var(--footer-height) - 40px);
  padding: 0 10px;
  opacity: 0;
  animation: fadeIn 0.5s ease-out forwards;
  margin-top: 25px;
  padding-bottom: 10px;
  position: relative;
  z-index: 1;
}

/* Sidebar */
.sidebar {
  width: 330px;
  height: calc(100vh - var(--navbar-height) - var(--footer-height) - 100px);
  display: flex;
  flex-direction: column;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 15px;
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  transition: all var(--transition-speed) ease;
  overflow: hidden;
}

.sidebar:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.sidebar-header {
  flex-shrink: 0;
}

.sidebar-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.items-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#reliable-items-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-dark) var(--bg-darker);
  margin-top: 5px;
  margin-bottom: 10px;
}

#lowdata-items-container {
  flex: 0 1 auto;
  max-height: 150px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--warning) var(--bg-darker);
}

.stats-container {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 15px;
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  gap: 6px;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-speed) ease;
}

.stats-container:hover {
  background: rgba(40, 40, 40, 0.5);
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(239, 149, 38, 0.1);
  border-radius: 6px;
  font-size: 13px;
  transition: all var(--transition-speed) ease;
}

.stat-item:hover {
  background: rgba(239, 149, 38, 0.2);
  transform: translateY(-1px);
}

.stat-item .value {
  font-weight: 600;
  color: var(--gold);
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 10px;
  padding-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  transition: all var(--transition-speed) ease;
}

.section-title:hover::after {
  width: 50%;
}

.section-title.warning {
  color: var(--warning);
}

.section-title.warning::after {
  background: var(--warning);
}

.sort-container {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}

.sort-selector {
  padding: 6px 10px;
  background: var(--bg-darker);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-family: "Fira Code", monospace;
  cursor: pointer;
  flex: 1;
  transition: all var(--transition-speed) ease;
}

.sort-selector:hover {
  border-color: var(--primary);
}

#search {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 10px;
  background: var(--bg-darker);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-family: "Fira Code", monospace;
  transition: all var(--transition-speed) ease;
}

#search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(239, 149, 38, 0.2);
  outline: none;
}

.items-container::-webkit-scrollbar {
  width: 6px;
}

.items-container::-webkit-scrollbar-thumb {
  background: var(--primary-dark);
  border-radius: 3px;
}

#lowdata-items-container::-webkit-scrollbar-thumb {
  background: var(--warning);
}

.item {
  max-height: 40px;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 6px;
  margin-bottom: 5px;
  font-family: "Fira Code", monospace;
  font-size: 13px;
  transition: all var(--transition-speed) ease;
  background: rgba(40, 40, 40, 0.4);
  border-left: 2px solid transparent;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  position: relative;
  margin: 0px 6px 0px 0px;
  overflow: hidden;
}

.item-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  max-width: 70%;
}

#lowdata-items-container .item {
  padding: 6px 8px;
  font-size: 12px;
}

#lowdata-items-container .item-sales {
  font-size: 10px;
  padding: 1px 4px;
  opacity: 0.7;
  background: rgba(255, 209, 102, 0.2);
  border-radius: 10px;
}

.item:hover {
  background: rgba(239, 149, 38, 0.15);
  transform: translateX(2px);
}

.item.selected {
  background: var(--primary);
  color: var(--bg-dark);
  border-left-color: var(--primary-dark);
  font-weight: 500;
  box-shadow: 0 2px 5px rgba(239, 149, 38, 0.3);
}

.item.low-data {
  opacity: 0.75;
}

.item.low-data:hover {
  background: rgba(255, 209, 102, 0.2);
  transform: translateX(2px);
}

.item.low-data.selected {
  border-left-color: var(--gold);
  background: rgba(255, 109, 25, 0.832);
  transform: translateX(2px);
  color: #fff;
  box-shadow: 0 2px 5px rgba(255, 209, 102, 0.2);
}

.item.low-data::before {
  content: "⚠️";
  color: var(--warning);
  position: absolute;
  left: 6px;
  font-size: 11px;
}

.item.low-data .item-name {
  padding-left: 15px;
}

.item-sales {
  font-size: 11px;
  opacity: 0.7;
  background: rgba(239, 149, 38, 0.15);
  padding: 1px 6px;
  border-radius: 12px;
  font-family: var(--theme-font-family);
  transition: all var(--transition-speed) ease;
}

.item-sales:hover {
  opacity: 1;
  background: rgba(239, 149, 38, 0.3);
}

/* Charts */
#charts {
  width: calc(100% - 295px);
  display: flex;
  flex-direction: column;
  gap: 15px;
  opacity: 0;
  animation: fadeIn 0.7s ease-out forwards;
}

.chart-container {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 15px;
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  flex: 1;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-speed) ease;
}

.chart-container:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.chart-title {
  color: var(--primary);
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  transition: all var(--transition-speed) ease;
}

.chart-title:hover::after {
  width: 40%;
}

.chart-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 10px;
  font-family: "Fira Code", monospace;
  font-size: 12px;
}

.stat-box {
  text-align: center;
  padding: 6px 8px;
  background: rgba(239, 149, 38, 0.15);
  border-radius: 4px;
  min-width: 100px;
  transition: all var(--transition-speed) ease;
}

.stat-box:hover {
  background: rgba(239, 149, 38, 0.3);
  transform: translateY(-2px);
}

.stat-box .value {
  font-weight: 600;
  color: var(--gold);
  font-size: 14px;
}

.stat-box-main {
  text-align: center;
  padding: 16px 12px 8px;
  background: rgba(239, 149, 38, 0.18);
  border-radius: 6px;
  min-width: 120px;
  transition: all var(--transition-speed) ease-in-out;
  border: 1px solid rgba(239, 149, 38, 0.25);
  position: relative;
}

.stat-box-main::before {
  content: attr(data-label);
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(239, 149, 38, 0.9);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: var(--label-display, block);
}

.stat-box-main:not([data-label])::before {
  display: none !important;
}

.stat-box-main:hover {
  background: rgba(239, 149, 38, 0.246);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 149, 38, 0.2);
  transition: all var(--transition-speed) ease-in-out;
}

.stat-box-main:hover::before {
  background: rgba(239, 149, 38, 1);
}

.stat-box-main .value {
  font-weight: 700;
  color: var(--gold);
  font-size: 18px;
  line-height: 1.2;
  margin-top: 4px;
}

.stat-box-main .label {
  font-size: 11px;
  color: rgba(239, 149, 38, 0.85);
  font-weight: 500;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.chart-wrapper {
  flex: 1;
  min-height: 0;
  position: relative;
  margin-bottom: 10px;
}

canvas {
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
}

.forecast-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-family: "Fira Code", monospace;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}

.forecast-toggle:hover {
  color: var(--forecast);
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 20px;
  background: var(--bg-darker);
  border-radius: 1px;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  transition: all var(--transition-speed) ease;
}

.toggle-switch.active {
  background: var(--forecast);
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition-speed) ease;
}

.toggle-switch.active::after {
  transform: translateX(20px);
}

/* Footer */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-height);
  margin: 15px 10px 0px 10px;
  background: var(--glass);
  backdrop-filter: blur(15px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 20px;
  z-index: 1000;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.5s ease-out;
  margin-bottom: 10px;
}

.footer-content {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-left,
.footer-right {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.footer-right {
  text-align: right;
}

.footer-disclaimer {
  font-style: italic;
}

.footer-copyright {
  font-family: "Fira Code", monospace;
  display: flex;
  align-items: center;
  gap: 5px;
}

.footer-highlight {
  font-weight: 600;
  background: linear-gradient(90deg, var(--primary), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}

.footer-highlight:hover {
  text-shadow: 0 1px 8px rgba(239, 149, 38, 0.5);
}

.gradient-link {
  font-weight: 600;
  background: linear-gradient(90deg, var(--primary), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
  transition: text-shadow var(--transition-speed) ease;
}

.gradient-link:hover {
  text-shadow: 0 1px 8px rgba(239, 149, 38, 0.5);
}
#trend-arrow {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  animation: pulse 0.6s ease-in-out;
}

#trend-arrow svg {
  transition: all 0.3s ease;
}

/* ===== MODAL FILTRES ===== */

.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  /* background-color: rgba(0, 0, 0, 0.6); */
  /* backdrop-filter: blur(4px); */
  animation: fadeIn 0.3s ease-out;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
  backdrop-filter: blur(10px);
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(40, 40, 40, 0.3);
}

.modal-header h2 {
  margin: 0;
  color: var(--primary);
  font-size: 1.3em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text);
  font-size: 28px;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.modal-close:hover {
  background: rgba(239, 149, 38, 0.2);
  color: var(--primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(80vh - 80px);
}

.filters-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-category {
  background: rgba(40, 40, 40, 0.4);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 12px;
  transition: all var(--transition-speed) ease;
}

.filter-category:hover {
  background: rgba(40, 40, 40, 0.6);
  border-left-color: var(--gold);
}

.filter-category-title {
  margin: 0 0 10px 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-items-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-item-tag {
  background: rgba(239, 149, 38, 0.15);
  border: 1px solid rgba(239, 149, 38, 0.3);
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-family: "Fira Code", monospace;
  transition: all var(--transition-speed) ease;
  cursor: default;
}

.filter-item-tag:hover {
  background: rgba(239, 149, 38, 0.25);
  border-color: rgba(239, 149, 38, 0.5);
  color: var(--text);
}

.filters-btn {
  background: rgba(239, 149, 38, 0.15);
  border: 1px solid rgba(239, 149, 38, 0.3);
  color: var(--primary);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed) ease;
}

.filters-btn:hover {
  background: rgba(239, 149, 38, 0.3);
  border-color: rgba(239, 149, 38, 0.6);
  transform: scale(1.05);
}

.filters-btn:active {
  transform: scale(0.95);
}

/* Animations de gauche à droite */
@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.item-name-header {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 15px;
  padding: 10px 0;
  border-bottom: 2px solid var(--primary);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.chart-container {
  animation: slideInFromLeft 0.6s ease-out;
}

.stats-container {
  animation: slideInFromLeft 0.5s ease-out;
}

/* Disclaimer dans la navbar */
.navbar-disclaimer {
  font-size: 12px;
  color: #fff;
  margin-left: 10px;
  font-style: italic;
}

/* Modal style amélioré */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.modal-content {
  background-color: #1e1e1e;
  margin: 5% auto;
  padding: 20px;
  border: 1px solid #ef9526;
  width: 80%;
  max-width: 600px;
  border-radius: 5px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  color: #ffffff;
}

.modal-disclaimer {
  font-size: 12px;
  color: #ef9526;
  margin-bottom: 10px;
}

.close {
  color: #ef9526;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: #ffffff;
  text-decoration: none;
}

.excluded-items-list {
  max-height: 400px;
  overflow-y: auto;
  list-style-type: none;
  padding: 0;
}

.excluded-items-list li {
  margin: 5px 0;
  padding: 3px;
  color: #cccccc;
  border-bottom: 1px solid #333;
  text-transform: capitalize;
}

.excluded-items-list li:hover {
  color: #ffffff;
  background-color: #333;
}

.modal-title {
  color: #ef9526;
  border-bottom: 1px solid #ef9526;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

/* Button to toggle excluded items */
#excludedItemsBtn {
  position: fixed;
  top: 10px;
  right: 10px;
  padding: 4px;
  background: var(--warning);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  z-index: 9999;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease-in-out;
  font-size: 10px;
}

#excludedItemsBtn:hover {
  background: var(--warning-hover);
  transition: all 0.3s ease-in-out;
}

.time-filter-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.time-filter-btn {
  padding: 4px 8px;
  border: none;
  background: var(--background-secondary);
  color: var(--text-primary);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.time-filter-btn.active {
  background: var(--primary);
  color: white;
}

/* === Utilities / Surface common === */
.surface {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--card-radius);
  backdrop-filter: blur(var(--blur-amount));
  box-shadow: var(--card-shadow);
  transition: all var(--transition-speed) ease;
}

.card {
  padding: 12px;
  border-radius: var(--card-radius);
  background: rgba(255, 255, 255, 0.02);
}

/* appliquer le style commun aux éléments "surface" (regroupe les duplications) */
.navbar,
.sidebar,
.stats-container,
.chart-container,
.modal-content,
.footer {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--card-radius);
  backdrop-filter: blur(var(--blur-amount));
  box-shadow: var(--card-shadow);
  transition: all var(--transition-speed) ease;
}

/* helpers layout */
.u-flex {
  display: flex;
}
.u-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.u-gap-8 {
  gap: 8px;
}
.u-gap-12 {
  gap: 12px;
}
.u-col {
  display: flex;
  flex-direction: column;
}

/* boutons / pill */
.btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}
.btn-primary {
  background: var(--primary);
  color: #000;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--glass-border);
}

/* toggle switch (réutilisable) */
.toggle-switch {
  position: relative;
  width: 40px;
  height: 20px;
  background: var(--bg-darker);
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  transition: all var(--transition-speed) ease;
}
.toggle-switch.active {
  background: var(--forecast);
}
.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: var(--radius-sm);
  transition: transform var(--transition-speed) ease;
}
.toggle-switch.active::after {
  transform: translateX(20px);
}

/* compact controls layout */
.controls-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.controls-left {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Responsive */
@media (max-width: 1200px) {
  .main-container {
    flex-direction: column;
    height: auto;
  }

  .sidebar,
  #charts {
    width: 100%;
  }

  .chart-wrapper {
    height: 300px;
  }

  .footer-content {
    flex-direction: column;
    gap: 5px;
    text-align: center;
  }

  /* Responsive - Correction pour les histogrammes */
  .chart-wrapper canvas {
    min-height: 250px !important;
  }

  .chart-container {
    padding: 10px;
  }

  .chart-container .chart-title {
    font-size: 14px;
  }

  #histogram-chart {
    min-height: 250px !important;
  }
}

@media (max-width: 768px) {
  .stats-container {
    display: none;
  }

  .chart-stats {
    flex-wrap: wrap;
    gap: 8px;
  }

  .stat-box-main {
    min-width: 80px;
    padding: 10px 6px;
  }

  .chart-wrapper canvas {
    min-height: 200px !important;
  }

  .chart-container {
    margin-bottom: 10px;
  }

  .sidebar {
    width: 100%;
    height: 60vh;
  }

  #reliable-items-container {
    max-height: 200px;
  }

  #lowdata-items-container {
    max-height: 90px;
  }

  .item {
    max-height: 35px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .item-name {
    max-width: 60%;
  }
}

/* Gradients Minecraft */
.item span {
  display: inline-block;
  transition: all 0.2s ease;
}

.item:hover span {
  text-shadow: 0 0 5px currentColor;
  transform: scale(1.05);
}

#item-name-header span {
  font-weight: 600;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

#item-name-header:hover span {
  text-shadow: 0 0 10px currentColor, 1px 1px 2px rgba(0, 0, 0, 0.7);
}

/* No-data message for price chart */
.no-data-message {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 22px;
  color: #ffffff;
  min-height: 120px;
  text-align: center;
  gap: 8px;
  z-index: 2;
}

.no-data-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #fff;
}

.no-data-hr {
  width: 60%;
  height: 1px;
  border: none;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0.06)
  );
  margin: 6px 0;
  border-radius: 2px;
}

.no-data-body {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  max-width: 320px;
}

/* ensure the message sits above the canvas area */
.chart-wrapper {
  position: relative;
}
.chart-wrapper .no-data-message {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 80%;
  max-width: 520px;
  pointer-events: none;
}

/* Pill theme: harmonise tout le UI avec le style des nav-pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(0, 0, 0, 0.12)
  );
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

/* Pill accent (used for stats / important labels) */
.pill-accent {
  background: linear-gradient(
    90deg,
    rgba(239, 149, 38, 0.12),
    rgba(251, 191, 36, 0.06)
  );
  border-color: rgba(239, 149, 38, 0.14);
  box-shadow: 0 6px 18px rgba(239, 149, 38, 0.04);
}

/* Apply pill feel to sidebar items */
.item {
  border-radius: 999px;
  padding: 10px 14px;
  margin: 6px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.01),
    rgba(0, 0, 0, 0.06)
  );
  border: 1px solid rgba(255, 255, 255, 0.03);
  box-shadow: none;
}
.item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  background: linear-gradient(
    90deg,
    rgba(239, 149, 38, 0.12),
    rgba(0, 0, 0, 0.04)
  );
}
.item.selected {
  background: linear-gradient(
    90deg,
    rgba(239, 149, 38, 0.18),
    rgba(251, 191, 36, 0.06)
  );
  color: var(--primary);
  border-color: rgba(239, 149, 38, 0.28);
  box-shadow: 0 8px 24px rgba(239, 149, 38, 0.08);
}

/* Make stat boxes pill-like */
.stat-box-main,
.stat-card,
.stat-box {
  border-radius: 999px;
  padding: 10px 16px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.03);
  min-width: 100px;
}
.stat-box-main .value,
.stat-card .value,
.stat-box .value {
  font-weight: 700;
  color: var(--primary);
}

/* Chart cards -> rounded large pills (soft) */
.chart-container,
.stats-container,
.sidebar,
.modal-content,
.footer,
.navbar {
  border-radius: 18px;
}

/* chart inner card pill bar (title area) */
.chart-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.02),
    rgba(0, 0, 0, 0.04)
  );
  border: 1px solid rgba(255, 255, 255, 0.03);
  font-weight: 600;
}

/* buttons -> pill */
.btn,
.btn-primary,
.filters-btn,
#excludedItemsBtn {
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

/* toggle switch inside pill style */
.toggle-switch {
  border-radius: 999px;
  width: 44px;
  height: 24px;
  padding: 2px;
}
.toggle-switch::after {
  width: 18px;
  height: 18px;
}

/* modal content refine */
.modal-content {
  border-radius: 14px;
  padding: 18px;
  border: 1px solid rgba(239, 149, 38, 0.08);
}

/* subtle hover for all surfaces */
.navbar,
.chart-container,
.stats-container,
.sidebar,
.footer,
.modal-content {
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}
.navbar:hover,
.chart-container:hover,
.stats-container:hover,
.sidebar:hover,
.modal-content:hover {
  /* transform: translateY(-4px); */
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.chart-container:nth-child(3) {
  margin-bottom: 1rem;
}

/* responsive tweaks keep pill shapes on small screens */
@media (max-width: 768px) {
  .item,
  .pill,
  .nav-pill,
  .stat-box-main {
    border-radius: 12px;
    padding: 8px 10px;
  }
  .chart-title {
    padding: 5px 8px;
    font-size: 14px;
  }
  .chart-container {
    padding: 12px;
  }
}

/* utility: small badge inside pill */
.pill-badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.02);
}

/* ensure canvas area keeps full size */
.chart-wrapper canvas {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
}

/* keep accessibility: focus styles */
.item:focus-visible,
.nav-pill:focus-visible,
.btn:focus-visible {
  outline: 3px solid rgba(239, 149, 38, 0.14);
  outline-offset: 2px;
}
