/* ===========================
   FileZap — Mobile App CSS
   =========================== */

:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --surface2: #1a1a24;
  --surface3: #22222e;
  --border: rgba(255,255,255,0.07);
  --accent: #6c63ff;
  --accent2: #ff6584;
  --accent3: #43e97b;
  --text: #f0f0f8;
  --text2: #8888aa;
  --text3: #4a4a66;
  --danger: #ff4757;
  --warn: #ffa502;
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Sora', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --glow: 0 0 20px rgba(108, 99, 255, 0.3);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  overscroll-behavior: none;
}

/* ===== STATUS BAR ===== */
.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: var(--surface);
  font-size: 11px;
  color: var(--text2);
  font-family: var(--mono);
  border-bottom: 1px solid var(--border);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text3);
  transition: background 0.4s, box-shadow 0.4s;
}

.status-dot.online { background: var(--accent3); box-shadow: 0 0 8px var(--accent3); }
.status-dot.error  { background: var(--danger);  box-shadow: 0 0 8px var(--danger);  }

/* ===== APP SHELL ===== */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: calc(100vh - 33px);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

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

.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: var(--glow);
}

.logo-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-sub {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--mono);
  margin-top: 1px;
}

.refresh-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text2);
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}

.refresh-btn:active { transform: scale(0.9); color: var(--accent); }
.refresh-btn.spinning .refresh-icon { animation: spin 0.7s linear infinite; }

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

/* ===== TABS ===== */
.tab-bar {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  gap: 4px;
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text3);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  position: relative;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-icon { font-size: 16px; }

.badge {
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
  display: none;
}
.badge.visible { display: inline-block; }

/* ===== TAB CONTENT ===== */
.tab-content {
  display: none;
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  flex-direction: column;
}
.tab-content.active { display: flex; }

/* ===== DROP ZONE ===== */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  background: var(--surface2);
  position: relative;
  overflow: hidden;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(108,99,255,0.05) 0%, transparent 70%);
  pointer-events: none;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(108,99,255,0.08);
  box-shadow: var(--glow);
}

.drop-icon {
  color: var(--accent);
  margin-bottom: 14px;
  opacity: 0.8;
}

.drop-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
}

.drop-sub {
  font-size: 12px;
  color: var(--text3);
  font-family: var(--mono);
}

/* ===== QUEUE ===== */
.queue {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  animation: slideIn 0.2s ease;
}

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

.queue-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

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

.queue-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-size {
  font-size: 11px;
  color: var(--text3);
  font-family: var(--mono);
  margin-top: 2px;
}

.queue-remove {
  width: 28px; height: 28px;
  border: none;
  background: rgba(255,71,87,0.15);
  color: var(--danger);
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.queue-remove:active { transform: scale(0.9); background: rgba(255,71,87,0.3); }

.queue-status {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text3);
}

/* ===== UPLOAD BUTTON ===== */
.upload-btn {
  margin-top: 20px;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), #9b59ff);
  color: white;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s;
  box-shadow: var(--glow);
  letter-spacing: 0.3px;
}

.upload-btn:disabled {
  background: var(--surface3);
  color: var(--text3);
  box-shadow: none;
  cursor: not-allowed;
}

.upload-btn:not(:disabled):active {
  transform: scale(0.97);
  box-shadow: 0 0 30px rgba(108,99,255,0.5);
}

/* ===== PROGRESS ===== */
.progress-wrap {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--surface3);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent3));
  border-radius: 99px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-label {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--accent);
  min-width: 36px;
  text-align: right;
}

/* ===== SEARCH ===== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
}

.search-icon { font-size: 18px; color: var(--text3); }

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
}

.search-bar input::placeholder { color: var(--text3); }

/* ===== FILE LIST ===== */
#file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-group-label {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text3);
  padding: 8px 0 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  cursor: pointer;
  transition: all 0.2s;
  animation: slideIn 0.25s ease;
}

.file-card:hover {
  border-color: var(--accent);
  background: rgba(108,99,255,0.07);
}

.file-card:active { transform: scale(0.98); }

.file-thumb {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

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

.file-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.file-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text3);
  font-family: var(--mono);
}

.file-tag {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.file-arrow {
  color: var(--text3);
  font-size: 16px;
  flex-shrink: 0;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ===== LOADING SKELETON ===== */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  height: 68px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 99px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: all 0.3s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { border-color: var(--accent3); color: var(--accent3); }
.toast.error   { border-color: var(--danger);  color: var(--danger);  }
.toast.warn    { border-color: var(--warn);    color: var(--warn);    }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }

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

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 28px 24px 36px;
  width: 100%;
  max-width: 480px;
  animation: slideUp 0.3s cubic-bezier(.34,1.56,.64,1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-icon { font-size: 32px; margin-bottom: 12px; }

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 24px;
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--text2);
  font-family: var(--mono);
  margin-bottom: 6px;
  margin-top: 14px;
}

.modal-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.modal-input:focus { border-color: var(--accent); }

