/* ─────────────────────────────────────────────
   ClipSync — Style Sheet
   Dark glassmorphism · Neon purple/cyan accent
───────────────────────────────────────────── */

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

:root {
  --bg:            #090b10;
  --surface:       rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.07);
  --border:        rgba(255,255,255,0.09);
  --border-bright: rgba(255,255,255,0.18);

  --accent:        #7c5cfc;
  --accent-light:  #a98bff;
  --accent-glow:   rgba(124,92,252,0.35);
  --cyan:          #0ff;
  --cyan-dim:      rgba(0,255,255,0.15);

  --text-primary:   #f0f0f8;
  --text-secondary: #8888a8;
  --text-muted:     #4a4a6a;

  --success: #2eff9a;
  --warning: #ffd166;
  --danger:  #ff6b6b;

  --radius:    16px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --font:  'Inter', system-ui, sans-serif;
  --mono:  'JetBrains Mono', 'Fira Code', monospace;

  --transition: 0.22s cubic-bezier(.4,0,.2,1);
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  overflow: hidden;
}

/* ── Utility ─────────────────────────────── */
.mono { font-family: var(--mono); }

/* ── Screen management ───────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: translateY(12px);
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

/* ── Background orbs ─────────────────────── */
.bg-orbs { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  animation: drift 14s ease-in-out infinite alternate;
}
.orb-1 { width: 520px; height: 520px; background: radial-gradient(circle, #7c5cfc55, transparent 70%); top: -120px; left: -80px; animation-duration: 17s; }
.orb-2 { width: 400px; height: 400px; background: radial-gradient(circle, #00ffff33, transparent 70%); bottom: -80px; right: -60px; animation-duration: 13s; animation-delay: -6s; }
.orb-3 { width: 280px; height: 280px; background: radial-gradient(circle, #ff6b6b22, transparent 70%); top: 40%; left: 50%; transform: translateX(-50%); animation-duration: 20s; animation-delay: -3s; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 20px) scale(1.08); }
}

/* ── Glass card ──────────────────────────── */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
}

/* ════════════════════════════════════════════
   LANDING SCREEN
════════════════════════════════════════════ */
.landing-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 440px;
  margin: 20px;
  padding: 40px 36px 32px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Brand */
.brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.brand-icon {
  width: 60px; height: 60px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #4ecdc4);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 32px var(--accent-glow);
  animation: iconPulse 3s ease-in-out infinite;
}
.brand-icon svg { width: 30px; height: 30px; color: #fff; }
@keyframes iconPulse {
  0%,100% { box-shadow: 0 0 24px var(--accent-glow); }
  50%      { box-shadow: 0 0 48px var(--accent-glow), 0 0 80px rgba(124,92,252,0.2); }
}
h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; background: linear-gradient(90deg, var(--accent-light), var(--cyan)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.tagline { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.5; }

/* Section divider */
.section-divider { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.section-divider::before, .section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  outline: none; text-decoration: none;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5c8aff);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
  width: 100%;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 32px var(--accent-glow); filter: brightness(1.1); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface-hover);
  border: 1px solid var(--border-bright);
  color: var(--text-primary);
  width: 100%;
}
.btn-secondary:hover { background: rgba(124,92,252,0.15); border-color: var(--accent); color: var(--accent-light); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
}
.btn-ghost:hover { border-color: var(--border-bright); color: var(--text-primary); background: var(--surface-hover); }

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #5c8aff);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-accent:hover { filter: brightness(1.1); box-shadow: 0 4px 20px var(--accent-glow); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* Digit inputs */
.code-input-group { display: flex; flex-direction: column; gap: 14px; }
.digit-inputs {
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.digit-box {
  width: 52px; height: 58px;
  background: var(--surface-hover);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 1.5rem; font-weight: 600;
  text-align: center;
  outline: none;
  transition: var(--transition);
  caret-color: var(--accent);
}
.digit-box:focus {
  border-color: var(--accent);
  background: rgba(124,92,252,0.08);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.digit-box.filled { border-color: var(--accent-light); color: var(--accent-light); }
.digit-sep { color: var(--text-muted); font-size: 1.2rem; margin: 0 2px; }

/* Error */
.error-msg { color: var(--danger); font-size: 0.8rem; text-align: center; min-height: 18px; transition: var(--transition); }
.footnote { color: var(--text-muted); font-size: 0.72rem; text-align: center; line-height: 1.6; }

/* ════════════════════════════════════════════
   CLIPBOARD SCREEN
════════════════════════════════════════════ */
#screen-clipboard {
  align-items: stretch;
  justify-content: stretch;
}

.clipboard-layout {
  position: relative; z-index: 10;
  display: flex; flex-direction: column;
  width: 100%; height: 100%;
  padding: 16px;
  gap: 12px;
}

/* Top bar */
.topbar {
  border-radius: var(--radius);
  padding: 12px 20px;
  display: flex; align-items: center;
  gap: 16px;
}
.topbar-left, .topbar-right { flex: 1; display: flex; align-items: center; gap: 10px; }
.topbar-right { justify-content: flex-end; }
.topbar-center { display: flex; justify-content: center; }

.brand-small {
  display: flex; align-items: center; gap: 7px;
  font-weight: 700; font-size: 0.95rem;
  color: var(--accent-light);
}
.brand-small svg { stroke: var(--accent-light); }

.room-code-display {
  display: flex; align-items: center; gap: 8px;
  background: rgba(124,92,252,0.1);
  border: 1px solid var(--accent);
  border-radius: 100px;
  padding: 6px 14px;
  cursor: default;
  transition: var(--transition);
}
.room-code-display:hover { background: rgba(124,92,252,0.18); }
.room-code-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.room-code-value { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.2em; color: var(--accent-light); }

.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); display: flex; align-items: center;
  padding: 2px; border-radius: 4px; transition: var(--transition);
}
.icon-btn:hover { color: var(--accent-light); }

/* Status pill */
.status-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 0.75rem; color: var(--text-secondary);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition);
}
.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}
.status-dot.disconnected { background: var(--danger); }
@keyframes pulse-dot {
  0%,100% { opacity: 1; } 50% { opacity: 0.4; }
}

