/* ===================================================================
   TransitFiles - Ultra-Responsive Mobile-First Glassmorphic Design
   =================================================================== */

:root, [data-theme="dark"] {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;

  /* Color Palette - Cyber Aurora Dark (Night) */
  --bg-dark: #090d16;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 35, 54, 0.88);
  --bg-input: rgba(13, 17, 28, 0.7);
  --bg-glass-pill: rgba(255, 255, 255, 0.08);

  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-active: rgba(99, 102, 241, 0.55);
  --border-focus: #6366f1;

  --accent-primary: #6366f1;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --accent-glow: rgba(99, 102, 241, 0.35);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --shadow-luxe: 0 20px 45px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme (Day) */
[data-theme="light"] {
  --bg-dark: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-card-hover: rgba(255, 255, 255, 0.98);
  --bg-input: rgba(241, 245, 249, 0.95);
  --bg-glass-pill: rgba(0, 0, 0, 0.05);

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-active: rgba(99, 102, 241, 0.5);
  --border-focus: #4f46e5;

  --accent-primary: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #db2777 100%);
  --accent-glow: rgba(79, 70, 229, 0.25);
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --shadow-luxe: 0 20px 45px -10px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.06);
}

/* Day Mode Specific Overrides for Maximum Visual Harmony */
[data-theme="light"] .blob-1 {
  background: radial-gradient(circle, #a5b4fc 0%, transparent 70%);
  opacity: 0.35;
}

[data-theme="light"] .blob-2 {
  background: radial-gradient(circle, #d8b4fe 0%, transparent 70%);
  opacity: 0.35;
}

[data-theme="light"] .blob-3 {
  background: radial-gradient(circle, #f9a8d4 0%, transparent 70%);
  opacity: 0.25;
}

[data-theme="light"] header {
  background: rgba(255, 255, 255, 0.75);
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .logo-text {
  background: linear-gradient(135deg, #0f172a 40%, #334155 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .hero-tag {
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.2);
  color: #4338ca;
}

[data-theme="light"] .feature-item {
  color: #334155;
}

[data-theme="light"] .feature-icon {
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.18);
  color: #4f46e5;
}

[data-theme="light"] .tabs-nav {
  background: rgba(241, 245, 249, 0.95);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .tab-btn {
  color: #64748b;
}

[data-theme="light"] .tab-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .dropzone {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(255, 255, 255, 0.6);
}

[data-theme="light"] .dropzone:hover, [data-theme="light"] .dropzone.dragover {
  border-color: #4f46e5;
  background: rgba(79, 70, 229, 0.05);
}

[data-theme="light"] .dropzone-icon {
  background: rgba(79, 70, 229, 0.1);
  border-color: rgba(79, 70, 229, 0.25);
  color: #4f46e5;
}

[data-theme="light"] .file-item {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .file-badge {
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
}

[data-theme="light"] .code-box {
  background: #ffffff;
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.08);
}

[data-theme="light"] .code-value {
  color: #4338ca;
}

[data-theme="light"] .btn-secondary {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  color: #1e293b;
}

[data-theme="light"] .btn-secondary:hover {
  background: rgba(241, 245, 249, 0.95);
  border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .pin-digit {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.15);
  color: #0f172a;
}

[data-theme="light"] .pin-digit:focus {
  border-color: #4f46e5;
  background: rgba(79, 70, 229, 0.03);
  box-shadow: 0 0 12px rgba(79, 70, 229, 0.2);
}

[data-theme="light"] .stat-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .progress-bar-bg {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .modal-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .btn-scan-qr {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(124, 58, 237, 0.04) 100%);
  border-color: rgba(79, 70, 229, 0.25);
}

[data-theme="light"] .btn-scan-qr:hover {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.16) 0%, rgba(124, 58, 237, 0.09) 100%);
  border-color: var(--accent-primary);
}

[data-theme="light"] .btn-scan-qr-icon {
  background: rgba(79, 70, 229, 0.1);
  border-color: rgba(79, 70, 229, 0.22);
  color: #4f46e5;
}

[data-theme="light"] .btn-scan-qr-title {
  color: #0f172a;
}

[data-theme="light"] .scanner-modal-title {
  color: #0f172a;
}

[data-theme="light"] .scanner-close-btn {
  color: #64748b;
}

[data-theme="light"] .scanner-close-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #0f172a;
}

[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  color: #0f172a;
}

[data-theme="light"] footer {
  background: rgba(255, 255, 255, 0.6);
  border-top-color: rgba(0, 0, 0, 0.06);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body, header, footer, .transfer-card, .tab-btn, .dropzone, .file-item, .code-box, .pin-digit, .stat-card, .btn-secondary, .theme-toggle-btn {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Aurora Ambient Glowing Blobs */
.bg-mesh {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.blob {
  position: absolute;
  filter: blur(80px);
  opacity: 0.4;
  border-radius: 50%;
  animation: floatBlobs 20s infinite ease-in-out alternate;
}

.blob-1 {
  top: -5%;
  left: 5%;
  width: clamp(280px, 45vw, 550px);
  height: clamp(280px, 45vw, 550px);
  background: radial-gradient(circle, #4f46e5 0%, transparent 70%);
  animation-duration: 22s;
}

.blob-2 {
  bottom: -10%;
  right: 5%;
  width: clamp(300px, 50vw, 600px);
  height: clamp(300px, 50vw, 600px);
  background: radial-gradient(circle, #a855f7 0%, transparent 70%);
  animation-duration: 28s;
  animation-delay: -5s;
}

.blob-3 {
  top: 35%;
  left: 35%;
  width: clamp(220px, 35vw, 450px);
  height: clamp(220px, 35vw, 450px);
  background: radial-gradient(circle, #ec4899 0%, transparent 70%);
  opacity: 0.2;
  animation-duration: 18s;
  animation-delay: -10s;
}

@keyframes floatBlobs {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(35px, -25px) scale(1.08); }
  100% { transform: translate(-30px, 35px) scale(0.95); }
}

/* App Header */
header {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(0.85rem, 2.5vw, 1.25rem) clamp(1rem, 4vw, 2.5rem);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding-top: max(env(safe-area-inset-top), clamp(0.85rem, 2.5vw, 1.25rem));
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: clamp(34px, 8vw, 40px);
  height: clamp(34px, 8vw, 40px);
  border-radius: 10px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  flex-shrink: 0;
}

.logo-icon svg {
  width: 20px;
  height: 20px;
  color: #fff;
}

.logo-text {
  font-size: clamp(1.15rem, 3.5vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 40%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-status {
  display: flex;
  align-items: center;
}

.theme-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-glass-pill);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  user-select: none;
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.theme-toggle-btn:active {
  transform: scale(0.95);
}

.theme-toggle-btn svg {
  width: 19px;
  height: 19px;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
  position: absolute;
}

/* Day/Night Theme Icon Transitions */
:root .sun-icon, [data-theme="dark"] .sun-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
  color: #fbbf24; /* Sun Gold */
}

:root .moon-icon, [data-theme="dark"] .moon-icon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
  color: #a5b4fc;
}

[data-theme="light"] .sun-icon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

[data-theme="light"] .moon-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
  color: #4f46e5; /* Moon Indigo */
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  background: var(--bg-glass-pill);
  border: 1px solid var(--border-subtle);
  font-size: clamp(0.72rem, 2vw, 0.82rem);
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning);
  flex-shrink: 0;
}

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

/* Main Layout */
main {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2.5rem) clamp(0.85rem, 3vw, 1.5rem);
}

.app-container {
  width: 100%;
  max-width: 1080px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: center;
}

/* Hero Showcase */
.hero-showcase {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.5rem;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  font-size: clamp(0.72rem, 2vw, 0.8rem);
  font-weight: 600;
  width: fit-content;
  margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
}

.hero-title {
  font-size: clamp(1.75rem, 4.5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.035em;
  margin-bottom: clamp(0.65rem, 1.5vw, 1rem);
}

.hero-title span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: clamp(0.9rem, 2vw, 1.05rem);
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: clamp(1rem, 2.5vw, 2rem);
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: clamp(0.82rem, 2vw, 0.92rem);
  color: #cbd5e1;
}

.feature-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #818cf8;
  flex-shrink: 0;
}

.feature-icon svg {
  width: 15px;
  height: 15px;
}

/* Glass Transfer Card */
.transfer-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: clamp(18px, 4vw, var(--radius-lg));
  box-shadow: var(--shadow-luxe);
  padding: clamp(1.15rem, 3.5vw, 1.75rem);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.transfer-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient);
  opacity: 0.85;
}

