/* ======================================================
   FileBeam — Premium Dark Theme Stylesheet
   ====================================================== */

/* ----- Design Tokens / Custom Properties ----- */
:root {
  --bg-primary:       #06060e;
  --bg-secondary:     #0f0f1a;
  --bg-card:          rgba(255, 255, 255, 0.04);
  --bg-card-hover:    rgba(255, 255, 255, 0.08);
  --border-color:     rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.15);
  --text-primary:     #f0f0f5;
  --text-secondary:   #8888a0;
  --text-muted:       #55556a;
  --accent-1:         #7c3aed;
  --accent-2:         #3b82f6;
  --accent-3:         #06b6d4;
  --success:          #22c55e;
  --danger:           #ef4444;
  --radius-sm:        8px;
  --radius-md:        12px;
  --radius-lg:        20px;
  --radius-xl:        28px;
  --font-family:      'Inter', system-ui, -apple-system, sans-serif;
  --transition:       0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ======================================================
   Animated Background Orbs
   ====================================================== */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-orbs::before,
.bg-orbs::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.13;
}

.bg-orbs::before {
  width: 550px;
  height: 550px;
  background: var(--accent-1);
  top: -120px;
  left: -80px;
  animation: float1 24s ease-in-out infinite;
}

.bg-orbs::after {
  width: 480px;
  height: 480px;
  background: var(--accent-2);
  bottom: -100px;
  right: -60px;
  animation: float2 28s ease-in-out infinite;
}

/* Third orb via a child pseudo or box-shadow trick on the container */
.bg-orbs {
  /* Rendered as a massive box-shadow acting as a third orb */
  box-shadow:
    400px 50vh 120px 200px rgba(6, 182, 212, 0.08);
  animation: float3 22s ease-in-out infinite;
}

@keyframes float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%      { transform: translate(60px, 80px) scale(1.08); }
  50%      { transform: translate(-30px, 140px) scale(0.95); }
  75%      { transform: translate(40px, 40px) scale(1.05); }
}

@keyframes float2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%      { transform: translate(-70px, -60px) scale(1.06); }
  50%      { transform: translate(40px, -120px) scale(0.96); }
  75%      { transform: translate(-50px, -40px) scale(1.04); }
}

@keyframes float3 {
  0%, 100% { box-shadow: 400px 50vh 120px 200px rgba(6,182,212,0.08); }
  33%      { box-shadow: 300px 40vh 120px 220px rgba(6,182,212,0.1); }
  66%      { box-shadow: 500px 60vh 120px 180px rgba(6,182,212,0.06); }
}

/* ======================================================
   Navigation
   ====================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6, 6, 14, 0.6);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-color);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  text-decoration: none;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

/* ======================================================
   Main Layout
   ====================================================== */
.main {
  flex: 1;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px;
}

/* ======================================================
   Hero
   ====================================================== */
.hero {
  text-align: center;
  padding: 80px 0 48px;
  animation: fadeIn 0.8s ease;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--text-secondary);
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ======================================================
   Mode Selector
   ====================================================== */
.mode-selector {
  display: flex;
  gap: 24px;
  justify-content: center;
  padding-bottom: 80px;
  animation: slideUp 0.6s ease both;
  animation-delay: 0.15s;
}

.mode-card {
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 48px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition:
    transform var(--transition),
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: inherit;
  color: inherit;
  outline: none;
}

.mode-card:hover {
  transform: translateY(-8px);
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
  box-shadow:
    0 20px 60px -12px rgba(124, 58, 237, 0.18),
    0 0 0 1px rgba(124, 58, 237, 0.12);
}

.mode-card:active {
  transform: translateY(-4px);
}

.mode-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.mode-icon--receive {
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
}

.mode-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.mode-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.5;
}

/* ======================================================
   Panels (Send / Receive shared)
   ====================================================== */
.panel {
  width: 100%;
  max-width: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 48px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  margin-bottom: 80px;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 0;
  margin-bottom: 24px;
  transition: color var(--transition);
}

.back-btn:hover {
  color: var(--text-primary);
}

.panel-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.panel-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 32px;
}

/* ======================================================
   Drop Zone
   ====================================================== */
.drop-zone {
  border: 2px dashed var(--border-color-hover);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  transition:
    border-color var(--transition),
    background var(--transition);
  cursor: pointer;
  margin-top: 24px;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent-2);
  background: rgba(59, 130, 246, 0.04);
}

.drop-zone.dragover {
  border-color: var(--accent-1);
  background: rgba(124, 58, 237, 0.06);
  border-image: linear-gradient(135deg, var(--accent-1), var(--accent-3)) 1;
  border-image-slice: 1;
}

.drop-zone-icon {
  color: var(--text-muted);
  margin-bottom: 4px;
  transition: color var(--transition);
}

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

.drop-zone-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.drop-zone-or {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.browse-btn {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color-hover);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition);
}

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