/* User count */
.user-count {
  display: flex; align-items: center; gap: 5px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 10px;
  font-size: 0.78rem; color: var(--text-secondary);
  font-weight: 600;
}

/* Clipboard main */
.clipboard-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.clipboard-card {
  border-radius: var(--radius);
  padding: 0;
  display: flex; flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.clipboard-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px; flex-wrap: wrap;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; }
.toolbar-label { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }

/* Sync indicator */
.sync-indicator {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 500; color: var(--success);
  letter-spacing: 0.04em;
}
.sync-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 1.8s ease-in-out infinite;
}
.sync-indicator.syncing .sync-dot { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.sync-indicator.syncing #sync-text { color: var(--warning); }

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

/* Textarea */
.clipboard-textarea {
  flex: 1;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.75;
  padding: 20px;
  font-family: var(--mono);
  caret-color: var(--accent-light);
  transition: background 0.3s ease;
}
.clipboard-textarea::placeholder { color: var(--text-muted); font-style: italic; }
.clipboard-textarea.incoming-flash { animation: incomingFlash 0.4s ease; }
@keyframes incomingFlash {
  0%   { background: rgba(124,92,252,0.08); }
  100% { background: transparent; }
}

/* Scrollbar */
.clipboard-textarea::-webkit-scrollbar { width: 6px; }
.clipboard-textarea::-webkit-scrollbar-track { background: transparent; }
.clipboard-textarea::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }

/* Toast */
.toast {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15,15,25,0.95);
  border: 1px solid var(--border-bright);
  border-radius: 100px;
  padding: 10px 22px;
  font-size: 0.82rem;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 100;
  backdrop-filter: blur(16px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger); }

/* Info bar */
.infobar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 4px;
}
.info-text { font-size: 0.72rem; color: var(--text-muted); }

/* ── Responsive ──────────────────────────── */
@media (max-width: 600px) {
  .landing-card { padding: 28px 20px 24px; margin: 12px; }
  .digit-box { width: 42px; height: 50px; font-size: 1.2rem; }
  h1 { font-size: 1.6rem; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .brand-small span { display: none; }
  .clipboard-layout { padding: 10px; gap: 8px; }
  .toolbar-label { display: none; }
}
