:root {
  --primary-color: #3ec423;
  --secondary-color: #076925;
  --accent-color: #247c2b;
  --bg-primary: #f8fffe;
  --bg-secondary: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --border-color: #e0e0e0;
  --border-focus: #3ec423;
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-medium: rgba(0, 0, 0, 0.15);
  --shadow-heavy: rgba(0, 0, 0, 0.25);
  --border-radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}
  #donation{ display:none;}

body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--bg-primary) 0%, #f0f9ff 100%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header moderne */
header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 2rem 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect width="2" height="2" fill="rgba(255,255,255,0.1)"/></svg>');
  background-size: 20px 20px;
  animation: float 20s linear infinite;
}

@keyframes float {
  0% { transform: translateX(0); }
  100% { transform: translateX(-20px); }
}

header h1 {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  animation: fadeInUp 0.8s ease-out;
}

header p {
  margin: 0.5rem 0 0;
  font-size: 1.1rem;
  opacity: 0.9;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Toggle button amélioré */
#sidebar-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px var(--shadow-light);
  font-size: 1.2rem;
  color: var(--text-primary);
}

#sidebar-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px var(--shadow-medium);
  background: var(--primary-color);
  color: white;
}

/* Sidebar redesignée */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 380px;
  height: 100vh;
  background: var(--bg-secondary);
  box-shadow: 4px 0 20px var(--shadow-medium);
  overflow-y: auto;
  transition: var(--transition);
  z-index: 999;
  backdrop-filter: blur(10px);
}

.sidebar.hidden {
  transform: translateX(-100%);
}

.sidebar-header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 2rem 1.5rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.sidebar-content {
  padding: 1.5rem;
}

/* Sections dans la sidebar */
.settings-section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.settings-section h3 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: var(--secondary-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-section h3::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 2px;
}

/* Form groups améliorés */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group.inline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
}

/* Content type selector */
.content-type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.content-type-btn {
  padding: 0.75rem 0.5rem;
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
  text-align: center;
}

.content-type-btn:hover,
.content-type-btn.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
}

/* Content inputs */
.content-input {
  animation: slideIn 0.3s ease-out;
}

.content-input.hidden {
  display: none;
}

.text-formatting {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.text-formatting label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  margin-bottom: 0;
  cursor: pointer;
}

/* Inputs modernes */
input[type="text"],
input[type="url"],
input[type="email"],
input[type="tel"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
  background: var(--bg-secondary);
  font-family: inherit;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(62, 196, 35, 0.1);
}

input[type="color"] {
  width: 100%;
  height: 48px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  background: none;
}

input[type="color"]:hover {
  border-color: var(--border-focus);
}

input[type="range"] {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  appearance: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary-color);
  cursor: pointer;
}

/* Boutons améliorés */
button {
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(62, 196, 35, 0.3);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(62, 196, 35, 0.4);
}

button:active {
  transform: translateY(0);
}

/* Zone principale */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Zone QR Code */
.qr-section {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: 0 8px 32px var(--shadow-light);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 600px;
}

.qr-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

#qrcode {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  margin-bottom: 1.5rem;
  border-radius: var(--border-radius);
  background: repeating-conic-gradient(#f8f9fa 0% 25%, transparent 0% 50%) 50% / 20px 20px;
  position: relative;
}

#qrcode.loading {
  background: var(--bg-primary);
}

#qrcode.loading::after {
  content: '';
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

#qrcode canvas {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 16px var(--shadow-light);
}

#qrcode p {
  margin: 0;
  padding: 2rem;
  text-align: center;
  font-style: italic;
  color: var(--text-secondary);
}

.qr-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.qr-actions button {
  min-width: 140px;
}

/* Nouvelles fonctionnalités */
.preset-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.preset-btn {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
}

.preset-btn:hover,
.preset-btn.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
}

.format-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.format-btn {
  flex: 1;
  padding: 0.5rem;
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.format-btn:hover,
.format-btn.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
}

.history-section {
  max-height: 200px;
  overflow-y: auto;
}

.history-item {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
}

.history-item:hover {
  background: var(--bg-primary);
  border-color: var(--primary-color);
}

/* Footer */
footer {
  background: var(--text-primary);
  color: white;
  text-align: center;
  padding: 2rem 1rem;
  margin-top: auto;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    max-width: 380px;
  }

  header h1 {
    font-size: 2rem;
  }

  .main {
    padding: 1rem;
  }

  .qr-section {
    padding: 1rem;
  }

  .qr-actions {
    flex-direction: column;
  }

  .qr-actions button {
    width: 100%;
  }

  .content-type-selector {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1025px) {
  .sidebar.hidden {
    transform: translateX(-100%);
  }
}

/* Animations */
.fade-in {
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.slide-in {
  animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Donation section */
#donation {
  text-align: center;
  padding: 1rem;
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  margin-top: 1rem;
}

#donation form {
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  border-radius: var(--border-radius);
  padding: 0.75rem;
  transition: var(--transition);
}

#donation form:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(62, 196, 35, 0.4);
}

/* Tooltips */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 200px;
  background-color: var(--text-primary);
  color: white;
  text-align: center;
  border-radius: var(--border-radius);
  padding: 8px;
  position: absolute;
  z-index: 1001;
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.85rem;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* Loading state */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Amélioration pour éviter l'obscurcissement */
body.sidebar-open {
  overflow: hidden;
}

body.sidebar-open .main {
  filter: none;
  pointer-events: auto;
}

/* Styles pour les différents types de contenu */
.wifi-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  border-left: 3px solid var(--primary-color);
}

/* Status messages */
.status-message {
  padding: 0.75rem;
  border-radius: var(--border-radius);
  margin: 1rem 0;
  font-size: 0.9rem;
  font-weight: 500;
}

.status-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.status-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Amélioration des boutons de format */
.format-selector {
  width: 100%;
  justify-content: stretch;
}

/* Amélioration de l'accessibilité */
.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 pour l'impression */
@media print {
  .sidebar,
  #sidebar-toggle,
  .qr-actions,
  footer {
    display: none;
  }
  
  .main {
    max-width: none;
    padding: 0;
  }
  
  .qr-section {
    box-shadow: none;
    border: 1px solid #000;
  }
  
  #qrcode {
    background: white;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border-color: #404040;
  }
  
  body {
    background: linear-gradient(135deg, var(--bg-primary) 0%, #0f0f0f 100%);
  }
}