/* ==========================================================================
   MEGA Direct Downloader - Professional Engineering Workspace Theme
   Clean, authentic developer aesthetic without generic AI gradients
   ========================================================================== */

:root {
  --bg-canvas: #090d16;
  --bg-panel: #111726;
  --bg-surface: #161e31;
  --bg-surface-hover: #1d273f;
  --bg-input: #0c121e;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-focus: #3b82f6;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-emerald: #10b981;
  --accent-emerald-hover: #059669;
  --accent-amber: #f59e0b;
  --accent-crimson: #ef4444;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

body {
  background-color: var(--bg-canvas);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header Navigation
   ========================================================================== */

.app-header {
  border-bottom: 1px solid var(--border-subtle);
  background-color: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-symbol {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-sub {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

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

.header-tg-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #38bdf8;
  background-color: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.15s ease;
}

.header-tg-link:hover {
  background-color: #0284c7;
  color: #ffffff;
}

.system-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 9999px;
  background-color: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-emerald);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.nav-icon-link {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background-color 0.15s;
}

.nav-icon-link:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Main Page Layout
   ========================================================================== */

.page-container {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 60px;
  flex: 1;
}

.console-hero {
  margin-bottom: 32px;
}

.hero-headline {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin-bottom: 8px;
}

.hero-description {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 680px;
  line-height: 1.6;
}

/* ==========================================================================
   Card Component
   ========================================================================== */

.console-card {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

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

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

.step-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-blue);
  background-color: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

.step-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.quick-helpers {
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-tool-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.text-tool-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.03);
}

.sample-chip {
  background-color: rgba(59, 130, 246, 0.06);
  border-color: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.sample-chip:hover {
  background-color: rgba(59, 130, 246, 0.12);
  border-color: var(--accent-blue);
  color: #bfdbfe;
}

.chip-flash {
  color: var(--accent-amber);
}

/* ==========================================================================
   Form & Input Elements
   ========================================================================== */

.link-form {
  display: flex;
  gap: 12px;
}

.input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  height: 48px;
  padding: 0 40px 0 42px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-wrapper input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-wrapper input::placeholder {
  color: var(--text-dim);
}

.clear-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: none;
  font-size: 13px;
}

.clear-btn:hover {
  color: var(--text-main);
}

.btn-primary {
  height: 48px;
  padding: 0 20px;
  background-color: var(--accent-blue);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background-color 0.15s, transform 0.08s;
  white-space: nowrap;
}

.btn-primary:hover {
  background-color: var(--accent-blue-hover);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-keycap {
  font-family: var(--font-mono);
  font-size: 11px;
  background-color: rgba(0, 0, 0, 0.25);
  padding: 2px 5px;
  border-radius: 4px;
  opacity: 0.8;
}

/* ==========================================================================
   Alert Messages
   ========================================================================== */

.alert-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-box.error {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

/* ==========================================================================
   Processing & Progress Tracker
   ========================================================================== */

.processing-card {
  border-color: rgba(59, 130, 246, 0.25);
}

.processing-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.spinner-ring {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(59, 130, 246, 0.15);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.processing-details {
  flex: 1;
}

.processing-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.processing-head h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.mono-stat {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-blue);
}

.progress-bar-track {
  height: 6px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background-color: var(--accent-blue);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.subtext {
  font-size: 12px;
  color: var(--text-dim);
}

/* ==========================================================================
   Results Toolbar & Explorer
   ========================================================================== */

.results-section {
  background-color: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 16px;
}

.archive-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.archive-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background-color: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
  flex-shrink: 0;
}

.archive-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.archive-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  max-width: 480px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.archive-specs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.spec-item {
  font-family: var(--font-mono);
}

.spec-divider {
  color: var(--text-dim);
}

.spec-success {
  color: var(--accent-emerald);
}

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

.btn-secondary {
  height: 40px;
  padding: 0 14px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.btn-download-zip {
  height: 40px;
  padding: 0 16px;
  background-color: var(--accent-emerald);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  color: #064e3b;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-download-zip:hover {
  background-color: #34d399;
}

/* ==========================================================================
   Filter Bar
   ========================================================================== */

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 320px;
}

.search-box svg {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}

.search-box input:focus {
  border-color: var(--border-focus);
}

.filter-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* ==========================================================================
   Files Table
   ========================================================================== */

.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
}

.files-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.files-table th {
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  background-color: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
}

.files-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.files-table tbody tr:last-child td {
  border-bottom: none;
}

.files-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.col-type { width: 80px; }
.col-size { width: 120px; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.col-action { width: 180px; text-align: right; }

.file-type-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  text-transform: uppercase;
}

.type-video   { background-color: rgba(139, 92, 246, 0.15); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.3); }
.type-archive { background-color: rgba(245, 158, 11, 0.15); color: #fde68a; border: 1px solid rgba(245, 158, 11, 0.3); }
.type-doc     { background-color: rgba(59, 130, 246, 0.15); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.3); }
.type-image   { background-color: rgba(16, 185, 129, 0.15); color: #a7f3d0; border: 1px solid rgba(16, 185, 129, 0.3); }
.type-code    { background-color: rgba(236, 72, 153, 0.15); color: #fbcfe8; border: 1px solid rgba(236, 72, 153, 0.3); }
.type-file    { background-color: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.3); }
.type-telegram{ background-color: rgba(36, 161, 222, 0.18); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.45); font-weight: 700; }

.file-telegram-row {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.1), rgba(14, 165, 233, 0.02)) !important;
  border-bottom: 1px solid rgba(56, 189, 248, 0.22) !important;
}