/* Tabs Navigation */
.tabs-nav {
  display: flex;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  margin-bottom: clamp(1rem, 2.5vw, 1.35rem);
  gap: 4px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px; /* Touch target minimum */
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: clamp(0.85rem, 2.5vw, 0.92rem);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.tab-btn svg {
  width: 15.5px;
  height: 15.5px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.tab-btn:hover svg {
  transform: scale(1.06);
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

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

/* Tab Panels */
.tab-panel {
  display: none;
  flex-direction: column;
  flex: 1;
}

.tab-panel.active {
  display: flex;
}

/* Direct QR Scanner Trigger Button */
.btn-scan-qr {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(168, 85, 247, 0.08) 100%);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  text-align: left;
  user-select: none;
  min-height: 56px;
  margin-bottom: 0.85rem;
}

.btn-scan-qr:hover {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22) 0%, rgba(168, 85, 247, 0.15) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.25);
}

.btn-scan-qr:active {
  transform: scale(0.99);
}

.btn-scan-qr-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #818cf8;
  flex-shrink: 0;
  transition: var(--transition);
}

.btn-scan-qr:hover .btn-scan-qr-icon {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
  transform: scale(1.05);
}

.btn-scan-qr-icon svg {
  width: 15px;
  height: 15px;
}

.btn-scan-qr-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.15rem;
}

