/* ---------- Reset Global ---------- */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Dancing+Script&display=swap');

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

.bg-primary {
  background-color: #ff7700!important;
}

.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: anywhere!important;
}

/* ---------- Body ---------- */
body {
  padding: 40px;
  font-family: 'Titillium Web', sans-serif;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Improve rendering performance */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Performance optimization: CSS containment */
.card {
  contain: layout style;
}

.mobile-menu {
  contain: layout style;
}

/* ---------- Container Principal ---------- */
.container {
  width: 95%;
  max-width: 1600px;
  background: white;
  padding: 30px;
  border-radius: 90px!important;
  text-align: center;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
  position: relative;
  /* Removed heavy inset shadows for better mobile performance */
}

/* Reduce animations on devices that prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}



/* ---------- Listes ---------- */
ul {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  text-align: center;
}

li {
  background: #fff;
  color: #000;
  padding: 0px;
  margin: 10px auto;
  border-radius: 30px;
  width: 100%;
  text-align: center;
}

/* ---------- Menus (anciens, masqués) ---------- */
.menu, .menu2 {
  font-size: 1.8em;
  font-weight: normal;
  margin-bottom: 20px;
}
.menu2 {
  height: 1em;
  margin-bottom: 40px;
}

/* ---------- Liens ---------- */
a {
  color: #ff7700;
  text-decoration: none;
  font-weight: normal;
  margin: 0 5px;
}

a:hover {
  color: #ff9f4d;
  text-decoration: none!important;
}

.menu a:hover, .menu2 a:hover {
  text-decoration: none!important;
  color: #ff9f4d;
}

/* ---------- Formulaires ---------- */
form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin: 20px 0;
}

label {
  font-weight: bold;
  color: #333;
  margin-bottom: 5px;
  display: block;
  text-align: left;
  width: 100%;
}

input, textarea, select {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #ddd;
  border-radius: 25px;
  font-size: 16px;
  font-family: 'Titillium Web', sans-serif;
  background: white;
  color: #333;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #ff7700;
  box-shadow: 
    inset 0 2px 4px rgba(0,0,0,0.1),
    0 0 0 3px rgba(255, 119, 0, 0.2);
}

/* ---------- Boutons ---------- */
button, .btn, .btn-elegant {
  background: linear-gradient(135deg, #ff7700, #ff9f4d);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 25px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  margin: 5px;
  box-shadow: 0 4px 15px rgba(255, 119, 0, 0.3);
}

button:hover, .btn:hover, .btn-elegant:hover {
  background: linear-gradient(135deg, #ff9f4d, #ffb366);
  box-shadow: 0 6px 20px rgba(255, 119, 0, 0.4);
  color: white;
  /* Simplified hover effect - remove transform on mobile */
}

/* Only enable transform on non-touch devices */
@media (hover: hover) and (pointer: fine) {
  button:hover, .btn:hover, .btn-elegant:hover {
    transform: translateY(-2px);
  }
}

/* ---------- Cards ---------- */
.card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 25px;
  margin: 20px 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  /* Removed backdrop-filter for better mobile performance */
}

.card-glow-orange-alt {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.98) 0%, 
    rgba(255, 247, 240, 0.95) 100%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
  /* Simplified shadow for better mobile performance */
}

/* ---------- Titres avec styles spéciaux ---------- */
.fancy-underline {
  position: relative;
  display: inline-block;
  margin-bottom: 20px;
}

.fancy-underline::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, #ff7700, #ff9f4d);
  border-radius: 2px;
}

.dancing-font {
  font-family: 'Dancing Script', cursive;
  font-weight: 400;
  color: #ff7700;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* ---------- Top Bar et Burger Menu ---------- */
.top-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  margin-bottom: 20px;
}

.burger-wrapper {
  display: flex;
  align-items: center;
}

.burger-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 0;
  transition: all 0.3s ease;
  box-shadow: none;
  outline: none;
}

