/* Reset et base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --secondary: #64748b;
  --danger: #dc2626;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

/* Main */
main {
  flex: 1;
  padding: 1rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* Sections */
section {
  background: var(--card);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.hidden {
  display: none !important;
}

/* QR Reader */
.qr-reader {
  width: 100%;
  min-height: 300px;
  background: #000;
  border-radius: 8px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  overflow: hidden;
}

.qr-reader video {
  width: 100%;
  height: auto;
  display: block;
}

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.btn:last-child {
  margin-bottom: 0;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--primary);
  color: white;
}
.btn.primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn.success {
  background: var(--success);
  color: white;
}
.btn.success:hover:not(:disabled) {
  background: #15803d;
}

.btn.secondary {
  background: var(--secondary);
  color: white;
}
.btn.secondary:hover:not(:disabled) {
  background: #475569;
}

/* Résultat */
.result-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  font-family: monospace;
  word-break: break-all;
  white-space: pre-wrap;
  min-height: 60px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.actions .btn:last-child {
  grid-column: 1 / -1;
}

/* Status messages */
.status-message {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin: 0.5rem 0;
  display: none;
  font-weight: 500;
  text-align: center;
}

.status-message.info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.status-message.success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.status-message.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Footer */
footer {
  text-align: center;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
  background: var(--card);
}

/* Responsive */
@media (min-width: 640px) {
  .actions {
    grid-template-columns: repeat(3, 1fr);
  }
  .actions .btn:last-child {
    grid-column: auto;
  }
}

/* Animation de chargement */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.scanning::after {
  content: ' 🔍';
  animation: pulse 1.5s infinite;
}