.btn-scan-qr-title {
  font-size: clamp(0.92rem, 2.5vw, 1rem);
  font-weight: 700;
  color: var(--text-primary);
}

.btn-scan-qr-desc {
  font-size: clamp(0.72rem, 2vw, 0.78rem);
  color: var(--text-secondary);
}

.btn-scan-qr-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* Connect Divider */
.connect-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 0.2rem 0 0.85rem 0;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.connect-divider::before,
.connect-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-subtle);
}

.connect-divider span {
  padding: 0 0.65rem;
}

/* Dropzone */
.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  padding: clamp(1.5rem, 4vw, 2.25rem) clamp(1rem, 3vw, 1.5rem);
  text-align: center;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  user-select: none;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.09);
  transform: translateY(-1px);
}

.dropzone:active {
  transform: scale(0.99);
}

.dropzone-icon {
  width: clamp(48px, 12vw, 56px);
  height: clamp(48px, 12vw, 56px);
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #818cf8;
}

.dropzone-icon svg {
  width: clamp(24px, 6vw, 28px);
  height: clamp(24px, 6vw, 28px);
}

.dropzone-title {
  font-size: clamp(0.95rem, 2.5vw, 1.05rem);
  font-weight: 600;
  color: var(--text-primary);
}

.dropzone-sub {
  font-size: clamp(0.78rem, 2vw, 0.85rem);
  color: var(--text-muted);
}

/* Files Container */
.files-container {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: clamp(140px, 30vh, 200px);
  overflow-y: auto;
  margin-bottom: 1rem;
  padding-right: 3px;
  -webkit-overflow-scrolling: touch;
}

.files-container::-webkit-scrollbar {
  width: 4px;
}

.files-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  animation: slideIn 0.2s ease-out;
  gap: 0.5rem;
}

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

.file-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow: hidden;
  flex: 1;
}

.file-badge {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

.file-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.file-name {
  font-size: clamp(0.82rem, 2.2vw, 0.875rem);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.file-remove {
  min-width: 40px;
  min-height: 40px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

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

.file-remove svg {
  width: 17px;
  height: 17px;
}

/* Files Summary */
.files-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: clamp(0.78rem, 2vw, 0.84rem);
  color: var(--text-secondary);
  padding: 0.4rem 0.25rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.85rem;
}

/* Primary Button */
.btn-primary {
  width: 100%;
  min-height: 48px; /* Ergonomic touch height */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  border: none;
  color: #fff;
  font-family: var(--font-sans);
  font-size: clamp(0.92rem, 2.5vw, 1rem);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  transition: var(--transition);
  user-select: none;
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
  transform: translateY(-1px);
}

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

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

.btn-primary svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

/* Share Section */
.share-section {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.25rem;
}

.code-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: clamp(1rem, 3vw, 1.25rem);
  background: var(--bg-input);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

.code-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.code-value {
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 6vw, 2.35rem);
  font-weight: 800;
  letter-spacing: 0.15em;
  color: #a5b4fc;
}

.pulse-indicator {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  color: #34d399;
  font-weight: 500;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseAnim 1.8s infinite;
}

@keyframes pulseAnim {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.helper-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.65rem;
  line-height: 1.4;
}

/* Connected Peer Status Bar */
.peer-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-sm);
  margin-bottom: 0.25rem;
}

