@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-color: #0b0d19;
  --bg-gradient: radial-gradient(circle at 50% 0%, #1a1b35 0%, #0b0d19 100%);
  --panel-bg: rgba(22, 26, 47, 0.65);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-border-hover: rgba(99, 102, 241, 0.35);
  
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.15);
  --secondary: #a855f7;
  --secondary-glow: rgba(168, 85, 247, 0.15);
  --accent: #06b6d4;
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-x: hidden;
  position: relative;
}

/* Background Glowing Orbs */
body::before, body::after {
  content: "";
  position: absolute;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.25;
  pointer-events: none;
}

body::before {
  background: var(--primary);
  top: 15%;
  left: 10%;
}

body::after {
  background: var(--secondary);
  bottom: 15%;
  right: 10%;
}

header {
  padding: 2rem 1rem;
  text-align: center;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-main) 30%, var(--primary) 70%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.logo i {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 2rem;
}

.tagline {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 400;
}

main {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.container {
  width: 100%;
  max-width: 540px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
  position: relative;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.container:hover {
  border-color: rgba(99, 102, 241, 0.2);
}

.view {
  display: none;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.view.active {
  display: block;
}

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

h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

p.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 2rem;
}

/* Drag & Drop Zone */
.drop-zone {
  border: 2px dashed var(--panel-border);
  border-radius: 18px;
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  background: rgba(255, 255, 255, 0.01);
  position: relative;
  overflow: hidden;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.04);
  box-shadow: inset 0 0 15px rgba(99, 102, 241, 0.05);
}

.drop-zone.dragover .drop-icon {
  transform: translateY(-8px) scale(1.05);
  color: var(--primary);
}

.drop-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  transition: transform 0.3s ease, color 0.3s ease;
  display: inline-block;
}

.drop-zone h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.drop-zone p {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.file-input {
  display: none;
}

/* Selected File Panel */
.file-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.file-info-icon {
  width: 48px;
  height: 48px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.5rem;
  flex-shrink: 0;
}

.file-details {
  flex-grow: 1;
  min-width: 0; /* truncate text hacks */
}

.file-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

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

.btn-remove-file {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-remove-file:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* Selection Modes Layout */
.mode-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mode-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.mode-card:hover {
  border-color: var(--panel-border-hover);
  background: rgba(255, 255, 255, 0.04);
}

.mode-card.selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.04);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.08);
}

.mode-radio {
  margin-top: 0.25rem;
  accent-color: var(--primary);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.mode-content {
  flex-grow: 1;
}

.mode-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mode-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.mode-badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-weight: 500;
}

.badge-primary {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-secondary {
  background: rgba(168, 85, 247, 0.15);
  color: #d8b4fe;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: none;
  margin-top: 1.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45), var(--shadow-glow);
}

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

.btn-secondary {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-main);
}

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

/* Processing & Transfer state styles */
.transfer-panel {
  text-align: center;
  padding: 1rem 0;
}

.status-badge-container {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  margin-bottom: 2rem;
  font-size: 0.85rem;
  font-weight: 500;
}

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

.status-dot.active {
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
  animation: pulse-dot 1.5s infinite;
}

.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* Circular Progress */
.progress-ring-container {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 2rem auto;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-circle-bg {
  stroke: rgba(255, 255, 255, 0.04);
}

.progress-ring-circle {
  stroke: url(#progress-gradient);
  stroke-dasharray: 377; /* 2 * PI * r (r=60) */
  stroke-dashoffset: 377;
  transition: stroke-dashoffset 0.1s linear;
  stroke-linecap: round;
}

.progress-percentage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
  font-family: var(--font-heading);
  font-weight: 700;
}

/* Linear Progress Bar for downloads */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  margin: 1.5rem 0 0.5rem 0;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  width: 0%;
  transition: width 0.1s linear;
  border-radius: 4px;
}

.transfer-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Share link output block */
.share-block {
  margin-top: 1.5rem;
  text-align: left;
}

.share-block label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  display: block;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.copy-input-group {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 0.25rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.copy-input-group input {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  outline: none;
  min-width: 0;
}

.btn-copy {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-copy:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-copy.success {
  background: var(--success);
  border-color: var(--success);
}

/* QR Code Section */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
}

.qr-canvas-wrapper {
  background: white;
  padding: 0.75rem;
  border-radius: 12px;
  display: inline-block;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  margin-bottom: 0.75rem;
}

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

/* Pulse Glow Card for receiver connection confirmation */
.peer-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 0.75rem;
  border-radius: 12px;
  color: #a7f3d0;
  margin: 1rem 0;
}

/* Footer rules */
footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  color: var(--primary);
}

.badge-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
}

/* Spinner */
.spinner {
  border: 3px solid rgba(255, 255, 255, 0.1);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border-left-color: var(--primary);
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Warning & Informative Banners */
.alert-banner {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #fef3c7;
  padding: 1rem;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.4;
  margin-top: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  text-align: left;
}

.alert-banner i {
  color: #f59e0b;
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* Responsive adjustment */
@media (max-width: 600px) {
  .container {
    padding: 1.75rem 1.25rem;
    border-radius: 20px;
  }
  
  h2 {
    font-size: 1.4rem;
  }
}
