:root {
  --bg-primary: #0F172A;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --bg-input: rgba(15, 23, 42, 0.6);
  
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  
  --accent: #0A84FF;
  --accent-hover: #0070E0;
  --accent-gradient: linear-gradient(135deg, #0A84FF 0%, #0060DF 100%);
  
  --success: #30D158;
  --warning: #FF9F0A;
  --danger: #FF453A;
  
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  
  --safe-top: env(safe-area-inset-top, 20px);
  --safe-bottom: env(safe-area-inset-bottom, 20px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  background-image: radial-gradient(circle at top center, rgba(10, 132, 255, 0.15), transparent 45%);
}

.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  padding: calc(var(--safe-top) + 12px) 16px calc(var(--safe-bottom) + 24px) 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Header iOS */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  width: 42px;
  height: 42px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(10, 132, 255, 0.35);
}

.app-title-group h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--success);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.donate-btn-header {
  background: linear-gradient(135deg, rgba(255, 159, 10, 0.2) 0%, rgba(255, 69, 58, 0.2) 100%);
  border: 1px solid rgba(255, 159, 10, 0.4);
  color: #FFB340;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.donate-btn-header:active {
  transform: scale(0.94);
  background: rgba(255, 159, 10, 0.35);
}

.icon-button {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.icon-button:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.1);
}

/* Cartes */
.card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Champ de saisie */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
}

.platform-indicator {
  position: absolute;
  top: -10px;
  left: 14px;
  background: #1E293B;
  border: 1px solid var(--bg-card-border);
  padding: 2px 8px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.platform-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  padding: 8px 4px;
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
  font-size: 14px;
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.clear-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.paste-btn {
  background: rgba(10, 132, 255, 0.15);
  border: none;
  color: var(--accent);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.2s;
}

.paste-btn:active {
  background: rgba(10, 132, 255, 0.3);
}

/* Boutons principaux */
.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(10, 132, 255, 0.3);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn-primary:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--bg-card-border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:active {
  background: rgba(255, 255, 255, 0.15);
}

/* Chips plateformes */
.platforms-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.chip {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--bg-card-border);
  color: var(--text-secondary);
  font-weight: 500;
}

/* Carte Résultat */
.result-card {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.media-preview {
  display: flex;
  gap: 14px;
}

.thumbnail-container {
  position: relative;
  width: 110px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #111;
  flex-shrink: 0;
}

.thumbnail-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.duration-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 600;
}

.platform-tag {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
}

.media-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.media-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.media-author {
  font-size: 12px;
  color: var(--text-muted);
}

.media-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.media-note {
  font-size: 12px;
  color: var(--warning);
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(255, 159, 10, 0.1);
  border-radius: 8px;
  line-height: 1.35;
}

.media-warning {
  color: var(--danger);
  background: rgba(255, 69, 58, 0.1);
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 10px;
}

/* Liste des formats */
.format-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.format-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.format-btn:hover, .format-btn:active {
  background: rgba(10, 132, 255, 0.15);
  border-color: var(--accent);
}

.format-info-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.format-title {
  font-size: 14px;
  font-weight: 600;
}

.format-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.format-download-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Status téléchargement */
.download-status {
  background: rgba(10, 132, 255, 0.1);
  border: 1px solid rgba(10, 132, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.status-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Barre de progression du téléchargement */
.progress-bar {
  margin-top: 10px;
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.progress-label {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  min-height: 14px;
}

/* Bannière Astuce iOS */
.ios-tip-card {
  background: rgba(255, 159, 10, 0.08);
  border: 1px solid rgba(255, 159, 10, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.tip-icon {
  font-size: 20px;
}

.tip-body {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.tip-body strong {
  color: var(--warning);
}

/* Bannière PWA */
.pwa-install-banner {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pwa-icon {
  font-size: 22px;
}

.pwa-text {
  display: flex;
  flex-direction: column;
}

.pwa-text strong {
  font-size: 13px;
  font-weight: 600;
}

.pwa-text span {
  font-size: 11px;
  color: var(--text-muted);
}

/* Carte de soutien / Monétisation */
.donation-card {
  background: linear-gradient(135deg, rgba(255, 159, 10, 0.08) 0%, rgba(255, 69, 58, 0.08) 100%);
  border: 1px solid rgba(255, 159, 10, 0.25);
  gap: 12px;
}

.donation-card-content {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.donation-icon {
  font-size: 24px;
  line-height: 1;
}

.donation-texts strong {
  font-size: 14px;
  color: #FFB340;
  display: block;
  margin-bottom: 2px;
}

.donation-texts p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.btn-donate-card {
  background: linear-gradient(135deg, #FF9F0A 0%, #FF453A 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(255, 159, 10, 0.3);
  transition: transform 0.15s ease;
}

.btn-donate-card:active {
  transform: scale(0.97);
}

/* Modale de don */
.modal-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-emoji {
  font-size: 20px;
}

.donate-modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.donation-buttons-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.donation-platform-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.donation-platform-btn:active {
  transform: scale(0.97);
  filter: brightness(0.9);
}

.platform-btn-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.platform-btn-icon {
  font-size: 20px;
}

/* Modale */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: #1E293B;
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.modal-header h2 {
  font-size: 17px;
  font-weight: 700;
}

.close-modal {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.guide-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.step-number {
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-desc strong {
  font-size: 13px;
  display: block;
  margin-bottom: 2px;
}

.step-desc p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.divider {
  border: none;
  border-top: 1px solid var(--bg-card-border);
  margin: 4px 0;
}

.full-width {
  width: 100%;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 30px);
  left: 50%;
  transform: translateX(-50%);
  background: #334155;
  color: #fff;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  z-index: 2000;
  animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { opacity: 0; transform: translate(-50%, 20px) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
