/* ==========================================================================
   PulseDrop P2P - Global Design System & Stylesheet (Lightweight & Themes)
   ========================================================================== */

:root {
  /* Default Cyberpunk Theme */
  --bg-dark: #080b13;
  --bg-card: rgba(18, 24, 40, 0.7);
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --bg-card-hover: rgba(25, 34, 56, 0.85);
  
  --color-primary: #00f2fe;
  --color-primary-glow: rgba(0, 242, 254, 0.35);
  --color-secondary: #4facfe;
  --color-accent: #7f53ac;
  --color-success: #00f5a0;
  --color-danger: #ff4757;
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  
  --shadow-card: 0 16px 40px rgba(0, 0, 0, 0.5);
  --transition-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Theme 2: OLED Pure Black (Maximum Battery Saver) */
body.theme-oled {
  --bg-dark: #000000;
  --bg-card: rgba(10, 10, 10, 0.9);
  --bg-card-border: rgba(255, 255, 255, 0.12);
  --color-primary: #00f2fe;
  --color-primary-glow: rgba(0, 242, 254, 0.2);
  --shadow-card: none;
}

/* Theme 3: Modern High-Contrast Light Glass */
body.theme-light {
  --bg-dark: #f0f4f8;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-border: rgba(0, 0, 0, 0.1);
  --color-primary: #0066ff;
  --color-primary-glow: rgba(0, 102, 255, 0.2);
  --color-secondary: #00c6ff;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Canvas */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: auto;
}

/* Top Control Bar */
.top-controls-bar {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  gap: 10px;
}

.btn-icon-glass {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(16px);
  color: var(--text-main);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s var(--transition-smooth);
}

.btn-icon-glass:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 15px var(--color-primary-glow);
  transform: scale(1.05);
}

/* Main Container */
.app-container {
  width: 100%;
  max-width: 1200px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 24px;
  z-index: 1;
}

/* Glassmorphism Card */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

/* Header */
.app-header {
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

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

.logo-icon-pulse {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
  box-shadow: 0 0 20px var(--color-primary-glow);
}

.brand-text h1 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-text .highlight {
  color: var(--color-primary);
}

.badge-p2p {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-success);
  background: rgba(0, 245, 160, 0.1);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(0, 245, 160, 0.2);
}

/* Navigation Tabs */
.tab-navigation {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px;
  border-radius: 16px;
  border: 1px solid var(--bg-card-border);
  gap: 4px;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s var(--transition-smooth);
}

.nav-tab:hover {
  color: var(--text-main);
}

.nav-tab.active {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.2), rgba(79, 172, 254, 0.2));
  color: var(--color-primary);
  border: 1px solid rgba(0, 242, 254, 0.4);
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.15);
}