.file-telegram-row:hover {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.16), rgba(14, 165, 233, 0.05)) !important;
}

.file-telegram-link {
  color: #38bdf8 !important;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.file-telegram-link:hover {
  text-decoration: underline;
  color: #7dd3fc !important;
}

.telegram-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #38bdf8;
  font-weight: 600;
}

.btn-row-telegram {
  background-color: #0284c7;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-weight: 600;
}

.btn-row-telegram:hover {
  background-color: #0369a1;
  color: #ffffff;
}

.btn-tg-accent {
  background-color: rgba(14, 165, 233, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-weight: 600;
}
.btn-tg-accent:hover {
  background-color: #0284c7;
  color: #ffffff;
}

.tg-pinned-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin-bottom: 16px;
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.14), rgba(14, 165, 233, 0.04));
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.tg-pinned-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background-color: rgba(14, 165, 233, 0.22);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tg-pinned-body {
  flex: 1;
  min-width: 200px;
}

.tg-pinned-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tg-pinned-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: #0284c7;
  color: #ffffff;
}

.tg-pinned-title {
  font-weight: 600;
  font-size: 14px;
  color: #f8fafc;
  text-decoration: none;
}

.tg-pinned-title:hover {
  text-decoration: underline;
  color: #38bdf8;
}

.tg-pinned-url {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #38bdf8;
  margin-top: 2px;
}

.tg-pinned-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-tg-join {
  height: 34px;
  padding: 0 14px;
  background-color: #0284c7;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.15s;
}

.btn-tg-join:hover {
  background-color: #0369a1;
}

.file-name-cell {
  display: flex;
  flex-direction: column;
}

.file-primary-name {
  font-weight: 500;
  color: var(--text-main);
  word-break: break-all;
}

.file-path-sub {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-top: 2px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.btn-row-action {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-row-download {
  background-color: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.btn-row-download:hover {
  background-color: var(--accent-blue);
  color: #ffffff;
}

.btn-row-copy {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.btn-row-copy:hover {
  border-color: var(--border-strong);
  color: var(--text-main);
}

.btn-row-copy.copied {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
  background-color: rgba(16, 185, 129, 0.1);
}

.results-footer {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.app-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 24px 0;
  font-size: 12px;
  color: var(--text-dim);
}

.footer-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sep {
  opacity: 0.4;
}

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

@media (max-width: 768px) {
  .header-container {
    padding: 0 16px;
  }
  .page-container {
    padding: 24px 16px 40px;
  }
  .hero-headline {
    font-size: 22px;
  }
  .link-form {
    flex-direction: column;
  }
  .btn-primary {
    width: 100%;
    justify-content: center;
  }
  .results-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .archive-actions {
    width: 100%;
    flex-direction: column;
  }
  .btn-secondary, .btn-download-zip {
    width: 100%;
    justify-content: center;
  }
  .search-box {
    width: 100%;
  }
  .filter-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
