/* ========================================
   DropBeam — Design System
   Cyberpunk Dark Theme
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* --- Tokens --- */
:root {
  --bg-deep: #070B14;
  --bg-base: #0F172A;
  --bg-card: #1E293B;
  --bg-elevated: #273548;
  --border: #334155;
  --border-glow: #22C55E40;
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --accent: #22C55E;
  --accent-dim: #16A34A;
  --accent-glow: #22C55E60;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 200ms ease;
}

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

/* --- Base --- */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scanline overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

/* --- Typography --- */
h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* --- App Shell --- */
.app-container {
  width: 100%;
  max-width: 520px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

/* --- Logo --- */
.logo-section {
  text-align: center;
  margin-top: 48px;
  margin-bottom: 40px;
}

.logo-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px var(--accent-glow), 0 4px 20px rgba(0, 0, 0, 0.4);
}

.logo-icon svg {
  width: 32px;
  height: 32px;
  color: var(--bg-deep);
}

.logo-title {
  font-size: 2rem;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.logo-title span {
  color: var(--accent);
}

.logo-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* --- Cards --- */
.card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  margin-bottom: 16px;
  transition: border-color var(--transition);
}

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

.card-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  outline: none;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-deep);
  width: 100%;
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-dim);
  box-shadow: 0 0 30px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  width: 100%;
}

.btn-secondary:hover {
  background: var(--border);
  border-color: var(--text-muted);
}

.btn-icon {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: var(--radius-sm);
}

.btn-icon:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* --- Inputs --- */
.input-group {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.input {
  flex: 1;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-align: center;
  text-transform: uppercase;
  padding: 14px 16px;
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition);
}

.input::placeholder {
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: none;
  font-weight: 400;
  font-size: 0.9rem;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* --- Divider --- */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 8px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* --- Room Info --- */
.room-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.room-code {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
}

.room-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

/* --- QR Code --- */
.qr-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}

.qr-container {
  background: #ffffff;
  padding: 12px;
  border-radius: var(--radius);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.15);
}

.qr-container canvas {
  display: block;
  border-radius: 4px;
}

.qr-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- Status Badge --- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-badge.waiting .status-dot {
  background: var(--warning);
  animation: pulse 1.5s infinite;
}

.status-badge.connected .status-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.status-badge.disconnected .status-dot {
  background: var(--danger);
}

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

/* --- Drop Zone --- */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(34, 197, 94, 0.05);
}

.drop-zone.drag-over {
  box-shadow: inset 0 0 30px rgba(34, 197, 94, 0.08);
}

.drop-zone-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--text-muted);
  transition: color var(--transition);
}

.drop-zone:hover .drop-zone-icon,
.drop-zone.drag-over .drop-zone-icon {
  color: var(--accent);
}

.drop-zone-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.drop-zone-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* --- Transfer List --- */
.transfer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.transfer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.transfer-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.transfer-icon svg {
  width: 18px;
  height: 18px;
}

.transfer-details {
  flex: 1;
  min-width: 0;
}

.transfer-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.transfer-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.transfer-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.transfer-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 100ms linear;
  box-shadow: 0 0 8px var(--accent-glow);
}

.transfer-status {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
}

.transfer-status.sending {
  color: var(--info);
}

.transfer-status.complete {
  color: var(--accent);
}

.transfer-status.error {
  color: var(--danger);
}

/* --- Toast --- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  font-size: 0.85rem;
  color: var(--text-primary);
  pointer-events: auto;
  animation: toastIn 300ms ease;
  max-width: 340px;
}

.toast.success {
  border-color: var(--accent);
}

.toast.error {
  border-color: var(--danger);
}

.toast.info {
  border-color: var(--info);
}

.toast-exit {
  animation: toastOut 300ms ease forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* --- View Transitions --- */
.view {
  display: none;
  width: 100%;
  animation: fadeIn 300ms ease;
}

.view.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

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

/* --- Footer --- */
.footer {
  margin-top: auto;
  padding: 32px 0 20px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .app-container {
    padding: 16px 12px;
  }

  .logo-title {
    font-size: 1.6rem;
  }

  .card {
    padding: 20px 16px;
  }

  .room-code {
    font-size: 1.3rem;
  }

  .drop-zone {
    padding: 36px 16px;
  }
}

/* --- Utility --- */
.hidden {
  display: none !important;
}

.w-full {
  width: 100%;
}

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

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.gap-8 {
  gap: 8px;
}
