/* ─── Reset & Variables ──────────────────────────────────────────────────── */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0b0f;
  --surface: #12141c;
  --surface2: #1a1d2a;
  --surface3: #222638;
  --border: #2a2e42;
  --border-glow: #3d4466;
  --text: #e4e6f0;
  --text-dim: #8b90a8;
  --text-muted: #565b78;
  --accent: #6c5ce7;
  --accent-glow: #8b7cf7;
  --accent-dim: rgba(108, 92, 231, 0.15);
  --green: #00d68f;
  --green-dim: rgba(0, 214, 143, 0.12);
  --red: #ff6b6b;
  --red-dim: rgba(255, 107, 107, 0.12);
  --orange: #ffa94d;
  --radius: 12px;
  --radius-sm: 8px;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

html { font-size: 16px; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Noise Overlay ──────────────────────────────────────────────────────── */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* ─── Ambient Glow ───────────────────────────────────────────────────────── */

.glow-orb {
  position: fixed;
  width: 600px; height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.07;
  pointer-events: none;
  z-index: 0;
}

.glow-orb.purple { background: #6c5ce7; top: -200px; right: -100px; }
.glow-orb.green  { background: #00d68f; bottom: -200px; left: -100px; }

/* ─── Layout ─────────────────────────────────────────────────────────────── */

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  background: rgba(10, 11, 15, 0.8);
  position: sticky;
  top: 0;
  z-index: 100;
}

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

/* ─── Logo ───────────────────────────────────────────────────────────────── */

.logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.logo-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
}

/* ─── Status Pill ────────────────────────────────────────────────────────── */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ─── Views ──────────────────────────────────────────────────────────────── */

.view            { display: none; width: 100%; max-width: 720px; }
.view.active     { display: block; }
.view-drive      { max-width: 960px; }

/* ─── Landing / Hero ─────────────────────────────────────────────────────── */

.landing-container { text-align: center; }

.hero-title {
  font-family: var(--mono);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-top: 0;
  margin-bottom: 16px;
}

.hero-title .accent { color: var(--accent-glow); }
.hero-title .green  { color: var(--green); }

.hero-sub {
  color: var(--text-dim);
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 520px;
  margin: 0 auto 48px;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.actions-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
}
.btn-primary:hover {
  background: var(--accent-glow);
  box-shadow: 0 6px 30px rgba(108, 92, 231, 0.45);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  border-color: var(--border-glow);
  background: var(--surface);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-copy {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-copy:hover  { border-color: var(--accent); color: var(--accent-glow); }
.btn-copy.copied { border-color: var(--green); color: var(--green); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255, 107, 107, 0.2);
}
.btn-danger:hover { background: rgba(255, 107, 107, 0.2); }

.btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.15s;
}
.btn-icon:hover          { color: var(--text); border-color: var(--border-glow); }
.btn-icon.download:hover { border-color: var(--accent); color: var(--accent-glow); }
.btn-icon.remove:hover   { color: var(--red); border-color: var(--red); }

/* ─── Join Input ─────────────────────────────────────────────────────────── */

.join-section {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.code-input {
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-align: center;
  width: 220px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  text-transform: uppercase;
  transition: border-color 0.2s;
}
.code-input:focus { border-color: var(--accent); }
.code-input::placeholder {
  letter-spacing: 0.15em;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ─── Feature Cards ──────────────────────────────────────────────────────── */

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 56px;
}

.feature-card {
  padding: 24px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: left;
  transition: border-color 0.2s;
}
.feature-card:hover { border-color: var(--border-glow); }
.feature-icon       { font-size: 1.5rem; margin-bottom: 12px; }
.feature-card h3    { font-size: 0.9rem; font-weight: 600; margin-bottom: 6px; }
.feature-card p     { font-size: 0.8rem; color: var(--text-dim); line-height: 1.5; }

/* ─── Drive Header ───────────────────────────────────────────────────────── */

.drive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.drive-code-display { display: flex; align-items: center; gap: 16px; }

.drive-code {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent-glow);
  background: var(--accent-dim);
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(108, 92, 231, 0.25);
}

.drive-meta      { display: flex; gap: 16px; align-items: center; }
.drive-meta-item { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--text-dim); }

/* ─── Drop Zone ──────────────────────────────────────────────────────────── */

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 32px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-dim), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.dropzone.dragover              { border-color: var(--accent); background: var(--accent-dim); }
.dropzone.dragover::before      { opacity: 1; }
.dropzone.dragover .drop-icon   { transform: scale(1.15) translateY(-4px); }

.drop-icon { font-size: 2.5rem; margin-bottom: 12px; transition: transform 0.3s ease; position: relative; }
.drop-text { font-size: 1rem; font-weight: 500; margin-bottom: 6px; position: relative; }
.drop-hint { font-size: 0.8rem; color: var(--text-muted); position: relative; }

.file-input-hidden {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* ─── File List ──────────────────────────────────────────────────────────── */

.file-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.file-list-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.file-count {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  animation: fileSlideIn 0.3s ease;
}

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

.file-item:hover { border-color: var(--border-glow); }

.file-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.file-icon.img   { background: rgba(255, 107, 107, 0.1); }
.file-icon.vid   { background: rgba(108, 92, 231, 0.1); }
.file-icon.doc   { background: rgba(0, 214, 143, 0.1); }
.file-icon.zip   { background: rgba(255, 169, 77, 0.1); }
.file-icon.other { background: var(--surface2); }

.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 0.78rem; color: var(--text-muted); font-family: var(--mono); }

