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

:focus-visible { outline: 2px solid #4f46e5; outline-offset: 2px; }

html, body { min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #333;
  padding: 20px;
  transition: background 0.3s ease;
}

/* ===== Card container ===== */
.container {
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.15);
  overflow: hidden;
  position: relative;
  backdrop-filter: blur(10px);
}

.header {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: #fff;
  padding: 24px 20px 20px;
  text-align: center;
  position: relative;
}
.header h1 { 
  font-size: 26px; 
  font-weight: 800; 
  letter-spacing: -0.5px; 
  margin-bottom: 4px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.header .subtitle { 
  font-size: 15px; 
  opacity: .95; 
  font-weight: 500; 
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ===== Settings panel trigger ===== */
.settings-btn {
  position: absolute; left: 15px; top: 15px;
  background: rgba(255,255,255,0.25); border: 0; border-radius: 50%;
  width: 40px; height: 40px; display: grid; place-items: center;
  cursor: pointer; font-size: 18px; color: #fff; 
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}
.settings-btn:hover { 
  background: rgba(255,255,255,0.35); 
  transform: rotate(90deg) scale(1.05); 
}

/* ===== Statistiques rapides ===== */
.quick-stats {
  display: flex;
  justify-content: space-around;
  padding: 16px 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-bottom: 1px solid #e2e8f0;
}
.stat-item {
  text-align: center;
  flex: 1;
}
.stat-number {
  font-size: 24px;
  font-weight: 800;
  color: #1e293b;
  display: block;
}
.stat-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== Content area ===== */
.content { padding: 24px; }

/* File selector */
.file-selector {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 20px;
  border-radius: 16px;
  margin-bottom: 20px;
  text-align: center;
  border: 2px solid #e2e8f0;
}
.section-title { 
  font-size: 18px; 
  font-weight: 800; 
  color: #1e293b; 
  display: flex; 
  gap: 10px; 
  align-items: center; 
  justify-content: center;
  margin-bottom: 16px;
}
.section-title small { font-weight: 500; color: #64748b; font-size: 14px; }
.file-drop {
  border: 3px dashed #cbd5e1; 
  border-radius: 12px; 
  padding: 20px;
  text-align: center; 
  color: #64748b; 
  transition: all .3s ease;
  position: relative;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}
.file-drop.drag { 
  border-color: #3b82f6; 
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); 
  color: #1d4ed8;
  transform: scale(1.02);
}
.file-info { 
  margin-top: 12px; 
  font-size: 13px; 
  color: #64748b; 
  line-height: 1.5;
}

/* ===== Barre de recherche ===== */
.search-bar {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 16px;
  background: #fff url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="rgb(100,116,139)"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m21 21-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" /></svg>') no-repeat 14px center;
  background-size: 16px;
  transition: all 0.2s ease;
}
.search-bar:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Buttons */
.btn {
  padding: 12px 20px; 
  margin: 6px; 
  border: 0; 
  border-radius: 12px;
  cursor: pointer; 
  font-size: 14px; 
  font-weight: 700; 
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  gap: 8px; 
  min-width: 120px; 
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.btn:disabled { 
  opacity: .5; 
  cursor: not-allowed; 
  transform: none !important; 
}
.btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.btn-primary { 
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
  color:#fff; 
  box-shadow: 0 4px 15px rgba(102,126,234,.3); 
}
.btn-success { 
  background: linear-gradient(135deg, #10b981 0%, #059669 100%); 
  color:#fff; 
  box-shadow: 0 4px 15px rgba(16,185,129,.3); 
}
.btn-danger  { 
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); 
  color:#fff; 
  box-shadow: 0 4px 15px rgba(239,68,68,.3); 
}
.btn-info    { 
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); 
  color:#fff; 
  box-shadow: 0 4px 15px rgba(59,130,246,.3); 
}
.btn-warning { 
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); 
  color:#fff; 
  box-shadow: 0 4px 15px rgba(245,158,11,.3); 
}

.actions { 
  display:flex; 
  flex-wrap:wrap; 
  gap:12px; 
  justify-content:center; 
  margin: 20px 0 0; 
}

/* List section */
.data-section {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 16px;
  padding: 20px;
  margin-top: 20px;
  border: 2px solid #e2e8f0;
}
.empty-state { 
  text-align:center; 
  padding: 32px 16px; 
  color:#64748b; 
  font-style: italic; 
  background: #fff;
  border-radius: 12px;
  border: 2px dashed #cbd5e1;
}

/* Events grid */
.events {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 16px;
  max-height: 60vh;
  overflow: auto;
}
@media (max-width: 768px){ 
  .events { grid-template-columns: 1fr; } 
}

.ev-when {
  font: 600 13px/1.2 ui-monospace, Menlo, Consolas, monospace;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%); 
  border: 1px solid #cbd5e1; 
  padding: 8px 12px; 
  border-radius: 8px; 
  color:#1e293b;
  white-space: nowrap;
}
.ev-title { 
  font-weight: 700; 
  color: #1e293b;
  line-height: 1.4;
}
.ev-loc { 
  font-size: 12px; 
  color:#64748b; 
  font-style: italic;
}

