/* ============================================================================
 * Graspins Send — styles
 * A small, self-contained dark theme. No external fonts or assets so the app
 * stays fully self-hosted on cPanel.
 * ========================================================================= */

:root {
  /* palette */
  --bg: #0b1020;
  --bg-grad: radial-gradient(1200px 600px at 50% -10%, #16203f 0%, #0b1020 55%);
  --surface: #141a30;
  --surface-2: #1b2240;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #e8ecf8;
  --text-muted: #99a2c0;
  --text-faint: #6f7798;

  --accent: #5b8cff;
  --accent-hover: #7aa0ff;
  --accent-ink: #07101f;
  --success: #3ecf8e;
  --danger: #ff6b6b;
  --warn: #ffcf6b;

  /* scale */
  --radius: 14px;
  --radius-sm: 10px;
  --gap: 16px;
  --maxw: 720px;

  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --ring: 0 0 0 3px rgba(91, 140, 255, 0.45);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
}

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* accessibility: skip link + focus */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 10;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 0 0 var(--radius-sm) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* ---- header / status ---- */
.site-header { padding: 18px 0; border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #9b6bff);
  box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.12);
}
.brand-name { font-weight: 700; letter-spacing: 0.2px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); font-size: 13px; color: var(--text-muted);
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); flex: none; }
.status-pill[data-state="connecting"] .status-dot,
.status-pill[data-state="waiting"] .status-dot { background: var(--warn); animation: pulse 1.2s infinite; }
.status-pill[data-state="connected"] .status-dot,
.status-pill[data-state="transferring"] .status-dot { background: var(--accent); animation: pulse 1.2s infinite; }
.status-pill[data-state="done"] .status-dot { background: var(--success); }
.status-pill[data-state="failed"] .status-dot { background: var(--danger); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .status-dot { animation: none !important; } }

/* ---- banners ---- */
.banner { margin: 16px auto 0; max-width: var(--maxw); padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; }
.banner-error { background: rgba(255, 107, 107, 0.12); border: 1px solid rgba(255, 107, 107, 0.4); color: #ffd0d0; }

/* ---- main / screens ---- */
main { flex: 1; padding: 32px 0 56px; }
.screen { animation: fade 0.25s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } }

.screen-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.screen-head h2 { margin: 0; font-size: 22px; }

h2:focus, h1:focus { outline: none; }

/* ---- landing ---- */
.hero-title { font-size: clamp(28px, 6vw, 40px); line-height: 1.1; margin: 8px 0 12px; letter-spacing: -0.5px; }
.hero-sub { color: var(--text-muted); font-size: 17px; max-width: 52ch; margin: 0 0 28px; }
.hero-note { color: var(--text-faint); font-size: 13px; margin-top: 22px; }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.action-card {
  text-align: left; cursor: pointer; appearance: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; display: flex; flex-direction: column; gap: 8px; color: var(--text);
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.action-card:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-2px); }
.action-card:disabled { opacity: 0.5; cursor: not-allowed; }
.action-title { font-size: 20px; font-weight: 700; }
.action-desc { color: var(--text-muted); font-size: 14px; }

/* ---- buttons / links ---- */
.btn {
  appearance: none; cursor: pointer; font: inherit; font-weight: 600;
  border-radius: var(--radius-sm); padding: 12px 20px; border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s; line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: #232c52; }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(255, 107, 107, 0.5); }
.btn-danger:hover:not(:disabled) { background: rgba(255, 107, 107, 0.12); }

.link-back, .link-clear {
  appearance: none; background: none; border: none; cursor: pointer; color: var(--text-muted);
  font: inherit; padding: 6px 8px; border-radius: 8px;
}
.link-back::before { content: "\2190  "; }
.link-back:hover, .link-clear:hover { color: var(--text); }

.actions-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }

/* ---- dropzone ---- */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface); padding: 40px 24px; text-align: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--surface-2); }
.dropzone-main { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.dropzone-sub { color: var(--text-faint); margin: 0 0 14px; }

/* ---- file list ---- */
.file-list { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.file-remove {
  appearance: none; background: none; border: none; cursor: pointer; color: var(--text-faint);
  font: inherit; font-size: 13px; padding: 4px 8px; border-radius: 8px; flex: none;
}
.file-remove:hover { color: var(--danger); }

.file-total {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; color: var(--text-muted); font-size: 14px;
}

/* ---- send text / link ---- */
.text-send { margin-top: 22px; }
.text-input {
  width: 100%; font: inherit; resize: vertical; min-height: 72px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 12px 14px;
}
.text-input::placeholder { color: var(--text-faint); }

/* small button variant (used for received text) */
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }

/* received text/link result */
.text-result { display: flex; align-items: flex-start; gap: 10px; margin-top: 6px; }
.text-content {
  flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; color: var(--text); font-size: 14px;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; max-height: 240px; overflow: auto;
}
.text-result .btn-sm { flex: none; width: auto; }

/* ---- code / share ---- */
.code-block {
  margin-top: 8px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; text-align: center;
}
.code-label { margin: 0 0 8px; color: var(--text-muted); font-size: 14px; }
.code-value {
  margin: 0; font-size: clamp(30px, 9vw, 46px); font-weight: 800; letter-spacing: 6px;
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  color: var(--text); word-break: break-all;
}
.code-expiry { margin: 8px 0 16px; color: var(--text-faint); font-size: 13px; }
.share-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.qr-wrap { margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr {
  background: #ffffff; padding: 12px; border-radius: var(--radius-sm); line-height: 0;
  width: 200px; height: 200px; display: flex; align-items: center; justify-content: center;
}
.qr svg { width: 100%; height: 100%; display: block; }
.qr-caption { color: var(--text-faint); font-size: 13px; text-align: center; margin: 0; }

/* ---- receive form ---- */
.field-label { display: block; font-weight: 600; margin-bottom: 8px; }
.code-input {
  width: 100%; font: inherit; font-size: 24px; letter-spacing: 4px; text-transform: uppercase;
  font-family: ui-monospace, "SF Mono", Consolas, monospace; text-align: center;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 14px 16px;
}
.code-input::placeholder { color: var(--text-faint); letter-spacing: 2px; text-transform: none; }
.field-help { color: var(--text-faint); font-size: 13px; margin: 8px 0 0; }

.advanced { margin-top: 20px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 14px; background: var(--surface); }
.advanced summary { cursor: pointer; padding: 10px 0; color: var(--text-muted); font-size: 14px; }
.advanced-text { color: var(--text-muted); font-size: 13px; }
.folder-chosen { display: inline-block; margin-top: 8px; color: var(--success); font-size: 13px; }

/* ---- progress ---- */
.progress-area { margin-top: 24px; }
.progress-overall {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
}
.progress-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.progress-title { font-weight: 700; }
.progress-pct { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; }
.progress-bar { background: rgba(255, 255, 255, 0.08); border-radius: 999px; height: 10px; overflow: hidden; }
.progress-bar.small { height: 6px; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #9b6bff); border-radius: 999px; transition: width 0.2s ease; }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.xfer-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.xfer-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.xfer-info { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.xfer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xfer-size { color: var(--text-muted); font-size: 13px; flex: none; font-variant-numeric: tabular-nums; }
.xfer-status { margin-top: 8px; font-size: 13px; color: var(--text-muted); min-height: 1.2em; }
.download-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.download-link:hover { text-decoration: underline; }

.inline-error {
  background: rgba(255, 107, 107, 0.12); border: 1px solid rgba(255, 107, 107, 0.4);
  color: #ffd0d0; padding: 12px 14px; border-radius: var(--radius-sm); margin: 0 0 16px; font-size: 14px;
}

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--border); padding: 20px 0; color: var(--text-faint); font-size: 13px; }
.site-footer p { margin: 0; }
.dot-sep { margin: 0 6px; }

/* ---- responsive ---- */
@media (max-width: 560px) {
  .action-grid { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .actions-row .btn { width: 100%; }
  .share-row .btn { width: auto; flex: 1; }
  .site-header .wrap { flex-direction: row; }
  .status-text { display: none; }
  .status-pill { padding: 6px; }
}
