* { box-sizing: border-box; }

:root {
  --bg-main: #020617;
  --bg-panel: rgba(15,23,42,0.92);
  --bg-sidebar: rgba(2,6,23,0.94);
  --border-soft: rgba(30,64,175,0.35);
  --border-strong: #16a34a;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --accent: #16a34a;
  --accent-soft: #bbf7d0;
  --accent-blue: #38bdf8;
  --danger: #ef4444;
  --blur-radius: 18px;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at 0% 0%, #064e3b 0, transparent 55%),
    radial-gradient(circle at 100% 0%, #1d4ed8 0, transparent 55%),
    radial-gradient(circle at 50% 100%, #047857 0, #020617 60%);
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

a { color: #4ade80; }
a:hover { text-decoration: underline; }

.app-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 12px 28px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: rgba(15,23,42,0.9);
  backdrop-filter: blur(18px);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  border: 1px solid rgba(34,197,94,0.7);
  display: none;
  z-index: 80;
  color: var(--text-main);
}

/* Header */
.app-header {
  position: sticky;
  top: 10px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 18px;
  background: linear-gradient(130deg, rgba(15,118,110,0.9), rgba(15,23,42,0.96));
  box-shadow: 0 24px 60px rgba(0,0,0,0.75);
  border: 1px solid rgba(34,197,94,0.55);
  backdrop-filter: blur(var(--blur-radius));
}

.app-title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .05em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #bbf7d0 0, #16a34a 45%, #065f46 80%);
  box-shadow:
    0 0 12px rgba(34,197,94,0.85),
    0 0 32px rgba(34,197,94,0.8);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Toggle */
.view-toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 30px;
}

.switch input {
  display: none;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(15,23,42,0.95);
  border-radius: 999px;
  transition: 0.3s;
  box-shadow: inset 0 0 0 1px rgba(148,163,184,0.7);
}

.slider::before {
  content: "";
  position: absolute;
  height: 24px;
  width: 56px;
  left: 3px;
  top: 3px;
  background: #f9fafb;
  border-radius: 999px;
  transition: 0.3s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

input:checked + .slider {
  background: linear-gradient(135deg, #22c55e, #38bdf8);
  box-shadow:
    0 0 0 1px rgba(34,197,94,0.7),
    0 8px 26px rgba(34,197,94,0.75);
}

input:checked + .slider::before {
  transform: translateX(58px);
}

.switch-labels {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.switch-labels span {
  color: #9ca3af;
  transition: color .2s;
}

.switch-labels span.active {
  color: #022c22;
}

/* Sidebar Mobile / Main Layout */
.main-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 14px;
  align-items: flex-start;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.7);
  display: none;
  z-index: 35;
}

.sidebar-backdrop.visible {
  display: block;
}

.sidebar {
  background: var(--bg-sidebar);
  border-radius: 16px;
  border: 1px solid rgba(30,64,175,0.4);
  box-shadow:
    0 18px 32px rgba(0,0,0,0.7),
    0 0 40px rgba(34,197,94,0.12);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 260px;
  backdrop-filter: blur(var(--blur-radius));
  position: relative;
  overflow: hidden;
}

.sidebar.mobile-open {
  transform: translateX(0%);
}

.sidebar-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-close {
  display: none;
}

/* Buttons */
button {
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #022c22;
  font-size: 13px;
  padding: 7px 13px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 8px 22px rgba(22,163,74,0.5);
  transition: transform .12s, box-shadow .12s;
}

button:hover {
  transform: translateY(-1px);
}

button.secondary {
  background: rgba(15,23,42,0.95);
  color: var(--text-main);
  border: 1px solid rgba(30,64,175,0.65);
}

button.soft {
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(51,65,85,0.9);
}

/* URL box + Result columns */
.downloader-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1.4fr);
  gap: 12px;
  align-items: stretch;
}

.vertical-divider {
  width: 1px;
  background: rgba(148,163,184,0.35);
}

.results-frame {
  border-radius: 14px;
  border: 1px solid rgba(55,65,81,0.9);
  background: radial-gradient(circle at 0 0, rgba(59,130,246,0.07) 0, transparent 55%), rgba(15,23,42,0.95);
  padding: 8px;
  min-height: 120px;
}

/* Table Mode */
#results.table-mode table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

#results.table-mode th,
#results.table-mode td {
  border-bottom: 1px solid rgba(31,41,55,0.9);
  padding: 6px;
  text-align: left;
}

.thumb-small {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
}

/* Grid Mode */
#results.grid-mode {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 85;
}

.modal-backdrop.visible {
  display: flex;
}

.modal {
  width: 320px;
  border-radius: 16px;
  padding: 16px;
  background: rgba(15,23,42,0.98);
  border: 1px solid rgba(34,197,94,0.7);
}

.modal-progress {
  height: 8px;
  width: 100%;
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  overflow: hidden;
}

.modal-progress-bar {
  height: 8px;
  background: linear-gradient(135deg, #22c55e, #38bdf8);
  border-radius: 999px;
  width: 10%;
  transition: width .3s ease-out;
}

/* Floating button */
.floating-url-btn {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #22c55e, #38bdf8);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}

.floating-url-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Mobile Responsive */
@media (max-width:900px) {

  .main-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 240px;
    transform: translateX(-110%);
    transition: .25s ease-out;
  }

  .sidebar-close {
    display: block;
  }

  .url-box.hidden-mobile {
    display: none;
  }
}
.toolbar-secondary {
  margin-top: 6px;
  opacity: 0.95;
}

