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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f5f5f5;
  color: #333;
  font-size: 14px;
}

.container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px;
}

header {
  background: linear-gradient(135deg, #1a5fb4, #2c3e50);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 20px;
  font-weight: 600;
}

header nav a {
  color: white;
  text-decoration: none;
  margin-left: 20px;
  padding: 8px 16px;
  border-radius: 4px;
  transition: background 0.2s;
}

header nav a:hover {
  background: rgba(255,255,255,0.1);
}

.stats-bar {
  display: flex;
  gap: 20px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.stat-card {
  background: white;
  padding: 15px 25px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  min-width: 180px;
}

.stat-card .label {
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
}

.stat-card .value {
  font-size: 24px;
  font-weight: bold;
  color: #2c3e50;
  margin-top: 5px;
}

.stat-card .value.money {
  color: #27ae60;
}

.stat-card .value.money-blue {
  color: #1a5fb4;
}

.stat-card .value.money-red {
  color: #e74c3c;
}

.actions-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary {
  background: #3498db;
  color: white;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-secondary {
  background: #ecf0f1;
  color: #2c3e50;
}

.btn-secondary:hover {
  background: #bdc3c7;
}

.btn-success {
  background: #27ae60;
  color: white;
}

.btn-success:hover {
  background: #219a52;
}

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Table */
.table-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  overflow: hidden;
}

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

th {
  background: #1a5fb4;
  color: white;
  padding: 10px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}

td {
  padding: 8px 8px;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}

tr:hover {
  background: #f8f9fa;
}

/* Couleurs statut */
tr.statut-libre { background: white; }
tr.statut-prospect { background: #FFF3CD; }
tr.statut-reserve { background: #FFE0B2; }
tr.statut-paye { background: #C8E6C9; }

tr.statut-libre:hover { background: #f8f9fa; }
tr.statut-prospect:hover { background: #ffe8a1; }
tr.statut-reserve:hover { background: #ffd699; }
tr.statut-paye:hover { background: #a5d6a7; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-libre { background: #ecf0f1; color: #7f8c8d; }
.badge-prospect { background: #f39c12; color: white; }
.badge-reserve { background: #e67e22; color: white; }
.badge-paye { background: #27ae60; color: white; }

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

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

.modal {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

.modal-header h2 {
  font-size: 18px;
  color: #2c3e50;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #7f8c8d;
}

.modal-close:hover {
  color: #2c3e50;
}

.modal-body {
  padding: 20px;
}

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

/* Forms */
.form-section {
  margin-bottom: 25px;
}

.form-section h3 {
  font-size: 14px;
  color: #7f8c8d;
  text-transform: uppercase;
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 2px solid #ecf0f1;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 12px;
  color: #7f8c8d;
  margin-bottom: 5px;
  font-weight: 500;
}

.form-group input,
.form-group select {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #3498db;
}

.form-group input[readonly] {
  background: #f5f5f5;
  color: #666;
}

.form-group.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.form-group.checkbox input {
  width: 18px;
  height: 18px;
}

.form-group.checkbox label {
  margin-bottom: 0;
  font-size: 14px;
  color: #333;
}

/* Paiements section */
.paiement-row {
  display: grid;
  grid-template-columns: 120px 1fr 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-bottom: 10px;
}

.paiement-row .paiement-label {
  font-weight: 600;
  color: #2c3e50;
}

.paiement-row input,
.paiement-row select {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

/* Totaux */
.totaux-section {
  background: #ecf0f1;
  padding: 15px;
  border-radius: 8px;
  margin-top: 15px;
}

.totaux-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
}

.totaux-row.total {
  font-weight: bold;
  font-size: 16px;
  border-top: 2px solid #bdc3c7;
  margin-top: 10px;
  padding-top: 10px;
}

.totaux-row .label {
  color: #7f8c8d;
}

.totaux-row .value {
  color: #2c3e50;
}

.totaux-row.reste-du .value {
  color: #e74c3c;
}

.totaux-row.reste-du.ok .value {
  color: #27ae60;
}

/* Tarifs page */
.tarifs-table {
  margin-top: 20px;
}

.tarifs-table input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.tarifs-table input[type="number"] {
  text-align: right;
}

/* Légende */
.legend {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
  color: #666;
}

.legend-label {
  font-weight: 600;
  color: #333;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 3px;
}

/* Utility classes */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-red { color: #e74c3c; }

/* Badge pour nombre de stands */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-stands {
  background: #3498db;
  color: white;
}

/* Navigation active */
nav a.active {
  background: rgba(255,255,255,0.3);
  font-weight: 600;
}

/* Notifications toast */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 9999;
  animation: slideIn 0.3s ease;
}

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

.notification-success {
  background: #27ae60;
}

.notification-error {
  background: #e74c3c;
}

.notification-info {
  background: #3498db;
}

/* Empty message */
.empty-message {
  text-align: center;
  padding: 60px 20px;
  color: #7f8c8d;
}

.empty-message p {
  font-size: 16px;
  margin: 0;
}

/* Button disabled */
.btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Button danger */
.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #c0392b;
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-bar label {
  font-size: 13px;
  color: #666;
}

.filter-bar select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
}

.filter-bar input[type="text"] {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  width: 200px;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 15px;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Login page */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 60px);
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.login-card h2 {
  text-align: center;
  color: #2c3e50;
  margin-bottom: 25px;
  font-size: 22px;
}

/* WebSocket status indicator */
.ws-status {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ws-connected {
  background: #27ae60;
  box-shadow: 0 0 6px rgba(39, 174, 96, 0.6);
}

.ws-disconnected {
  background: #e74c3c;
  box-shadow: 0 0 6px rgba(231, 76, 60, 0.4);
}

/* User badge */
.user-badge {
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  font-weight: 500;
}

/* Validation des champs */
.form-group input.field-error,
.form-group select.field-error {
  border-color: #e74c3c;
  background: #fef2f2;
}

.form-group .error-message {
  color: #e74c3c;
  font-size: 11px;
  margin-top: 3px;
}

.form-group label .required-star {
  color: #e74c3c;
  margin-left: 2px;
}

/* Responsive */
@media (max-width: 768px) {
  .stats-bar {
    flex-direction: column;
  }

  .stat-card {
    min-width: auto;
  }

  .paiement-row {
    grid-template-columns: 1fr 1fr;
  }

  .paiement-row .paiement-label {
    grid-column: span 2;
  }

  th, td {
    padding: 8px 5px;
    font-size: 12px;
  }
}