.burger-button:hover {
  background: none;
  transform: scale(1.05);
  border: none;
  outline: none;
  box-shadow: none;
}

.burger-button:focus {
  background: none;
  border: none;
  outline: none;
  box-shadow: none;
}

/* ---------- Menu Mobile ---------- */
.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 20px 0;
  background: rgba(255, 247, 240, 0.9);
  border-radius: 15px;
  margin: 10px 0;
  box-shadow: inset 0 2px 8px rgba(255, 119, 0, 0.1);
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu a {
  color: #ff7700;
  text-decoration: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 500;
  transition: all 0.3s ease;
  text-align: center;
}

.mobile-menu a:hover {
  background: rgba(255, 119, 0, 0.1);
  color: #ff9f4d;
  transform: translateX(5px);
}

/* ---------- HR personnalisé ---------- */
.custom_hr, hr {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 119, 0, 0.3) 20%, 
    rgba(255, 119, 0, 0.8) 50%, 
    rgba(255, 119, 0, 0.3) 80%, 
    transparent 100%);
  margin: 20px 0;
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ---------- Overlay ---------- */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
}

/* ---------- Texte d'info ---------- */
.info {
  color: #666;
  font-size: 14px;
  margin-top: 20px;
  text-align: center;
  font-style: italic;
}

/* ---------- Alertes ---------- */
.alert {
  padding: 15px;
  border-radius: 15px;
  margin: 15px 0;
  border: 1px solid transparent;
}

.alert-danger {
  background: rgba(220, 53, 69, 0.1);
  border-color: rgba(220, 53, 69, 0.3);
  color: #721c24;
}

.alert-success {
  background: rgba(40, 167, 69, 0.1);
  border-color: rgba(40, 167, 69, 0.3);
  color: #155724;
}

.alert-info {
  background: rgba(23, 162, 184, 0.1);
  border-color: rgba(23, 162, 184, 0.3);
  color: #0c5460;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  body {
    padding: 20px;
  }
  
  .container {
    width: 98%;
    padding: 20px;
    border-radius: 30px!important;
    /* Simplified shadows on mobile for better performance */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
  
  .top-bar {
    flex-direction: column;
    gap: 15px;
  }
  
  input, textarea, select {
    font-size: 16px; /* Empêche le zoom sur iOS */
  }
  
  .card {
    padding: 20px;
    border-radius: 15px;
    /* Simpler effects on mobile */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }
  
  button, .btn, .btn-elegant {
    width: 100%;
    margin: 10px 0;
    /* Disable transform animations on mobile for better performance */
    transform: none !important;
  }
  
  /* Disable complex animations on mobile */
  .menu-main-link::before,
  .menu-main-item::before {
    display: none;
  }
  
  .menu-main-link:hover,
  .menu-main-item:hover {
    transform: none !important;
  }
}

@media (max-width: 480px) {
  .container {
    border-radius: 20px!important;
    padding: 15px;
  }
  
  .fancy-underline::after {
    width: 40px;
  }
  
  /* Further reduce effects on very small screens */
  * {
    transition-duration: 0.15s !important;
  }
}

/* ---------- Utilitaires ---------- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }

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

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.pulse {
  animation: pulse 2s infinite;
}

/* ---------- Focus et accessibilité ---------- */
*:focus {
  outline: 2px solid #ff7700;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Styles spécifiques aux grilles ---------- */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Pre et code ---------- */
pre {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 15px;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.4;
  margin: 15px 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

code {
  background: #f8f9fa;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 90%;
  color: #e83e8c;
}

/* ========== Mapping Editor Styles ========== */
#mappingEditorContainer {
  max-width: none !important;
  width: 100%;
}

#mappingEditorContainer .col-md-5 {
  min-height: 500px;
}

#mappingEditorContainer .border {
  min-height: 450px;
  position: relative;
}

