/* ==========================================================================
   AxonShare • Axonam Studio
   High-Speed WebRTC P2P Transfer & Cyberpunk Radar Theme
   ========================================================================== */

:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(18, 24, 38, 0.85);
  --bg-card-hover: rgba(26, 34, 52, 0.95);
  --bg-surface: #141c2e;
  --bg-surface-elevated: #1a253c;
  --bg-input: rgba(13, 19, 33, 0.9);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(6, 182, 212, 0.4);
  --border-glow: rgba(6, 182, 212, 0.25);
  
  --primary: #06b6d4;
  --primary-hover: #0891b2;
  --primary-glow: rgba(6, 182, 212, 0.35);
  
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 30px rgba(6, 182, 212, 0.2);
  --shadow-glow-emerald: 0 0 30px rgba(16, 185, 129, 0.25);
  
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.18s var(--ease-spring);
  --transition-normal: 0.28s var(--ease-spring);
}

/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100%;
  width: 100%;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(6, 182, 212, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(16, 185, 129, 0.05) 0px, transparent 60%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* Language Transition Effect */
body.lang-transitioning * {
  transition: opacity 0.15s ease, transform 0.15s ease !important;
  opacity: 0.4;
  transform: translateY(-1px);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(11, 15, 25, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* App Container */
.app-container {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top, 16px)) max(16px, env(safe-area-inset-right, 16px)) 24px max(16px, env(safe-area-inset-left, 16px));
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

/* Header */
.app-header {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

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

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-indigo) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
  color: #fff;
  font-size: 22px;
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.brand-icon:hover {
  transform: rotate(-8deg) scale(1.08);
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  min-height: 40px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
  user-select: none;
  text-decoration: none;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.96) !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #0891b2 100%);
  color: #0b0f19;
  font-weight: 700;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: 0 6px 20px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-accent);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: var(--accent-rose);
  color: #fff;
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.4);
  transform: translateY(-1px);
}

.btn-icon-only {
  padding: 8px;
  min-width: 38px;
  min-height: 38px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
}

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

/* Language Toggle */
.lang-toggle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 12px;
  min-height: 40px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-toggle:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
  transform: translateY(-1px);
}

.lang-switch-arrow {
  color: var(--primary);
  font-size: 0.9rem;
}

.lang-next {
  color: var(--text-muted);
  font-size: 0.76rem;
}

/* ==========================================================================
   Radar / Device Discovery Banner
   ========================================================================== */

.radar-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.radar-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent-indigo));
}

/* Radar Animation Circles */
.radar-arena {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0 18px 0;
}

.radar-wave {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0;
  animation: radarPulse 3s infinite linear;
}

.radar-wave:nth-child(1) { width: 60px; height: 60px; animation-delay: 0s; }
.radar-wave:nth-child(2) { width: 100px; height: 100px; animation-delay: 1s; }
.radar-wave:nth-child(3) { width: 140px; height: 140px; animation-delay: 2s; }

@keyframes radarPulse {
  0% { transform: scale(0.6); opacity: 0.8; }
  50% { opacity: 0.4; }
  100% { transform: scale(1.4); opacity: 0; }
}

.radar-center-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  border: 2px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--primary);
  z-index: 2;
  box-shadow: var(--shadow-glow);
}

/* Dual Connected Devices Visualizer */
.connected-devices-arena {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-width: 620px;
  margin: 12px 0 16px 0;
  padding: 12px;
}

.device-card-badge {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), var(--shadow-glow);
  flex: 1;
  text-align: left;
  animation: cardFadeIn 0.3s var(--ease-spring);
}

.device-card-badge.remote {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), var(--shadow-glow-emerald);
}

.device-badge-icon {
  font-size: 26px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.device-badge-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.device-badge-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.device-badge-info strong {
  font-size: 0.88rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* P2P Connecting Beam */
.p2p-beam {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
  flex-shrink: 0;
}

.beam-line {
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent-emerald));
  border-radius: 99px;
  box-shadow: 0 0 10px var(--primary);
  animation: beamPulse 1.5s infinite alternate ease-in-out;
}

