/* ==========================================================================
   Mobile Drop — Modern Light Theme Stylesheet
   Designed for high performance, smooth animations, and mobile-first touch UX.
   ========================================================================== */

:root {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-hover: #f1f5f9;
  --border-light: #e2e8f0;
  --border-focus: #3b82f6;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-glow: rgba(37, 99, 235, 0.15);

  --emerald: #10b981;
  --emerald-light: #ecfdf5;
  --emerald-border: #a7f3d0;
  --emerald-text: #065f46;

  --amber: #f59e0b;
  --amber-light: #fffbeb;

  --rose: #ef4444;
  --rose-light: #fef2f2;

  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 14px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.04);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.04), transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(16, 185, 129, 0.03), transparent 45%);
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Header Bar
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.destination-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-card-subtle);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  margin-top: 2px;
}

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

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--emerald-light);
  border: 1px solid var(--emerald-border);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--emerald-text);
  letter-spacing: 0.02em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
  animation: pulse-dot 2s infinite ease-in-out;
}

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

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: #cbd5e1;
}

.icon-btn:active {
  transform: scale(0.94);
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */

.main-content {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Base Card Styling */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 18px;
  transition: box-shadow 0.2s ease;
}

/* ==========================================================================
   Dropzone Component
   ========================================================================== */

.dropzone {
  position: relative;
  border: 2px dashed #93c5fd;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 100%);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
  user-select: none;
}

.dropzone:hover {
  border-color: var(--primary);
  background: linear-gradient(180deg, #e0effe 0%, #ffffff 100%);
}

.dropzone.drag-active {
  border-color: var(--primary);
  background: #eff6ff;
  border-style: solid;
  transform: scale(1.01);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.drop-icon-wrapper {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dropzone:hover .drop-icon-wrapper,
.dropzone.drag-active .drop-icon-wrapper {
  transform: translateY(-4px) scale(1.05);
  box-shadow: var(--shadow-md);
}

.dropzone-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dropzone-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 340px;
  margin: 0 auto;
  line-height: 1.4;
}

/* ==========================================================================
   Action Buttons Grid
   ========================================================================== */

.action-buttons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}

.action-btn:hover {
  background: var(--bg-card-subtle);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.action-btn:active {
  transform: scale(0.97);
  background: #e2e8f0;
}

.action-btn .btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.btn-camera .btn-icon {
  background: #eff6ff;
  color: #2563eb;
}

.btn-photos .btn-icon {
  background: #ecfdf5;
  color: #059669;
}

.btn-files .btn-icon {
  background: #fdf4ff;
  color: #9333ea;
}

.btn-paste .btn-icon {
  background: #fff7ed;
  color: #ea580c;
}

.action-btn .btn-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.action-btn .btn-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.action-btn .btn-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* ==========================================================================
   Upload Progress Card
   ========================================================================== */

.upload-progress-card {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

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

.card-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid #bfdbfe;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.progress-bar-container {
  height: 8px;
  width: 100%;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #10b981 100%);
  border-radius: var(--radius-full);
  transition: width 0.15s ease-out;
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 12px;
}

.spinner-small {
  width: 16px;
  height: 16px;
  border: 2px solid #bfdbfe;
  border-top-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.active-uploads-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upload-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.upload-item-name {
  flex: 1;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-item-size {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.upload-item-status {
  font-size: 0.72rem;
  font-weight: 700;
}

.upload-item-status.success {
  color: var(--emerald);
}

.upload-item-status.uploading {
  color: var(--primary);
}

/* ==========================================================================
   Storage Info Bar
   ========================================================================== */

.storage-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.storage-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

.storage-text svg {
  color: var(--primary);
}

.storage-tag {
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-mono);
  background: var(--bg-card-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-muted);
}

/* ==========================================================================
   Recent Downloads Section
   ========================================================================== */

.recent-files-card {
  padding: 16px 18px;
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border-light);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.refresh-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.refresh-btn:active {
  transform: scale(0.96);
}

.files-empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
}

.files-empty-state .empty-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.empty-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-desc {
  font-size: 0.8rem;
}

.files-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.file-row:hover {
  background: var(--bg-card-subtle);
  border-color: #cbd5e1;
}

.file-preview-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 0.8rem;
  font-weight: 700;
}

.file-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-doc {
  background: #eff6ff;
  color: #2563eb;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
}

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

.file-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.file-subtext {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.file-action-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.file-action-btn:hover {
  background: #ffffff;
  border-color: var(--border-light);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.file-action-btn.btn-delete:hover {
  background: var(--rose-light);
  color: var(--rose);
  border-color: #fecaca;
}

/* ==========================================================================
   QR Code Modal
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 380px;
  width: 100%;
  padding: 22px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

.modal-title-group h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.qr-container {
  display: flex;
  justify-content: center;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.qr-container img {
  border-radius: var(--radius-sm);
  display: block;
  max-width: 100%;
  height: auto;
}

.url-copy-box {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.url-copy-box input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-card-subtle);
  color: var(--text-primary);
  outline: none;
}

.btn-primary-small {
  padding: 8px 14px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary-small:hover {
  background: var(--primary-hover);
}

.modal-hints {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.hint-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hint-bullet {
  color: var(--emerald);
  font-weight: 700;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */

.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 420px) {
  .action-buttons-grid {
    grid-template-columns: 1fr 1fr;
  }

  .action-btn {
    padding: 10px;
    gap: 8px;
  }

  .action-btn .btn-icon {
    width: 36px;
    height: 36px;
  }

  .action-btn .btn-title {
    font-size: 0.85rem;
  }
}