/* Product cards styling */
#wcProductInfo img, #supplierProductInfo img {
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
}

#wcProductInfo img:hover, #supplierProductInfo img:hover {
  border-color: #007bff;
  transform: scale(1.05);
}

/* Attribute boxes */
.attribute-box {
  transition: all 0.3s ease;
  cursor: pointer;
}

.attribute-box:hover {
  background-color: #f0f8ff !important;
  border-color: #007bff !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,123,255,0.15);
}

#wcAttributes .border, #supplierAttributes .border {
  transition: all 0.3s ease;
  cursor: pointer;
}

#wcAttributes .border:hover, #supplierAttributes .border:hover {
  background-color: #f0f8ff !important;
  border-color: #007bff !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,123,255,0.15);
}

/* Mapping arrows and connections */
.mapping-arrow {
  transition: all 0.3s ease;
  cursor: pointer;
}

#attributeMappings .border {
  transition: all 0.3s ease;
  cursor: pointer;
}

#attributeMappings .bg-success {
  border-left: 4px solid #28a745 !important;
}

#attributeMappings .bg-warning {
  border-left: 4px solid #ffc107 !important;
}

/* Value mapping table */
#valueMappingTable .table th {
  background-color: #f8f9fa;
  font-weight: 600;
  border-bottom: 2px solid #dee2e6;
}

#valueMappingTable .form-select-sm {
  font-size: 0.875rem;
  border-radius: 6px;
  border-color: #ced4da;
  transition: all 0.2s ease;
}

#valueMappingTable .form-select-sm:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

/* Progress bars and summaries */
#variationSummary .progress {
  background-color: #e9ecef;
  border-radius: 10px;
  overflow: hidden;
}

#variationSummary .progress-bar {
  background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
  transition: width 0.6s ease;
}

/* Supplier badge */
#defaultSupplierBadge .badge {
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 20px;
  animation: pulse 2s infinite;
}

.badge-pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Modal enhancements */
.modal-content {
  border-radius: 15px;
  border: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-header {
  border-bottom: 2px solid #f8f9fa;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 15px 15px 0 0;
}

.modal-header .btn-close {
  filter: invert(1);
}

/* Buttons styling */
.btn {
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
  padding: 8px 16px;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-success {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.btn-primary {
  background: linear-gradient(135deg, #007bff 0%, #6f42c1 100%);
}

.btn-outline-primary {
  border: 2px solid #007bff;
  color: #007bff;
  background: transparent;
}

.btn-outline-primary:hover {
  background: #007bff;
  color: white;
}

/* Loading states */
.placeholder {
  background: linear-gradient(90deg, #f8f9fa 25%, #e9ecef 50%, #f8f9fa 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
  #mappingEditorContainer .col-md-5,
  #mappingEditorContainer .col-md-2 {
    margin-bottom: 20px;
  }
  
  #mappingEditorContainer .row {
    flex-direction: column;
  }
  
  #attributeMappings {
    padding: 15px 0;
    text-align: center;
  }
}

/* Scrollbar styling for mapping areas */
#wcAttributes::-webkit-scrollbar,
#supplierAttributes::-webkit-scrollbar {
  width: 6px;
}

#wcAttributes::-webkit-scrollbar-track,
#supplierAttributes::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

#wcAttributes::-webkit-scrollbar-thumb,
#supplierAttributes::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 10px;
}

#wcAttributes::-webkit-scrollbar-thumb:hover,
#supplierAttributes::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* ---------- Menu Hiérarchique ---------- */
.menu-section {
  margin-bottom: 12px;
}

.menu-main-link {
  display: block;
  color: #ff7700;
  text-decoration: none;
  padding: 15px 25px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1.1em;
  transition: all 0.3s ease;
  text-align: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 247, 240, 0.9));
  margin-bottom: 8px;
  border: 2px solid rgba(255, 119, 0, 0.1);
  box-shadow: 0 2px 8px rgba(255, 119, 0, 0.1);
  position: relative;
  overflow: hidden;
  /* Enable GPU acceleration for smoother rendering */
  will-change: transform;
  transform: translateZ(0);
}

