/* =========================================================
   DropLink – styles
   Mobile-first: base styles are for phones, the @media
   block at the bottom adjusts things for bigger screens.
   ========================================================= */

/* ---------- Colour palette & sizes (change these to re-theme) ---------- */
:root {
  --bg: #0d1020;            /* page background */
  --bg-glow: #1b1f45;       /* soft glow at the top of the page */
  --card: #161a30;          /* card background */
  --card-border: #262b4d;
  --input-bg: #0f1226;
  --text: #e8eaf6;
  --muted: #9aa0c3;
  --primary: #6c7cff;       /* main accent (Send) */
  --primary-2: #8f5bff;
  --accent: #22d3a6;        /* second accent (Receive / success) */
  --warn: #f5b942;
  --error: #ff6b7a;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -200px, var(--bg-glow), transparent 70%), var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  padding: 16px;
  max-width: 640px;
  margin: 0 auto;
}
.logo {
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  cursor: pointer;
  padding: 4px 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.logo span:last-child { color: var(--primary); }
.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-size: 1rem;
}

/* ---------- Layout ---------- */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 40px;
}
.screen { animation: fade-in 0.25s ease; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Home ---------- */
.hero-title {
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 24px 0 12px;
}
.hero-sub { color: var(--muted); margin: 0 0 28px; }

.home-buttons { display: grid; gap: 14px; }

.big-btn {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 16px;
  align-items: center;
  text-align: left;
  width: 100%;
  padding: 22px 20px;
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.big-btn:hover { filter: brightness(1.08); }
.big-btn:active { transform: scale(0.98); }
.big-btn-send    { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.big-btn-receive { background: linear-gradient(135deg, #12a387, var(--accent)); }
.big-btn-icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1.6rem;
  font-weight: 700;
}
.big-btn-label { font-size: 1.4rem; font-weight: 800; }
.big-btn-hint  { font-size: 0.9rem; opacity: 0.85; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 16px 0 8px;
}
.hint { color: var(--muted); font-size: 0.85rem; margin: 8px 0 0; }

/* ---------- Status pill ---------- */
.status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  font-weight: 600;
  font-size: 0.95rem;
}
.status::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}
.status[data-state="waiting"]::before   { background: var(--warn); animation: pulse 1.2s infinite; }
.status[data-state="connected"]::before { background: var(--accent); }
.status[data-state="done"]::before      { background: var(--accent); }
.status[data-state="error"]             { color: var(--error); }
.status[data-state="error"]::before     { background: var(--error); }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ---------- Room code ---------- */
.room-code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-align: center;
  padding: 12px 0;
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  user-select: all;
}

/* ---------- Inputs & buttons ---------- */
.input {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px stops iPhones from zooming in on focus */
}
.input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

.link-row, .code-form { display: flex; gap: 8px; }
.link-input { font-size: 0.9rem; color: var(--muted); }
.code-form { margin-top: 14px; }
.code-input {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  text-align: center;
}

.btn {
  flex: none;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary   { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; }
.btn-secondary { background: #262b4d; color: var(--text); }
.btn-ghost     { background: transparent; color: var(--muted); border-color: var(--card-border); }
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }

.actions { display: grid; gap: 10px; margin: 6px 0 14px; }
.actions .btn { width: 100%; }

/* ---------- QR ---------- */
.qr-wrap { text-align: center; margin-top: 18px; }
.qr {
  display: inline-block;
  padding: 12px;
  background: #fff;          /* QR codes need a light background to scan */
  border-radius: var(--radius-sm);
  line-height: 0;
  min-width: 204px;
  min-height: 204px;
}
.qr img, .qr canvas { display: block; }

/* ---------- Drop zone ---------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 28px 16px;
  border: 2px dashed var(--card-border);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--primary);
  background: rgba(108, 124, 255, 0.08);
}
.dropzone-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(108, 124, 255, 0.18);
  color: var(--primary);
  font-size: 1.6rem;
  margin-bottom: 6px;
}
.dropzone-title { font-weight: 700; }
.dropzone-hint  { color: var(--muted); font-size: 0.9rem; }

/* ---------- File lists ---------- */
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list:not(:empty) { margin-top: 14px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  margin-bottom: 8px;
}
.file-item-main { flex: 1; min-width: 0; }
.file-item-name {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item-meta { color: var(--muted); font-size: 0.85rem; }
.file-item.is-sent .file-item-meta { color: var(--accent); }
.remove-btn {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
}
.remove-btn:hover { color: var(--error); background: rgba(255, 107, 122, 0.1); }

/* ---------- Progress ---------- */
.file-count { color: var(--muted); font-size: 0.85rem; margin-bottom: 4px; }
.file-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.file-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.file-size { flex: none; color: var(--muted); }
.bar {
  height: 12px;
  border-radius: 999px;
  background: var(--input-bg);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.2s linear;  /* makes the bar move smoothly */
}
.stats {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.stats span:first-child { color: var(--text); font-weight: 700; }

/* ---------- Alerts & note ---------- */
.alert {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.alert-warn  { background: rgba(245, 185, 66, 0.12); color: var(--warn); }
.alert-error { background: rgba(255, 107, 122, 0.12); color: var(--error); margin: 0 0 14px; }

.note {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  margin: 24px auto 0;
  max-width: 460px;
}

/* ---------- Bigger screens (tablets / desktops) ---------- */
@media (min-width: 600px) {
  .hero-title { font-size: 2.6rem; margin-top: 40px; }
  .home-buttons { grid-template-columns: 1fr 1fr; }
  .big-btn {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    justify-items: center;
    text-align: center;
    row-gap: 6px;
    padding: 32px 20px;
  }
  .big-btn-icon { grid-row: auto; width: 64px; height: 64px; margin-bottom: 6px; }
  .card { padding: 24px; }
  .room-code { font-size: 3.2rem; }
  .actions { grid-template-columns: 1fr 1fr; }
  .actions-secondary { grid-template-columns: 1fr; }
}
