/* Ultra Modern Filter Sidebar */
:root {
  --sidebar-bg: rgba(255, 255, 255, 0.95);
  --sidebar-backdrop: blur(20px);
  --sidebar-border: 1px solid rgba(255, 255, 255, 0.2);
  --sidebar-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
  --primary-gradient: linear-gradient(135deg, #f61919 0%, #2f3ba5 100%);
  --accent-color: #f61919;
  --accent-hover: #e01616;
  --secondary-color: #2f3ba5;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --bg-surface: rgba(255, 255, 255, 0.8);
  --bg-hover: rgba(246, 25, 25, 0.05);
  --border-light: rgba(229, 231, 235, 0.5);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --font-family: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}


/* Sidebar Base Styles */
.sidebar {
  position: fixed;
  top: 0;
  left: -100%;
  width: 320px;
  height: 100vh;
  background: var(--sidebar-bg);
  backdrop-filter: var(--sidebar-backdrop);
  -webkit-backdrop-filter: var(--sidebar-backdrop);
  border-right: var(--sidebar-border);
  box-shadow: var(--sidebar-shadow);
  z-index: 1100;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  font-family: var(--font-family);
}

.sidebar.active {
  left: 0;
  animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1099;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease-in-out;
}

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

.sidebar-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
}

/* Sidebar Header */
.sidebar-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border-light);
  background: transparent;
  position: relative;
  overflow: hidden;
}

.sidebar-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--primary-gradient);
  opacity: 0.6;
}

.sidebar-title {
  color: var(--accent-color);
  font-weight: 700;
  font-size: 1.4rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-family);
}

.sidebar-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--primary-gradient);
  border-radius: 2px;
}

.sidebar-close-btn {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-secondary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.sidebar-close-btn:hover {
  background: var(--bg-hover);
  color: var(--accent-color);
  border-color: var(--accent-color);
  transform: rotate(90deg);
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  background: transparent;
}

/* Custom Scrollbar */
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Filter Sections */
.filter-section {
  margin: 0 1.5rem 1.5rem;
  padding: 1.25rem;
  background: var(--bg-surface);
  border-radius: 16px;
  border: 1px solid var(--border-light);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.filter-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.filter-section:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.filter-section:hover::before {
  opacity: 1;
}

.filter-header {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: between;
}

.filter-title {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: none;
  letter-spacing: normal;
}

.filter-title i {
  color: var(--accent-color);
  font-size: 1rem;
}

.filter-count {
  background: var(--accent-color);
  color: white;
  border-radius: 20px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: auto;
}

.filter-content {
  space-y: 0.75rem;
}

/* Modern Form Elements */
.filter-input-group {
  position: relative;
}

.filter-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.filter-input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
  background: rgba(255, 255, 255, 0.8);
}

.filter-input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-clear-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.filter-clear-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* Range Sliders */
.range-slider-container {
  padding: 0.5rem 0;
}

.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border-light);
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
  transition: all 0.2s ease;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.6);
}

.range-values {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Checkbox and Radio Modern Styles */
.filter-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 12px;
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.filter-option:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  transform: translateX(4px);
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
  display: none;
}

.filter-option .custom-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
}

.filter-option input[type="checkbox"]:checked + .custom-checkbox {
  background: var(--accent-color);
  border-color: var(--accent-color);
}

.filter-option input[type="checkbox"]:checked + .custom-checkbox::after {
  content: '✓';
  color: white;
  font-size: 0.8rem;
  font-weight: bold;
}

.filter-option .custom-radio {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.filter-option input[type="radio"]:checked + .custom-radio {
  border-color: var(--accent-color);
}

.filter-option input[type="radio"]:checked + .custom-radio::after {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--accent-color);
  border-radius: 50%;
}

.option-label {
  flex: 1;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
}

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

/* Stock Indicators */
.stock-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 0.5rem;
  position: relative;
}

.stock-indicator::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.3;
}

.stock-in { background: var(--success); }
.stock-out { background: var(--danger); }
.stock-warning { background: var(--warning); }
.stock-order { background: var(--info); }

/* Scrollable Areas */
.filter-scrollable {
  max-height: 200px;
  overflow-y: auto;
  border-radius: 12px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--border-light);
}

/* Active Filters */
.active-filters-container {
  background: var(--bg-surface);
  border-radius: 16px;
  padding: 1.25rem;
  margin: 0 1.5rem 1.5rem;
  border: 1px solid var(--border-light);
}

