/* Mobile-first, novice-friendly stylesheet for DropFile */

:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #eff6ff;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --radius: 18px;
  --radius-sm: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --primary-light: #1e293b;
    --success-bg: #064e3b;
    --warning-bg: #451a03;
    --danger-bg: #450a0a;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

.app-wrapper {
  max-width: 540px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
}

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

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.brand-info h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.brand-info p {
  font-size: 13px;
  color: var(--text-muted);
}

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

.icon-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--border);
}

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--border);
  color: var(--text-muted);
}

.status-pill.online {
  background: var(--success-bg);
  color: var(--success);
}

.status-pill.offline {
  background: var(--danger-bg);
  color: var(--danger);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.dot.pulse {
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Card */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Resume Banner */
.resume-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: slide-down 0.3s ease-out;
}

@media (prefers-color-scheme: dark) {
  .resume-banner {
    background: #291e0a;
    border-color: #854d0e;
  }
}

.resume-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #b45309;
}

@media (prefers-color-scheme: dark) {
  .resume-header {
    color: #fcd34d;
  }
}

.resume-desc {
  font-size: 14px;
  color: var(--text);
}

.resume-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

/* Drop Zone / Tap Target */
.upload-zone {
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  background: var(--primary-light);
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.upload-zone:active, .upload-zone.dragover {
  transform: scale(0.98);
  border-color: var(--primary-hover);
  background: #dbeafe;
}

.zone-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: var(--shadow);
}

.zone-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.zone-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 280px;
}

.zone-btn-hint {
  margin-top: 8px;
  background: var(--primary);
  color: #fff;
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.35);
}

/* Selected File Card */
.file-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.file-card-icon {
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

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

.file-name {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
}

/* Buttons */
.btn {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  user-select: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 6px 14px rgba(16, 185, 129, 0.35);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  height: 44px;
  font-size: 15px;
}

.btn-small {
  height: 38px;
  padding: 0 16px;
  font-size: 14px;
  width: auto;
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid #fca5a5;
  color: var(--danger);
  height: 44px;
  font-size: 14px;
}

/* Progress Section */
.progress-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.progress-pct {
  font-size: 38px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.progress-status-badge {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
}

.progress-bar-container {
  height: 14px;
  width: 100%;
  background: var(--border);
  border-radius: 20px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa, #10b981);
  background-size: 200% 100%;
  border-radius: 20px;
  transition: width 0.3s ease;
  animation: shimmer 2s linear infinite;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--bg);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}

/* Alert notifications for reconnection / state */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  line-height: 1.4;
}

.alert-warning {
  background: var(--warning-bg);
  color: #92400e;
  border: 1px solid #fde68a;
}

@media (prefers-color-scheme: dark) {
  .alert-warning {
    color: #fde68a;
    border-color: #78350f;
  }
}

.alert-info {
  background: var(--primary-light);
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

@media (prefers-color-scheme: dark) {
  .alert-info {
    color: #93c5fd;
    border-color: #1e3a8a;
  }
}

.alert-icon {
  font-size: 20px;
  line-height: 1;
}

.wake-lock-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  justify-content: center;
}

/* Success Card */
.success-card {
  text-align: center;
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #dcfce7;
  color: #15803d;
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(22, 101, 52, 0.2);
  animation: pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.success-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.success-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 320px;
}

/* Modal for QR Code & File List */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--card-bg);
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  border-radius: 24px 24px 0 0;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-content {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.close-btn {
  background: var(--border);
  border: none;
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.qr-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.qr-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: monospace;
  border: 1px solid var(--border);
  word-break: break-all;
}

/* File items list */
.files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  gap: 10px;
}

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

.file-item-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.file-item-actions {
  display: flex;
  gap: 6px;
}

.file-download-btn {
  text-decoration: none;
  background: var(--primary);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

/* Footer */
footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: auto;
  padding: 16px 0;
}

/* Utilities */
.hidden {
  display: none !important;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