@keyframes beamPulse {
  0% { transform: scaleX(0.8); opacity: 0.6; }
  100% { transform: scaleX(1.1); opacity: 1; filter: drop-shadow(0 0 8px #10b981); }
}

.beam-glow {
  font-size: 16px;
  margin-top: -6px;
}

.beam-text {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--accent-emerald);
  letter-spacing: 1px;
}

/* Connection Status Badge */
.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  margin-bottom: 12px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-amber);
  box-shadow: 0 0 10px var(--accent-amber);
  animation: dotPulse 2s infinite ease-in-out;
}

.status-dot.connected {
  background: var(--accent-emerald);
  box-shadow: 0 0 12px var(--accent-emerald);
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* Room Code & Quick Pairing Bar */
.pairing-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.room-code-badge {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--primary);
  text-shadow: 0 0 12px var(--primary-glow);
}

/* ==========================================================================
   Main Transfer Section (Tabs & Dropzone)
   ========================================================================== */

.transfer-box {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-sm);
}

/* Tabs */
.tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  color: #0b0f19;
  background: var(--primary);
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* Drag & Drop Area */
.dropzone {
  border: 2px dashed var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 46px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: rgba(6, 182, 212, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.dropzone:hover, .dropzone.dragover {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--primary);
  transform: scale(1.01);
}

.dropzone-icon {
  font-size: 48px;
  color: var(--primary);
  filter: drop-shadow(0 0 12px var(--primary-glow));
}

.dropzone-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.dropzone-subtitle {
  font-size: 0.84rem;
  color: var(--text-secondary);
  max-width: 440px;
}

/* Text Share Form */
.text-share-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.text-share-input {
  width: 100%;
  min-height: 120px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  color: #fff;
  font-size: 0.92rem;
  outline: none;
  resize: vertical;
  transition: all var(--transition-fast);
}

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

/* ==========================================================================
   Live Transfer Overlay / Progress Bar
   ========================================================================== */

.transfer-progress-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), var(--shadow-glow);
  animation: cardFadeIn 0.35s var(--ease-spring);
}

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

.file-info-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: #fff;
}

.progress-stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent-emerald));
  border-radius: var(--radius-full);
  transition: width 0.15s linear;
}

/* ==========================================================================
   History Section
   ========================================================================== */

.history-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.history-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all var(--transition-fast);
}

.history-item:hover {
  border-color: var(--border-accent);
}

.history-file-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-file-icon {
  font-size: 24px;
  color: var(--primary);
}

.history-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
}

.history-size {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), var(--shadow-glow);
  transform: scale(0.94) translateY(15px);
  transition: all var(--transition-normal);
  overflow: hidden;
}

.modal-overlay.active .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.12rem;
  font-weight: 700;
  color: #fff;
}

.modal-body {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-accent);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), var(--shadow-glow);
  font-size: 0.88rem;
  font-weight: 500;
  animation: toastSlideIn 0.35s var(--ease-spring) forwards;
}

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

/* Footer */
.app-footer {
  text-align: center;
  padding: 16px 12px;
  color: var(--text-muted);
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  margin-top: auto;
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: var(--radius-full);
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 600;
}

/* Mobile Breakpoints */
@media (max-width: 680px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .brand-section {
    justify-content: space-between;
  }
  .header-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .header-actions .btn-primary {
    grid-column: 1 / -1;
  }
  .pairing-bar {
    flex-direction: column;
    width: 100%;
  }
  .toast-container {
    left: 16px;
    right: 16px;
  }
}

/* Mobile Flex Fix */
.device-card-badge { min-width: 0; }
.device-badge-info { min-width: 0; }
.device-badge-tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 500px) { .connected-devices-arena { gap: 6px; padding: 8px; } .device-card-badge { padding: 8px; gap: 6px; } .device-badge-icon { width: 32px; height: 32px; font-size: 16px; } .beam-line { width: 20px; } .device-badge-tag { font-size: 0.55rem; } .device-badge-info strong { font-size: 0.75rem; } }

.history-file-meta { min-width: 0; flex: 1; }
.history-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

@media (max-width: 680px) { .pairing-bar { flex-direction: row !important; flex-wrap: wrap !important; } }

.history-file-meta > div { min-width: 0; flex: 1; }
.history-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
