/* ========================================
   APPLI CHAI VR - Main Styles
   ======================================== */

/* Reset & Base */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f0eb;
  color: #333;
  min-height: 100vh;
}

/* ---- Navigation ---- */
.main-nav {
  background: #8B0000;
  color: white;
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 56px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-title {
  font-size: 1.4rem;
  font-weight: bold;
  margin-right: 40px;
  letter-spacing: 2px;
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-link {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.nav-link:hover {
  background: rgba(255,255,255,0.15);
  color: white;
}

.nav-link.active {
  background: rgba(255,255,255,0.25);
  color: white;
  font-weight: 600;
}

/* ---- Page Layout ---- */
.page-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 1.6rem;
  color: #8B0000;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: #8B0000;
  color: white;
}
.btn-primary:hover { background: #6B0000; }

.btn-secondary {
  background: #e0d5c8;
  color: #333;
}
.btn-secondary:hover { background: #d0c5b8; }

.btn-danger {
  background: #dc3545;
  color: white;
}
.btn-danger:hover { background: #c82333; }

.btn-success {
  background: #28a745;
  color: white;
}
.btn-success:hover { background: #218838; }

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

/* ---- Cards ---- */
.card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
}

.card-header h2 {
  font-size: 1.2rem;
  color: #555;
}

/* ---- Tables ---- */
.table-container { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

th {
  background: #f8f4f0;
  font-weight: 600;
  color: #666;
  font-size: 0.85rem;
  text-transform: uppercase;
}

tr:hover { background: #faf8f5; }

/* ---- Forms ---- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 0.85rem;
  color: #555;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: #8B0000;
  box-shadow: 0 0 0 3px rgba(139,0,0,0.1);
}

select.form-control {
  appearance: auto;
}

/* ---- Modals ---- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 1.1rem;
  color: #8B0000;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
}
.modal-close:hover { color: #333; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

/* ---- Notifications ---- */
#notifications {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notification {
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease-out;
  max-width: 350px;
}

.notification-info { background: #17a2b8; }
.notification-success { background: #28a745; }
.notification-error { background: #dc3545; }
.notification-warning { background: #ffc107; color: #333; }

.notification-hide {
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---- Color Swatch ---- */
.color-swatch {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #ddd;
  vertical-align: middle;
  margin-right: 6px;
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e0d5c8;
  margin-bottom: 20px;
}

.tab {
  padding: 10px 20px;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 0.95rem;
  color: #888;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab:hover { color: #8B0000; }

.tab.active {
  color: #8B0000;
  border-bottom-color: #8B0000;
  font-weight: 600;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }

/* ---- Ecart indicator ---- */
.ecart-positif { color: #dc3545; }
.ecart-negatif { color: #dc3545; }
.ecart-zero { color: #28a745; }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 40px;
  color: #999;
}
.empty-state p { font-size: 1rem; margin-top: 8px; }

/* ---- Loading ---- */
.loading {
  text-align: center;
  padding: 40px;
  color: #888;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .main-nav {
    flex-direction: column;
    height: auto;
    padding: 10px;
  }
  .nav-title { margin-right: 0; margin-bottom: 8px; }
  .nav-links { flex-wrap: wrap; justify-content: center; }
  .page-container { padding: 12px; }
  .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
  .modal { width: 95%; padding: 16px; }
}

@media (max-width: 480px) {
  .nav-link { padding: 6px 10px; font-size: 0.8rem; }
}

/* === Assemblage visuel === */
.assemblage-section { border-radius: 8px; padding: 16px; margin-bottom: 8px; }
.assemblage-section-source { border-left: 4px solid #dc3545; background: #fff5f5; }
.assemblage-section-dest { border-left: 4px solid #28a745; background: #f5fff5; }
.assemblage-arrow { text-align: center; padding: 12px; font-size: 1.3rem; color: #8B0000; font-weight: bold; }
.assemblage-cuve-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 1px solid #eee; flex-wrap: wrap; }
.assemblage-cuve-row:last-child { border-bottom: none; }
.assemblage-cuve-row input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; }
.assemblage-cuve-row label { flex: 1; min-width: 150px; font-weight: 500; }
.assemblage-cuve-row input[type="number"] { width: 100px; }
.assemblage-cuve-row select { width: 200px; }
.assemblage-section h4 { margin: 0 0 12px 0; font-size: 1rem; }
.assemblage-vin-global { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 8px 12px; background: #e8f5e9; border-radius: 4px; }