/* Status Badge */
.network-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--bg-card-border);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-dot.offline { background: #ff4757; box-shadow: 0 0 10px #ff4757; }
.status-dot.online { background: #00f5a0; box-shadow: 0 0 10px #00f5a0; }
.status-dot.transferring { background: #00f2fe; box-shadow: 0 0 12px #00f2fe; animation: blink 0.8s infinite alternate; }

@keyframes blink {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

/* Main Content Panels */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.panel-section {
  display: none;
  width: 100%;
  animation: fadeIn 0.3s ease forwards;
}

.panel-section.active {
  display: block;
}

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

.grid-layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .grid-layout {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card-header h3 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.card-desc {
  color: var(--text-muted);
  font-size: 14px;
}

/* Dropzone */
.dropzone {
  border: 2px dashed rgba(0, 242, 254, 0.25);
  border-radius: var(--radius-md);
  padding: 40px 24px;
  text-align: center;
  background: rgba(0, 0, 0, 0.15);
  transition: all 0.3s var(--transition-smooth);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--color-primary);
  background: rgba(0, 242, 254, 0.05);
  box-shadow: inset 0 0 30px rgba(0, 242, 254, 0.1);
}

.dropzone-visual {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-icon-wrapper {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(0, 242, 254, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  z-index: 2;
}

.drop-icon-wrapper svg { width: 32px; height: 32px; }

.orbit-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(0, 242, 254, 0.3);
}

.ring-1 { width: 80px; height: 80px; animation: spin 12s linear infinite; }
.ring-2 { width: 100px; height: 100px; animation: spin-reverse 18s linear infinite; }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes spin-reverse { from { transform: rotate(360deg); } to { transform: rotate(0deg); } }

.drop-title { font-family: var(--font-heading); font-size: 20px; font-weight: 700; }
.drop-subtitle { color: var(--text-muted); font-size: 13px; max-width: 360px; }

.drop-action-group {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: #050b14;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  transition: all 0.3s var(--transition-smooth);
  box-shadow: 0 4px 20px var(--color-primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--color-primary-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--bg-card-border);
  color: var(--text-main);
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--bg-card-border);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-glass:hover {
  background: rgba(0, 242, 254, 0.1);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-primary-sm {
  background: var(--color-primary);
  color: #050b14;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-primary-sm:hover { box-shadow: 0 0 15px var(--color-primary-glow); }

.btn-glass-action {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--bg-card-border);
  color: var(--text-main);
  padding: 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.btn-glass-action:hover {
  background: rgba(0, 242, 254, 0.08);
  border-color: rgba(0, 242, 254, 0.3);
  color: var(--color-primary);
}

.btn-success {
  background: linear-gradient(135deg, #00f5a0, #00d2ff);
  color: #050b14;
  font-weight: 800;
  padding: 14px 28px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 15px;
  box-shadow: 0 4px 20px rgba(0, 245, 160, 0.3);
  transition: all 0.3s var(--transition-smooth);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 245, 160, 0.5);
}

/* File Queue List */
.file-queue-container { display: flex; flex-direction: column; gap: 12px; }
.queue-header { display: flex; justify-content: space-between; align-items: center; }
.queue-header h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }

.total-size-badge {
  background: rgba(0, 242, 254, 0.1);
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 242, 254, 0.2);
}

.btn-text-danger {
  background: none;
  border: none;
  color: var(--color-danger);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.file-queue-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.file-item {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--bg-card-border);
  padding: 12px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.file-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

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

.file-item-size {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.btn-remove-file {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s ease;
}

.btn-remove-file:hover {
  color: var(--color-danger);
}

/* Sharing Box */
.share-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-box-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tag-live {
  background: rgba(0, 245, 160, 0.15);
  color: var(--color-success);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.code-display-group { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.room-code-badge {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--color-primary);
  background: rgba(0, 242, 254, 0.06);
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px dashed rgba(0, 242, 254, 0.3);
}

.input-group { display: flex; gap: 8px; }
.margin-top-sm { margin-top: 8px; }

.glass-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--bg-card-border);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-family: var(--font-mono);
  outline: none;
  transition: border-color 0.3s ease;
}

.glass-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 10px var(--color-primary-glow);
}

.share-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Monitor Card */
.transfer-monitor-box {
  background: rgba(0, 242, 254, 0.03);
  border: 1px solid rgba(0, 242, 254, 0.2);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.monitor-header { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-primary); font-weight: 600; }
.pulse-indicator { width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); box-shadow: 0 0 10px var(--color-primary); animation: blink 0.8s infinite alternate; }

.progress-ring-container { position: relative; width: 120px; height: 120px; display: flex; align-items: center; justify-content: center; }
.progress-ring-text { position: absolute; display: flex; flex-direction: column; align-items: center; }
.percent-val { font-family: var(--font-heading); font-size: 24px; font-weight: 800; color: var(--text-main); }
.speed-val { font-family: var(--font-mono); font-size: 11px; color: var(--color-primary); }
.progress-ring-fill { transition: stroke-dashoffset 0.15s ease; transform: rotate(-90deg); transform-origin: 50% 50%; }

.monitor-details { width: 100%; display: flex; justify-content: space-around; font-size: 12px; color: var(--text-muted); }
.monitor-details strong { color: var(--text-main); font-family: var(--font-mono); }

/* Receiver Container */
.receive-container { max-width: 540px; margin: 0 auto; width: 100%; }
.receive-card { align-items: stretch; }
.card-header.center { text-align: center; }

.receive-icon-badge {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(79, 172, 254, 0.1); color: var(--color-secondary);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px auto; border: 1px solid rgba(79, 172, 254, 0.3);
}

.code-entry-form { display: flex; flex-direction: column; gap: 10px; }
.code-entry-form label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.pin-input-group { display: flex; gap: 10px; }
.pin-input { font-size: 20px; letter-spacing: 3px; text-align: center; font-weight: 700; }

.receiver-transfer-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(0, 245, 160, 0.2);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.incoming-file-header { display: flex; align-items: center; gap: 14px; }
.file-type-icon { width: 40px; height: 40px; color: var(--color-success); }
.file-meta h4 { font-size: 16px; font-weight: 600; }
.file-meta p { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }

.progress-bar-wrapper { width: 100%; height: 10px; background: rgba(255, 255, 255, 0.08); border-radius: 5px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--color-primary), var(--color-success)); border-radius: 5px; transition: width 0.15s ease; box-shadow: 0 0 12px var(--color-success); }
.transfer-stats-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); }
.transfer-stats-row strong { color: var(--text-main); font-family: var(--font-mono); }
.rx-actions-group { display: flex; justify-content: center; margin-top: 8px; }

/* Settings Drawer Modal */
.settings-card {
  max-width: 480px;
  text-align: left;
  align-items: stretch;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 10px 0;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.setting-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-text span {
  font-size: 14px;
  font-weight: 600;
}

.setting-text small {
  font-size: 11px;
  color: var(--text-muted);
}

.glass-select {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--bg-card-border);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
}

.glass-toggle {
  width: 20px;
  height: 20px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.full-width {
  width: 100%;
}

/* Footer Specs & Diagnostics */
.app-footer {
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-stat svg { width: 16px; height: 16px; color: var(--color-primary); }

/* Modal Backdrop */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  position: relative; width: 100%; max-width: 400px;
  padding: 32px; display: flex; flex-direction: column;
  align-items: center; text-align: center; gap: 16px;
}

.btn-modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 4px;
}

.btn-modal-close:hover { color: var(--text-main); }
.qr-container { background: #fff; padding: 16px; border-radius: 16px; box-shadow: 0 0 20px rgba(255, 255, 255, 0.2); }
.modal-footer-code { font-family: var(--font-mono); font-size: 22px; font-weight: 700; color: var(--color-primary); letter-spacing: 4px; }

/* Toast Notifications */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 2000; display: flex; flex-direction: column; gap: 10px;
}

.toast {
  background: rgba(18, 24, 40, 0.9);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(16px);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-card);
  display: flex; align-items: center; gap: 10px;
  animation: slideInRight 0.3s var(--transition-smooth) forwards;
}

.toast.success { border-color: rgba(0, 245, 160, 0.5); }
.toast.info { border-color: rgba(0, 242, 254, 0.5); }
.toast.error { border-color: rgba(255, 71, 87, 0.5); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.hidden { display: none !important; }