.field-hint {
  font-size: 11px;
  color: var(--text3);
  margin-top: 6px;
  line-height: 1.6;
}
.field-hint code {
  font-family: var(--mono);
  background: var(--surface3);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent);
}
.hint-link { color: var(--accent); text-decoration: none; }

.modal-btn {
  margin-top: 24px;
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), #9b59ff);
  color: white;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--glow);
  transition: all 0.2s;
}
.modal-btn:active { transform: scale(0.97); }

/* ===== PREVIEW MODAL ===== */
.preview-modal {
  border-radius: var(--radius) var(--radius) 0 0;
  max-height: 80vh;
  overflow-y: auto;
}

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

.preview-filename {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 75%;
}

.preview-close {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}

#preview-content {
  min-height: 100px;
  margin-bottom: 20px;
}

#preview-content img {
  max-width: 100%;
  border-radius: var(--radius-sm);
}

.preview-info-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.info-chip {
  background: var(--surface3);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text2);
}

.preview-actions {
  display: flex;
  gap: 10px;
}

.action-btn {
  flex: 1;
  padding: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.action-btn:active { transform: scale(0.97); }
.action-btn.primary {
  background: linear-gradient(135deg, var(--accent), #9b59ff);
  border: none;
  box-shadow: var(--glow);
}

/* ===== FILE TYPE COLORS ===== */
.ft-img { background: rgba(255,101,132,0.15); color: var(--accent2); }
.ft-vid { background: rgba(255,102,0,0.15);   color: #ff6600; }
.ft-doc { background: rgba(52,152,219,0.15);  color: #3498db; }
.ft-zip { background: rgba(255,165,0,0.15);   color: var(--warn); }
.ft-code{ background: rgba(67,233,123,0.15);  color: var(--accent3); }
.ft-pdf { background: rgba(231,76,60,0.15);   color: #e74c3c; }
.ft-def { background: rgba(108,99,255,0.15);  color: var(--accent); }

/* ===== RESPONSIVE ===== */
@media (max-width: 380px) {
  .header { padding: 14px 16px 12px; }
  .tab-content { padding: 16px; }
}

/* ===========================
   FileZap v3 — Additions
   =========================== */

/* File group header */
.file-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 4px;
}
.file-group-label {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.file-group-count {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text3);
  background: var(--surface3);
  padding: 2px 8px;
  border-radius: 99px;
}

/* File card checkbox */
.file-checkbox {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.checkbox-inner {
  width: 18px; height: 18px;
  border: 2px solid var(--text3);
  border-radius: 5px;
  transition: all 0.15s;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
}
.checkbox-inner.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox-inner.checked::after {
  content: '✓';
  color: white;
  font-size: 11px;
  font-weight: 700;
}
.file-card.selected {
  border-color: var(--accent);
  background: rgba(108,99,255,0.08);
}

/* Download button on file card */
.file-dl-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface3);
  color: var(--text2);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.file-dl-btn:hover {
  background: rgba(108,99,255,0.15);
  color: var(--accent);
  border-color: var(--accent);
}
.file-dl-btn:active { transform: scale(0.9); }

/* Files toolbar */
.files-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.search-bar { flex: 1; }

.dl-all-btn {
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.dl-all-btn:hover {
  border-color: var(--accent3);
  color: var(--accent3);
  background: rgba(67,233,123,0.08);
}
.dl-all-btn:active { transform: scale(0.96); }

/* Bulk bar */
.bulk-bar {
  position: fixed;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 99px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow), var(--glow);
  z-index: 50;
  transition: bottom 0.35s cubic-bezier(.34,1.56,.64,1);
  width: calc(100% - 32px);
  max-width: 440px;
}
.bulk-bar.visible { bottom: 20px; }

.bulk-count {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  font-family: var(--mono);
}

.bulk-dl-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--accent), #9b59ff);
  color: white;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  box-shadow: var(--glow);
}
.bulk-dl-btn:active { transform: scale(0.95); }

.bulk-clear-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.bulk-clear-btn:hover { color: var(--danger); border-color: var(--danger); }

/* Queue status icons */
.qs-done    { color: var(--accent3); font-size: 16px; }
.qs-error   { color: var(--danger);  font-size: 16px; }
.qs-loading { color: var(--accent);  font-size: 16px; animation: spin 1s linear infinite; display: inline-block; }

/* Chunk badge */
.chunk-badge {
  background: rgba(108,99,255,0.2);
  color: var(--accent);
  font-size: 9px;
  font-family: var(--mono);
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(108,99,255,0.3);
  vertical-align: middle;
  margin-left: 4px;
}

/* Info card on upload tab */
.info-card {
  margin-top: 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text2);
  font-family: var(--mono);
}
.info-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.info-dot.green { background: var(--accent3); box-shadow: 0 0 6px var(--accent3); }
.info-dot.blue  { background: var(--accent);  box-shadow: 0 0 6px var(--accent); }

/* File meta separator */
.sep { color: var(--text3); }

/* Progress label wrap */
#progress-label {
  min-width: 80px;
  text-align: right;
  font-size: 11px;
  color: var(--accent);
  font-family: var(--mono);
  white-space: nowrap;
}