.active-filter-tag {
  display: inline-flex;
  align-items: center;
  background: var(--primary-gradient);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  margin: 0.25rem;
  animation: slideInUp 0.3s ease;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.active-filter-tag .remove-filter {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  margin-left: 0.5rem;
  padding: 0.25rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.active-filter-tag .remove-filter:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-light);
  background: transparent;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.filter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.btn-modern {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.btn-modern::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-modern:hover::before {
  left: 100%;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  transform: translateY(-2px);
  border-color: var(--accent-color);
}

.filter-results-info {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Loading States */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid transparent;
  border-top: 2px solid var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 1rem auto;
}

.loading-skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--bg-surface) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 8px;
  height: 20px;
  margin: 0.5rem 0;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    border-radius: 0;
  }
  
  .filter-section {
    margin: 0 1rem 1rem;
    padding: 1rem;
  }
  
  .active-filters-container {
    margin: 0 1rem 1rem;
  }
  
  .sidebar-header {
    padding: 1.25rem 1rem 1rem;
  }
  
  .sidebar-footer {
    padding: 1.25rem 1rem;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar {
    width: 280px;
  }
}

@media (min-width: 1025px) {
  .sidebar {
    width: 320px;
  }
}

/* Content Responsiveness */
main {
  transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-open main {
  margin-left: 320px;
}

.navbar .container {
  transition: padding-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-open .navbar .container {
    padding-left: 360px;
}

footer.sidebar-open {
    margin-left: 320px;
    transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
  .sidebar-open main {
    margin-left: 0;
  }

  .sidebar-open .navbar .container {
    padding-left: 1rem;
  }

  footer.sidebar-open {
    margin-left: 0;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar-open main {
    margin-left: 320px;
  }

  .sidebar-open .navbar .container {
    padding-left: 330px;
  }

  footer.sidebar-open {
    margin-left: 320px;
  }
}

/* Animations */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

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

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Filter Section Animations */
.filter-section {
  animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.filter-section:nth-child(1) { animation-delay: 0.05s; }
.filter-section:nth-child(2) { animation-delay: 0.1s; }
.filter-section:nth-child(3) { animation-delay: 0.15s; }
.filter-section:nth-child(4) { animation-delay: 0.2s; }
.filter-section:nth-child(5) { animation-delay: 0.25s; }
.filter-section:nth-child(6) { animation-delay: 0.3s; }
.filter-section:nth-child(7) { animation-delay: 0.35s; }
.filter-section:nth-child(8) { animation-delay: 0.4s; }
.filter-section:nth-child(9) { animation-delay: 0.45s; }


/* Responsive Content Layout */
@media (max-width: 768px) {
    .articles-section {
        padding-left: 0 !important;
        transition: padding-left 0.3s ease;
    }

    .sidebar-toggle {
        position: fixed !important;
        top: 80px !important;
        left: 20px !important;
        z-index: 1000 !important;
        background: var(--bg-surface) !important;
        border: 1px solid var(--border-light) !important;
        border-radius: 12px !important;
        padding: 0.75rem 1.25rem !important;
        backdrop-filter: blur(10px) !important;
        transition: all 0.3s ease !important;
    }

    .sidebar-toggle:hover {
        background: var(--bg-hover) !important;
        border-color: var(--accent-color) !important;
        transform: translateX(5px) !important;
    }

    .sidebar-toggle i,
    .sidebar-toggle .fas.fa-filter {
        color: #f61919 !important;
    }

    .filtrage-text {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .sidebar-toggle {
        position: fixed;
        top: 100px;
        left: 30px;
        z-index: 1000;
        background: var(--bg-surface);
        border: 1px solid var(--border-light);
        border-radius: 12px;
        padding: 0.75rem 1.25rem;
        backdrop-filter: blur(10px);
        transition: all 0.3s ease;
    }
    
    .sidebar-toggle:hover {
        background: var(--bg-hover);
        border-color: var(--accent-color);
        transform: translateX(5px);
    }

    .sidebar-toggle {
        color: #f61919;
    }

    .sidebar-toggle i,
    .sidebar-toggle .fas.fa-filter {
        color: #f61919;
    }
    
    .main-content {
        margin-left: 0;
        transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .sidebar-open .main-content {
        margin-left: 420px;
    }
}