.peer-status-info {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #34d399;
}

.btn-disconnect {
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-disconnect:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Received Files Box */
.received-files-box {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
}

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

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

.received-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.received-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  gap: 0.75rem;
}

.received-item-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.received-item-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.received-item-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-save-file {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  background: #10b981;
  border-radius: 6px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  flex-shrink: 0;
  transition: var(--transition);
}

.btn-save-file:hover {
  background: #059669;
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.btn-secondary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: clamp(0.82rem, 2.2vw, 0.875rem);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

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

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

.btn-secondary svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* Receiver Tab Inputs (Mobile Screen Fitting) */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.input-label {
  font-size: clamp(0.82rem, 2.2vw, 0.875rem);
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

.pin-inputs {
  display: flex;
  gap: clamp(4px, 1.5vw, 8px);
  justify-content: center;
  width: 100%;
  max-width: 360px;
}

.pin-digit {
  width: clamp(38px, 12vw, 50px);
  height: clamp(48px, 14vw, 58px);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: clamp(1.2rem, 4.5vw, 1.5rem);
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  transition: var(--transition);
}

.pin-digit:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.08);
}

/* Live Transfer Active State */
.transfer-active-panel {
  display: none;
  flex-direction: column;
  gap: 1.15rem;
  padding: 0.25rem 0;
}

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

.transfer-title {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  font-weight: 700;
}

.transfer-status-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.progress-container {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.progress-bar-bg {
  width: 100%;
  height: 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 10px;
  background: var(--accent-gradient);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.8);
  transition: width 0.15s ease;
}

.progress-details {
  display: flex;
  justify-content: space-between;
  font-size: clamp(0.78rem, 2vw, 0.84rem);
  color: var(--text-secondary);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.stat-card {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-val {
  font-family: var(--font-mono);
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  font-weight: 700;
  color: var(--text-primary);
}

/* Integrity Badge */
.integrity-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  font-size: clamp(0.75rem, 2vw, 0.82rem);
  font-weight: 600;
  font-family: var(--font-mono);
  animation: fadeInBadge 0.3s ease-out;
}

@keyframes fadeInBadge {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Transfer Actions Row */
.transfer-actions-row {
  display: flex;
  gap: 0.65rem;
  width: 100%;
}

.transfer-control-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.transfer-control-btn svg {
  width: 17px;
  height: 17px;
}

/* Modal Popup (QR Code) */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-card {
  background: #131927;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 4vw, 2rem);
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  box-shadow: var(--shadow-luxe);
  animation: modalScale 0.22s ease-out;
}

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

.qr-box {
  background: #fff;
  padding: 10px;
  border-radius: 14px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-title {
  font-size: clamp(1.1rem, 3vw, 1.25rem);
  font-weight: 700;
}

.modal-desc {
  font-size: clamp(0.78rem, 2vw, 0.85rem);
  color: var(--text-secondary);
}

/* Camera QR Scanner Modal */
.scanner-modal-card {
  max-width: 440px;
  width: 100%;
  padding: clamp(1rem, 3.5vw, 1.5rem);
  gap: 0.85rem;
}

.scanner-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.scanner-header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.scanner-header-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #818cf8;
}

.scanner-header-icon svg {
  width: 15px;
  height: 15px;
}

.scanner-modal-title {
  font-size: clamp(1rem, 3vw, 1.15rem);
  font-weight: 700;
  color: var(--text-primary);
}

.scanner-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.scanner-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.scanner-close-btn svg {
  width: 20px;
  height: 20px;
}

/* Viewport & Camera Video */
.scanner-viewport-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 320px;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

#scannerVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Scanner HUD & Reticle */
.scanner-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-reticle {
  width: 70%;
  height: 70%;
  position: relative;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 12px;
}

.reticle-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: #6366f1;
  border-style: solid;
}

.reticle-corner.top-left {
  top: -2px;
  left: -2px;
  border-width: 3px 0 0 3px;
  border-top-left-radius: 8px;
}

.reticle-corner.top-right {
  top: -2px;
  right: -2px;
  border-width: 3px 3px 0 0;
  border-top-right-radius: 8px;
}

.reticle-corner.bottom-left {
  bottom: -2px;
  left: -2px;
  border-width: 0 0 3px 3px;
  border-bottom-left-radius: 8px;
}

.reticle-corner.bottom-right {
  bottom: -2px;
  right: -2px;
  border-width: 0 3px 3px 0;
  border-bottom-right-radius: 8px;
}

.scanner-laser-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #a855f7 20%, #6366f1 50%, #a855f7 80%, transparent 100%);
  box-shadow: 0 0 10px 2px rgba(99, 102, 241, 0.8), 0 0 4px #a855f7;
  animation: scanLaserAnim 2s infinite ease-in-out alternate;
}