.file-owner-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--green-dim);
  color: var(--green);
  font-weight: 600;
}

.file-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ─── Download Progress ─────────────────────────────────────────────────── */

.download-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  pointer-events: none;
}

.download-progress-info {
  display: flex;
  justify-content: space-between;
  padding: 0 18px 6px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.download-progress-info .dl-percent {
  color: var(--accent-glow);
  font-weight: 600;
}

.download-progress-info .dl-speed {
  color: var(--text-dim);
}

.download-progress-bar {
  height: 3px;
  background: var(--surface3);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow: hidden;
}

.download-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-glow));
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: width 0.15s ease;
}

.file-item.downloading {
  opacity: 1;
  padding-bottom: 26px;
}

.file-item.downloading .btn-icon {
  pointer-events: none;
}

/* ─── Upload Indicator (sender side) ─────────────────────────────────────── */

.upload-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  pointer-events: none;
}

.upload-indicator-info {
  display: flex;
  justify-content: space-between;
  padding: 0 18px 6px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.upload-indicator-info .ul-label {
  color: var(--green);
  font-weight: 600;
}

.upload-indicator-info .ul-speed {
  color: var(--text-dim);
}

.upload-indicator-bar {
  height: 3px;
  background: var(--surface3);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow: hidden;
}

.upload-indicator-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green), #2ee6a6);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: width 0.15s ease;
}

.file-item.uploading {
  padding-bottom: 26px;
}

.empty-state           { text-align: center; padding: 40px; color: var(--text-muted); font-size: 0.9rem; }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.5; }

/* ─── Share Panel ────────────────────────────────────────────────────────── */

.share-panel {
  margin-top: 28px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.share-panel-inner {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  width: 80%;
  margin: 0 auto;
}

.share-info {
  flex: 1;
  min-width: 0;
}

.share-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.share-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.share-url {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px 8px 14px;
  margin-bottom: 18px;
}

.share-url-text {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent-glow);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: all;
}

.share-tips {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.share-tips li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.share-tips li .icon {
  width: 0.9rem;
  height: 0.9rem;
  flex-shrink: 0;
  opacity: 0.6;
}

.share-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#qr-canvas { border-radius: var(--radius-sm); }

.share-qr-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

@media (max-width: 700px) {
  .share-panel-inner { flex-direction: column; align-items: center; }
  .share-info { text-align: center; }
  .share-tips li { justify-content: center; }
}

/* ─── Toast ──────────────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--surface2);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red); color: var(--red); }
.toast.info    { border-color: var(--accent); color: var(--accent-glow); }

@keyframes toastIn  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }

/* ─── Spinner ────────────────────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
  header          { padding: 16px 20px; }
  main            { padding: 20px; }
  .features       { grid-template-columns: 1fr; }
  .drive-header   { flex-direction: column; align-items: flex-start; }
  .file-item      { padding: 12px 14px; }
  .dropzone       { padding: 32px 20px; }
}

/* ─── SVG Icons (multicolor — displayed as background-image) ─────────────── */
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: -0.125em;
  flex-shrink: 0;
}
.icon-bolt         { background-image: url(/icons/bolt.svg); }
.icon-lock         { background-image: url(/icons/lock.svg); }
.icon-wind         { background-image: url(/icons/wind.svg); }
.icon-globe        { background-image: url(/icons/globe.svg); }
.icon-user         { background-image: url(/icons/user.svg); }
.icon-clipboard    { background-image: url(/icons/clipboard.svg); }
.icon-close        { background-image: url(/icons/close.svg); }
.icon-folder       { background-image: url(/icons/folder.svg); }
.icon-inbox-empty  { background-image: url(/icons/inbox-empty.svg); }
.icon-download     { background-image: url(/icons/download.svg); }
.icon-check        { background-image: url(/icons/check.svg); }
.icon-x-circle     { background-image: url(/icons/x-circle.svg); }
.icon-info         { background-image: url(/icons/info.svg); }
.icon-file-image   { background-image: url(/icons/file-image.svg); }
.icon-file-video   { background-image: url(/icons/file-video.svg); }
.icon-file-doc     { background-image: url(/icons/file-doc.svg); }
.icon-file-archive { background-image: url(/icons/file-archive.svg); }
.icon-file-generic { background-image: url(/icons/file-generic.svg); }
.icon-logo         { background-image: url(/icons/favicon.svg); }
/* Size variants */
.icon-sm  { width: 0.85em; height: 0.85em; }
.icon-lg  { width: 1.5em;  height: 1.5em; }
.icon-xl  { width: 2.5em;  height: 2.5em; }
/* Feature card icon sizing */
.feature-icon .icon { width: 1.5rem; height: 1.5rem; }
/* Drop zone icon */
.drop-icon .icon { width: 2.5rem; height: 2.5rem; }
/* Empty state icon */
.empty-icon .icon { width: 2.5rem; height: 2.5rem; }
/* Logo icon */
.logo-icon .icon { width: 100%; height: 100%; }
/* File icon sizes in file list */
.file-icon .icon { width: 1.3rem; height: 1.3rem; }
/* Button icon sizing */
.btn-icon .icon { width: 1rem; height: 1rem; }
/* Toast icon sizing */
.toast .icon { width: 1rem; height: 1rem; }