.drop-zone-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ======================================================
   File Info
   ====================================================== */
.file-info {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-top: 24px;
  animation: fadeIn 0.3s ease;
}

.file-info-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(59,130,246,0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.file-info-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.file-info-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.file-info-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

/* ======================================================
   Progress Bar
   ====================================================== */
.progress-area {
  margin-top: 24px;
  animation: fadeIn 0.3s ease;
}

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

.progress-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.progress-percent {
  font-size: 0.85rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-card-hover);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2), var(--accent-3));
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
  transition: width 0.3s ease;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ======================================================
   Primary Button (Upload / Fetch / Download)
   ====================================================== */
.btn-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  margin-top: 24px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition:
    filter var(--transition),
    transform 0.15s ease,
    box-shadow var(--transition);
  box-shadow: 0 4px 24px -4px rgba(124, 58, 237, 0.4);
}

.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: 0 8px 32px -4px rgba(124, 58, 237, 0.5);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: none;
}

/* ======================================================
   Secondary Button
   ====================================================== */
.btn-secondary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  margin-top: 16px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color-hover);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition);
}

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

/* ======================================================
   Code Result (Post-Upload)
   ====================================================== */
.code-result {
  text-align: center;
  margin-top: 32px;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.code-result-success {
  margin-bottom: 28px;
}

.code-result-check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  animation: pulse 2s ease-in-out infinite;
}

.code-result-success h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.code-result-success p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ----- 6 Digit Boxes ----- */
.code-digits {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.code-digit {
  width: 56px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color-hover);
  border-radius: var(--radius-md);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background-image: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pulse 2.5s ease-in-out infinite;
}

.code-digit:nth-child(2) { animation-delay: 0.1s; }
.code-digit:nth-child(3) { animation-delay: 0.2s; }
.code-digit:nth-child(4) { animation-delay: 0.3s; }
.code-digit:nth-child(5) { animation-delay: 0.4s; }
.code-digit:nth-child(6) { animation-delay: 0.5s; }

/* ----- Copy Button ----- */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color-hover);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 20px;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition);
  margin-bottom: 16px;
}

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

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

/* ======================================================
   Code Input (Receive)
   ====================================================== */
.code-input-group {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.code-input {
  width: 56px;
  height: 64px;
  text-align: center;
  font-family: inherit;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-card-hover);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  caret-color: var(--accent-2);
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

.code-input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

.code-input::selection {
  background: rgba(124, 58, 237, 0.3);
}

/* ======================================================
   Download Area
   ====================================================== */
.download-area {
  margin-top: 28px;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color-hover);
  border-radius: var(--radius-lg);
  padding: 28px;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.download-file-info {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.download-file-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(59,130,246,0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

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

.download-file-name {
  display: block;
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.download-file-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.download-meta-sep {
  color: var(--text-muted);
}

.btn-download {
  margin-top: 0;
  font-size: 1.05rem;
  padding: 18px 24px;
}

/* ======================================================
   Error Area
   ====================================================== */
.error-area {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding: 14px 18px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 500;
  animation: fadeIn 0.3s ease;
}

/* ======================================================
   Toast Notification
   ====================================================== */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  background: rgba(15, 15, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color-hover);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: auto;
  animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.toast-item.toast-success { border-left: 3px solid var(--success); }
.toast-item.toast-error   { border-left: 3px solid var(--danger); }
.toast-item.toast-info    { border-left: 3px solid var(--accent-2); }

.toast-item.toast-hide {
  animation: slideOutRight 0.3s ease forwards;
}

/* ======================================================
   Footer
   ====================================================== */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ======================================================
   Keyframe Animations
   ====================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}

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

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

/* ======================================================
   Utility: hidden-but-accessible
   ====================================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ======================================================
   Responsive
   ====================================================== */
@media (max-width: 768px) {
  .hero { padding: 56px 0 32px; }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .mode-selector {
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding-bottom: 48px;
  }

  .mode-card {
    width: 100%;
    max-width: 340px;
    padding: 36px 28px;
  }

  .panel {
    padding: 32px 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 48px;
  }

  .panel-title {
    font-size: 1.5rem;
  }

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

  .code-digit,
  .code-input {
    width: 46px;
    height: 54px;
    font-size: 1.5rem;
  }

  .code-digits, .code-input-group {
    gap: 8px;
  }

  .toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .panel {
    padding: 24px 18px;
  }

  .code-digit,
  .code-input {
    width: 40px;
    height: 48px;
    font-size: 1.3rem;
  }

  .mode-icon {
    width: 52px;
    height: 52px;
  }

  .mode-icon svg {
    width: 24px;
    height: 24px;
  }

  .btn-primary {
    padding: 14px 20px;
    font-size: 0.9rem;
  }

  .download-area {
    padding: 20px;
  }
}