.scanned-item {
  display: flex; 
  flex-direction: column; 
  gap: 12px;
  padding: 18px; 
  background: #fff; 
  border-radius: 16px; 
  box-shadow: 0 4px 15px rgba(0,0,0,.06);
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
  position: relative;
}
.scanned-item:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  transform: translateY(-2px);
  border-color: #3b82f6;
}
.scanned-item .content { 
  display:flex; 
  flex-direction: column; 
  gap: 8px; 
}
.scanned-item .row { 
  display:flex; 
  align-items:center; 
  gap:10px; 
}
.scanned-item .btn { 
  align-self: stretch; 
  margin: 0;
}

/* ===== Badge de statut payé/non payé ===== */
.status-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-badge.paid {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
  border: 1px solid #86efac;
}
.status-badge.unpaid {
  background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
  color: #92400e;
  border: 1px solid #fbbf24;
}

/* ===== Floating logo ===== */
.logo-top-right {
  position: fixed; 
  top: 20px; 
  right: 20px; 
  height: 60px; 
  z-index: 10; 
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15); 
  display: none;
  backdrop-filter: blur(10px);
}

/* ===== Settings panel ===== */
.settings-panel {
  position: fixed; 
  top: 0; 
  left: -360px; 
  width: 360px; 
  height: 100vh;
  background: #fff; 
  box-shadow: 4px 0 25px rgba(0,0,0,.15); 
  z-index: 1000;
  transition: left .4s cubic-bezier(0.4, 0, 0.2, 1); 
  padding: 24px; 
  overflow-y: auto;
}
.settings-panel.open { left: 0; }
.settings-overlay {
  position: fixed; 
  inset: 0; 
  background: rgba(0,0,0,.5); 
  z-index: 999;
  opacity: 0; 
  visibility: hidden; 
  transition: all .3s ease;
  backdrop-filter: blur(4px);
}
.settings-overlay.active { opacity: 1; visibility: visible; }
.settings-header { 
  display:flex; 
  align-items:center; 
  justify-content:space-between; 
  gap:12px; 
  margin-bottom: 20px; 
  padding-bottom: 16px; 
  border-bottom: 2px solid #f1f5f9; 
}
.settings-title { 
  font-size: 20px; 
  font-weight: 800; 
  color:#1e293b; 
}
.close-settings { 
  width:36px; 
  height:36px; 
  border-radius:50%; 
  border:0; 
  background:#ef4444; 
  color:#fff; 
  cursor:pointer; 
  display:grid; 
  place-items:center;
  transition: all 0.2s ease;
}
.close-settings:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.setting-group { margin-bottom: 24px; }
.setting-label { 
  font-weight: 700; 
  color:#1e293b; 
  margin-bottom: 12px; 
  display:block; 
  font-size: 15px; 
}
.color-options { 
  display:flex; 
  gap: 12px; 
  flex-wrap: wrap; 
}
.color-option { 
  width: 40px; 
  height: 40px; 
  border-radius: 50%; 
  border: 3px solid transparent; 
  cursor: pointer; 
  transition: all .3s ease; 
}
.color-option.selected { 
  border-color: #1e293b; 
  transform: scale(1.15); 
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.color-option:hover:not(.selected) {
  transform: scale(1.05);
}
.color-option.grey   { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.color-option.blue   { background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%); }
.color-option.yellow { background: linear-gradient(135deg, #fdcb6e 0%, #f39c12 100%); }
.color-option.white  { background: linear-gradient(135deg, #f0f0f0 0%, #ffffff 100%); }
.color-option.black  { background: linear-gradient(135deg, #010101 0%, #000000 100%); }

.text-input {
  width: 100%; 
  padding: 14px 16px; 
  border: 2px solid #e2e8f0; 
  border-radius: 12px; 
  font-size: 14px; 
  transition: all .2s ease;
  background: #fff;
}
.text-input:focus { 
  outline: none; 
  border-color: #3b82f6; 
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.save-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color:#fff; 
  border:0; 
  padding: 14px 18px; 
  border-radius: 12px; 
  font-weight: 800; 
  cursor: pointer; 
  width: 100%;
  box-shadow: 0 4px 15px rgba(16,185,129,.3); 
  transition: all .3s ease;
}
.save-btn:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 8px 25px rgba(16,185,129,.4); 
}

/* ===== Modal ===== */
.modal { 
  position: fixed; 
  inset: 0; 
  display: none; 
  place-items: center; 
  background: rgba(0,0,0,.5); 
  z-index: 1000; 
  backdrop-filter: blur(4px);
}
.modal.open { display: grid; }
.sheet { 
  width: min(800px, 95vw); 
  background:#fff; 
  border-radius: 20px; 
  box-shadow: 0 25px 50px rgba(0,0,0,.25); 
  overflow: hidden; 
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.sheet header { 
  display:flex; 
  gap: 12px; 
  align-items:center; 
  justify-content: space-between; 
  padding: 18px 20px; 
  border-bottom: 2px solid #f1f5f9; 
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}
.sheet .content { 
  padding: 20px; 
  overflow-y: auto;
  flex: 1;
}
.grid { display: grid; gap: 16px; }
.two  { 
  display: grid; 
  grid-template-columns: 1fr 1fr; 
  gap: 16px; 
}
@media (max-width: 700px) { 
  .two { grid-template-columns: 1fr; } 
}

/* ===== Event filters ===== */
.filters { 
  display:flex; 
  gap:10px; 
  justify-content:center; 
  margin: 12px 0 16px; 
  flex-wrap: wrap; 
}
.filter-btn { 
  min-width: auto; 
  padding: 8px 16px; 
  font-size: 13px; 
  margin: 0;
}
.filter-btn.active { 
  box-shadow: 0 0 0 2px rgba(59,130,246,0.8) inset; 
  background: #3b82f6;
  color: #fff;
}

/* ===== Export/Import section ===== */
.export-import {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ===== Toast notifications ===== */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(16,185,129,.4);
  z-index: 1001;
  transform: translateX(100%);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 300px;
  font-weight: 600;
}
.toast.show {
  transform: translateX(0);
}
.toast.error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 8px 25px rgba(239,68,68,.4);
}

/* ===== Template editor ===== */
.template-editor {
  margin-top: 16px;
}
.template-item {
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}
.template-item:hover {
  border-color: #3b82f6;
}
.template-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.template-name {
  font-weight: 700;
  color: #1e293b;
}

/* ===== Responsive container tweaks ===== */
@media (max-width: 640px) {
  body { padding: 10px; }
  .container { border-radius: 16px; }
  .header { padding: 20px 16px 16px; }
  .content { padding: 16px; }
  .btn { font-size: 13px; min-width: 100px; }
  .settings-panel { width: 100%; left: -100%; }
  .quick-stats {
    flex-direction: column;
    gap: 12px;
  }
  .stat-item {
    padding: 8px 0;
  }
}

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

.scanned-item {
  animation: slideIn 0.3s ease forwards;
}

/* ===== Keyboard shortcuts hint ===== */
.kbd-hint {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1000;
}
.kbd-hint.show {
  opacity: 1;
}
.kbd {
  background: rgba(255,255,255,0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}