@keyframes scanLaserAnim {
  0% { top: 5%; opacity: 0.6; }
  50% { opacity: 1; }
  100% { top: 95%; opacity: 0.6; }
}

.scanner-overlay-hint {
  position: absolute;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  font-size: clamp(0.72rem, 2vw, 0.78rem);
  font-weight: 500;
  pointer-events: none;
  z-index: 2;
}

.scanner-controls-footer {
  display: flex;
  gap: 0.65rem;
  width: 100%;
}

.scanner-controls-footer button {
  flex: 1;
}

/* Toast Alerts */
.toast-container {
  position: fixed;
  bottom: clamp(1rem, 3vw, 2rem);
  right: clamp(1rem, 3vw, 2rem);
  left: clamp(1rem, 3vw, auto); /* Full width float on small screens */
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 200;
  pointer-events: none;
}

.toast {
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-sm);
  background: rgba(18, 24, 38, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: clamp(0.8rem, 2.2vw, 0.875rem);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  animation: toastSlide 0.25s ease-out;
  pointer-events: auto;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

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

/* Footer */
footer {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem clamp(1rem, 4vw, 2.5rem);
  border-top: 1px solid var(--border-subtle);
  font-size: clamp(0.75rem, 2vw, 0.85rem);
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: clamp(0.85rem, 2.5vw, 1.5rem);
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Privacy & Cookies Consent Banner */
.consent-banner {
  position: fixed;
  bottom: clamp(1rem, 3vw, 1.5rem);
  left: 50%;
  transform: translate(-50%, 0);
  width: min(92vw, 840px);
  background: var(--bg-card-hover);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  z-index: 1000;
  animation: bannerSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  box-sizing: border-box;
}

@keyframes bannerSlideUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 80px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.consent-content {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  justify-content: space-between;
  width: 100%;
}

.consent-main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 0;
}

.consent-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.consent-icon svg {
  width: 20px;
  height: 20px;
}

.consent-text {
  font-size: clamp(0.8rem, 2vw, 0.88rem);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.consent-text strong {
  color: var(--text-primary);
}

.consent-text a {
  color: var(--accent-primary);
  text-decoration: underline;
}

.btn-consent {
  width: auto !important;
  white-space: nowrap;
  padding: 0.65rem 1.35rem !important;
  font-size: 0.875rem !important;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--accent-glow);
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-consent:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

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

@media (max-width: 720px) {
  .consent-content {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .consent-main {
    align-items: flex-start;
  }

  .btn-consent {
    width: 100% !important;
    text-align: center;
    padding: 0.75rem !important;
  }
}

/* ===================================================================
   Mobile & Tablet Adaptive Media Queries
   =================================================================== */

@media (max-width: 860px) {
  .app-container {
    grid-template-columns: 1fr;
    max-width: 480px;
    gap: 1.25rem;
  }

  .hero-showcase {
    text-align: center;
    align-items: center;
    padding: 0;
  }

  .hero-title {
    font-size: clamp(1.6rem, 5vw, 2.1rem);
  }

  .hero-desc {
    margin-bottom: 0.5rem;
  }

  .feature-list {
    display: none; /* Hide bullets on mobile to keep focus on transfer card */
  }

  .logo-badge {
    display: none;
  }

  .header-status {
    display: none;
  }

  header {
    padding: 0.75rem 1rem;
    justify-content: space-between;
  }

  footer {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
  }
}

@media (max-width: 420px) {
  .transfer-card {
    padding: 1rem;
    border-radius: 18px;
  }

  .pin-inputs {
    gap: 4px;
  }

  .pin-digit {
    width: 36px;
    height: 48px;
    font-size: 1.2rem;
  }

  .code-value {
    font-size: 1.75rem;
    letter-spacing: 0.1em;
  }
}