.menu-main-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 119, 0, 0.1), transparent);
  transition: left 0.5s ease;
}

/* Only enable animations on devices that support hover */
@media (hover: hover) and (pointer: fine) {
  .menu-main-link:hover::before {
    left: 100%;
  }
  
  .menu-main-link:hover {
    background: linear-gradient(135deg, rgba(255, 119, 0, 0.1), rgba(255, 159, 77, 0.1));
    color: #ff9f4d;
    transform: translateX(8px);
    border-color: rgba(255, 119, 0, 0.3);
    box-shadow: 0 4px 15px rgba(255, 119, 0, 0.2);
  }
}

/* Simplified hover for touch devices */
@media (hover: none) {
  .menu-main-link::before {
    display: none;
  }
  
  .menu-main-link:active {
    background: linear-gradient(135deg, rgba(255, 119, 0, 0.1), rgba(255, 159, 77, 0.1));
    color: #ff9f4d;
  }
}

.menu-main-item {
  display: flex;
  justify-content: center;
  align-items: center;
  color: #ff7700;
  padding: 15px 25px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1.1em;
  transition: all 0.3s ease;
  text-align: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 247, 240, 0.9));
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
  border: 2px solid rgba(255, 119, 0, 0.1);
  box-shadow: 0 2px 8px rgba(255, 119, 0, 0.1);
  position: relative;
  overflow: hidden;
  /* Enable GPU acceleration */
  will-change: transform;
  transform: translateZ(0);
}

.menu-main-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 119, 0, 0.1), transparent);
  transition: left 0.5s ease;
}

/* Only enable animations on devices that support hover */
@media (hover: hover) and (pointer: fine) {
  .menu-main-item:hover::before {
    left: 100%;
  }

  .menu-main-item:hover {
    background: linear-gradient(135deg, rgba(255, 119, 0, 0.1), rgba(255, 159, 77, 0.1));
    color: #ff9f4d;
    transform: translateX(8px);
    border-color: rgba(255, 119, 0, 0.3);
    box-shadow: 0 4px 15px rgba(255, 119, 0, 0.2);
  }
}

/* Simplified for touch devices */
@media (hover: none) {
  .menu-main-item::before {
    display: none;
  }
  
  .menu-main-item:active {
    background: linear-gradient(135deg, rgba(255, 119, 0, 0.1), rgba(255, 159, 77, 0.1));
    color: #ff9f4d;
  }
}

.submenu-arrow {
  font-size: 0.9em;
  transition: transform 0.3s ease;
  font-weight: bold;
}

.submenu {
  display: none;
  margin-left: 15px;
  margin-top: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 247, 240, 0.7));
  border-radius: 10px;
  padding: 8px 0;
  border: 1px solid rgba(255, 119, 0, 0.1);
  box-shadow: inset 0 2px 4px rgba(255, 119, 0, 0.1);
}

.submenu a {
  display: block;
  color: #ff7700;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.3s ease;
  text-align: left;
  font-size: 0.95em;
  margin: 3px 12px;
  position: relative;
}

.submenu a:hover {
  background: linear-gradient(135deg, rgba(255, 119, 0, 0.15), rgba(255, 159, 77, 0.15));
  color: #ff9f4d;
  transform: translateX(5px);
}

.logout-link {
  background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(255, 107, 107, 0.1)) !important;
  color: #dc3545 !important;
  font-weight: 700;
  border-color: rgba(220, 53, 69, 0.2) !important;
}

.logout-link:hover {
  background: linear-gradient(135deg, rgba(220, 53, 69, 0.2), rgba(255, 107, 107, 0.2)) !important;
  color: #c82333 !important;
  border-color: rgba(220, 53, 69, 0.4) !important;
}