:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(56, 189, 248, 0.3);
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-blue: #3b82f6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --danger: #ef4444;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: radial-gradient(circle at 50% 0%, #1e1b4b 0%, var(--bg-primary) 65%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
  line-height: 1.5;
}

.app-container {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 40px;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

.brand h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #ffffff, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand .subtext {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
}

.nav-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.badge-zero-data {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  white-space: nowrap;
}

/* Card Styles */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s ease;
}

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

/* QR & Room Card */
.qr-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.qr-content {
  display: flex;
  gap: 28px;
  align-items: center;
}

.qr-box {
  position: relative;
  width: 190px;
  height: 190px;
  min-width: 190px;
  background: #ffffff;
  padding: 8px;
  border-radius: var(--radius-md);
  box-shadow: 0 0 30px rgba(6, 182, 212, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-box canvas {
  width: 100%;
  height: 100%;
  border-radius: 4px;
}

.qr-scan-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  animation: scan 2.5s ease-in-out infinite;
  box-shadow: 0 0 8px var(--accent-cyan);
}

@keyframes scan {
  0% { top: 5%; opacity: 0; }
  50% { opacity: 1; }
  100% { top: 95%; opacity: 0; }
}

.qr-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  width: fit-content;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.room-code-display {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.room-code-label {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 700;
}

.room-code-digits {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 4px;
  color: #38bdf8;
  font-family: monospace;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
}

.pairing-instruction {
  font-size: 13px;
  color: var(--text-muted);
}

.manual-join-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.manual-join-row input {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 170px;
  outline: none;
  font-family: monospace;
  letter-spacing: 2px;
  text-align: center;
}

.manual-join-row input:focus {
  border-color: var(--accent-cyan);
}

/* Connected Banner */
.connected-card {
  padding: 16px 20px;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.15), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.connected-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.connected-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: #34d399;
}

.live-dot-green {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
}

/* Upload Card & Dropzone */
.upload-card {
  padding: 0;
  overflow: hidden;
}

.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  transition: all 0.25s ease;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.4);
}

.dropzone.drag-active {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
  transform: scale(0.99);
}

.file-input-hidden {
  display: none;
}

.upload-icon-circle {
  width: 64px;
  height: 64px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
}

.dropzone h3 {
  font-size: 18px;
  margin-bottom: 6px;
}

.dropzone p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.upload-btn-group {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Active Transfer Progress Card */
.transfer-card {
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(15, 23, 42, 0.9));
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.transfer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.transfer-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pulse-icon {
  font-size: 24px;
  animation: pulse 1s infinite;
}

.transfer-header h3 {
  font-size: 16px;
  font-weight: 600;
  max-width: 400px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.transfer-stats {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.highlight-speed {
  color: #34d399;
  font-weight: 700;
  font-size: 14px;
}

.dot-separator {
  color: var(--text-dim);
}

.progress-bar-container {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
  border-radius: 5px;
  transition: width 0.15s ease-out;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.transfer-footer {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* Files List Section */
.tabs-header {
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.tabs-header h3 {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  background: var(--accent-cyan);
  color: #0f172a;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

.files-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.file-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.file-type-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(56, 189, 248, 0.15);
}

.file-meta {
  min-width: 0;
  flex: 1;
}

.file-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-subtext {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

/* Buttons */
button {
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border: none;
  color: #ffffff;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-small {
  padding: 7px 12px;
  font-size: 13px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

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

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
}

.modal-body textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  margin: 10px 0 16px;
  outline: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-hint {
  font-size: 13px;
  color: var(--text-muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  pointer-events: none;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 14px;
}

.hidden {
  display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  .qr-content {
    flex-direction: column;
    text-align: center;
  }
  .qr-box {
    margin: 0 auto;
  }
  .badge-pill {
    margin: 0 auto;
  }
  .manual-join-row {
    justify-content: center;
  }
  .brand h1 {
    font-size: 18px;
  }
  .mobile-only {
    display: inline-block !important;
  }
}

@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }
}
