:root {
  --bg-color: #0f172a;
  --panel-bg: rgba(30, 41, 59, 0.7);
  --border-color: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --error: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background: var(--bg-color);
  background-image: radial-gradient(circle at top right, #1e3a8a 0%, transparent 40%),
                    radial-gradient(circle at bottom left, #064e3b 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 800px;
  padding: 2rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(to right, #60a5fa, #34d399);
  -webkit-background-clip: text;
  color: transparent;
  margin-bottom: 0.5rem;
}

header p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

/* Sections dynamiques */
.section {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.section.active {
  display: block;
}

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

/* Accueil (Générer ou Rejoindre) */
.home-actions {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
}

.btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.join-group {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  max-width: 400px;
}

.input-field {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  color: white;
  padding: 0.8rem;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-field:focus {
  border-color: var(--accent);
}

/* Zone de transfert (Drag & Drop) */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 1.5rem;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
}

.drop-zone p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

#fileInput {
  display: none;
}

/* Text area */
.text-transfer {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

textarea.input-field {
  resize: vertical;
  min-height: 100px;
  font-family: monospace;
}

/* Status et Lien */
.status-bar {
  text-align: center;
  margin-bottom: 1rem;
  font-weight: 500;
}

.status-waiting { color: var(--text-muted); }
.status-connected { color: var(--success); }
.status-error { color: var(--error); }

.share-link-box {
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  font-family: monospace;
  font-size: 1.2rem;
  color: var(--accent);
  user-select: all;
  border: 1px solid var(--border-color);
  word-break: break-all;
}

.copy-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.copy-group .share-link-box {
  flex: 1;
  margin: 0;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 8px;
  padding: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* Popup/Modal (Validation) */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-color);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  text-align: center;
  max-width: 400px;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.btn-danger {
  background: var(--error);
}
.btn-danger:hover {
  background: #dc2626;
}

/* Logs / Fichiers reçus */
.received-items {
  margin-top: 2rem;
}
.received-items h3 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
}
.item-card {
  background: rgba(255,255,255,0.05);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.text-item {
  white-space: pre-wrap;
  word-break: break-all;
  font-family: monospace;
}

.share-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}
.share-option {
  text-align: left;
}
.share-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tabs */
.tabs {
  display: flex;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}
.tab-btn {
  flex: 1;
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0.8rem 1rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  border-bottom: 2px solid transparent;
}
.tab-btn:hover {
  color: var(--text-main);
}
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}
.tab-content.active {
  display: block;
}

/* ----------------------------------
   Mobile Responsiveness
----------------------------------- */
@media (max-width: 500px) {
  .container {
    padding: 1rem;
  }
  
  .glass-panel {
    padding: 1.5rem 1rem;
  }
  
  .join-group {
    flex-direction: column;
  }
  
  .join-group .btn {
    width: 100%;
  }

  header div {
    padding: 1rem 1.5rem 1rem 1rem !important;
  }

  header h1 {
    font-size: 2.2rem !important;
  }
}
