/* ziparu archiver — design inspired by suzip.ru, theme-safe */

:root {
  --bg: #071127;
  --bg-2: #0c1630;
  --panel: rgba(255, 255, 255, 0.04);
  --text: #eaf0ff;
  --muted: #a8b2cc;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --accent: #4f8cff;
  --accent-2: #7b5cff;
  --success: #34d399;
  --danger: #f87171;
  --header-h: 72px;
  --card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  --body-grad:
    radial-gradient(1200px 600px at 110% -10%, rgba(79, 140, 255, 0.18), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  --drop-bg: rgba(79, 140, 255, 0.06);
  --chip-bg: rgba(255, 255, 255, 0.05);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

:root[data-theme="light"] {
  --bg: #f5f8ff;
  --bg-2: #edf2ff;
  --panel: rgba(255, 255, 255, 0.85);
  --text: #0f172a;
  --muted: #4b5563;
  --line: rgba(15, 23, 42, 0.1);
  --line-strong: rgba(15, 23, 42, 0.16);
  --accent: #2f6fff;
  --accent-2: #6b4dff;
  --card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 255, 0.94));
  --body-grad:
    radial-gradient(900px 420px at 100% -10%, rgba(47, 111, 255, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  --drop-bg: rgba(47, 111, 255, 0.06);
  --chip-bg: rgba(15, 23, 42, 0.04);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 14px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--body-grad);
  color: var(--text);
  padding-bottom: calc(12px + var(--safe-b));
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Bootstrap text utilities must follow theme */
.text-secondary {
  color: var(--muted) !important;
}
.text-accent {
  color: var(--accent) !important;
}
.lead-text {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

/* Header */
.site-header {
  z-index: 1035;
  padding-top: var(--safe-t);
}
.zip-navbar {
  background: rgba(8, 12, 22, 0.88);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
  min-height: var(--header-h);
}
:root[data-theme="light"] .zip-navbar {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

.brand-badge {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 8px 24px rgba(79, 140, 255, 0.35);
}
.brand-text {
  color: var(--text);
}

.navbar-dark .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.78);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
}
.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}
:root[data-theme="light"] .navbar-dark .navbar-nav .nav-link {
  color: rgba(15, 23, 42, 0.78);
}
:root[data-theme="light"] .navbar-dark .navbar-nav .nav-link:hover,
:root[data-theme="light"] .navbar-dark .navbar-nav .nav-link.active {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.06);
}

.navbar-toggler {
  border: 1px solid var(--line);
  padding: 0.35rem 0.5rem;
}
:root[data-theme="light"] .navbar-toggler-icon {
  filter: invert(1);
}

.btn-outline-light {
  color: #eaf0ff;
  border-color: rgba(255, 255, 255, 0.28);
}
.btn-outline-light:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
}
:root[data-theme="light"] .btn-outline-light {
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.18);
}
:root[data-theme="light"] .btn-outline-light:hover {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.06);
}

.btn-outline-secondary {
  color: var(--text);
  border-color: var(--line-strong);
  background: transparent;
}
.btn-outline-secondary:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line-strong);
}
:root[data-theme="light"] .btn-outline-secondary:hover {
  background: rgba(15, 23, 42, 0.05);
}

/* ☀ [——●] 🌙 · влево=день · вправо=ночь (как на /rem) */
.theme-switch-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 0.55rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  line-height: 1;
  vertical-align: middle;
}
:root[data-theme="light"] .theme-switch-wrap {
  background: rgba(15, 23, 42, 0.04);
}
.theme-switch-wrap .theme-ico {
  font-size: 0.95rem;
  width: 1.15rem;
  height: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  opacity: 0.55;
  transition: opacity 0.15s, color 0.15s, transform 0.15s;
}
.theme-switch-wrap.is-light .theme-ico-sun,
.theme-switch-wrap.is-dark .theme-ico-moon {
  opacity: 1;
  transform: scale(1.08);
}
.theme-switch-wrap.is-light .theme-ico-sun {
  color: #f59e0b;
}
.theme-switch-wrap.is-dark .theme-ico-moon {
  color: #93c5fd;
}
.theme-switch-wrap .theme-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0;
  margin: 0;
  height: 1.2rem;
}
.theme-switch-wrap .form-check-input {
  width: 2.35rem;
  height: 1.2rem;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
  background-color: rgba(255, 255, 255, 0.16);
  border-color: var(--line-strong);
}
:root[data-theme="light"] .theme-switch-wrap .form-check-input {
  background-color: rgba(15, 23, 42, 0.12);
}
/* checked = тёмная (к луне) */
.theme-switch-wrap .form-check-input:checked {
  background-color: #3b5bdb;
  border-color: #3b5bdb;
}
:root[data-theme="light"] .theme-switch-wrap .form-check-input:checked {
  background-color: #1e3a8a;
  border-color: #1e3a8a;
}
.theme-switch-wrap .form-check-input:focus {
  box-shadow: 0 0 0 0.15rem rgba(79, 140, 255, 0.25);
}

/* Cards / panels */
.hero-section {
  padding: 2.5rem 0 2rem;
}
.section-anchor {
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.section-alt {
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
:root[data-theme="light"] .section-alt {
  background: rgba(15, 23, 42, 0.02);
  border-top-color: rgba(15, 23, 42, 0.06);
  border-bottom-color: rgba(15, 23, 42, 0.06);
}

.hero-panel,
.glass-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}
:root[data-theme="light"] .hero-panel,
:root[data-theme="light"] .glass-card {
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
}

.hero-panel {
  position: relative;
  overflow: hidden;
}
.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -30px -60px auto;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(79, 140, 255, 0.32) 0%, transparent 70%);
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(79, 140, 255, 0.1);
  color: #b9c3ff;
  font-weight: 600;
  font-size: 0.86rem;
}
:root[data-theme="light"] .hero-eyebrow {
  color: #214ecf;
  background: rgba(47, 111, 255, 0.1);
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  align-items: center;
}
:root[data-theme="light"] .stat-card {
  background: rgba(15, 23, 42, 0.03);
}
.stat-card strong {
  font-size: 0.95rem;
  color: var(--text);
}
.stat-card small {
  color: var(--muted);
  font-size: 0.72rem;
}
.icon-stat {
  font-size: 1.15rem;
  color: var(--accent);
  margin-bottom: 0.15rem;
}

.pill-status {
  font-size: 0.8rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  background: rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}
:root[data-theme="light"] .pill-status {
  background: rgba(15, 23, 42, 0.04);
  color: #334155;
}

.feature-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  padding: 1rem 1.1rem;
}
:root[data-theme="light"] .feature-card {
  background: rgba(255, 255, 255, 0.75);
}
.feature-card > i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  margin-bottom: 0.7rem;
  background: rgba(79, 140, 255, 0.14);
  color: #98bcff;
  font-size: 1.2rem;
}
:root[data-theme="light"] .feature-card > i {
  background: rgba(47, 111, 255, 0.1);
  color: #2557dc;
}
.feature-card h3 {
  font-size: 1rem;
  margin-bottom: 0.3rem;
  color: var(--text);
}
.feature-card p {
  color: var(--muted);
  margin: 0;
  font-size: 0.9rem;
}

/* Drop zones */
.drop-zone {
  border: 1.5px dashed rgba(79, 140, 255, 0.45);
  border-radius: 18px;
  background: var(--drop-bg);
  padding: 1.75rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  -webkit-user-select: none;
  user-select: none;
}
.drop-zone:hover,
.drop-zone:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.12);
}
.drop-zone.dragover {
  border-color: var(--accent-2);
  background: rgba(123, 92, 255, 0.14);
  transform: scale(1.01);
}
.drop-zone-sm {
  padding: 1.25rem 1rem;
}
.drop-icon-wrap {
  margin-bottom: 0.5rem;
}
.drop-icon {
  font-size: 2.4rem;
  color: var(--accent);
  display: inline-block;
}
.drop-icon-sm {
  font-size: 1.8rem;
  color: var(--accent);
  display: block;
  margin-bottom: 0.35rem;
}
.drop-title {
  font-weight: 700;
  color: var(--text);
  font-size: 1.05rem;
}
.drop-sub {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 0.25rem;
}

/* Forms */
.form-label {
  color: var(--text);
  font-weight: 600;
  font-size: 0.88rem;
}
.form-control,
.form-select {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--line-strong);
  color: var(--text);
  min-height: 46px;
  border-radius: 12px;
}
.form-control::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
.form-control:focus,
.form-select:focus {
  background-color: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border-color: rgba(79, 140, 255, 0.55);
  box-shadow: 0 0 0 0.2rem rgba(79, 140, 255, 0.15);
}
:root[data-theme="light"] .form-control,
:root[data-theme="light"] .form-select {
  background-color: #fff;
  border-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
}
:root[data-theme="light"] .form-control:focus,
:root[data-theme="light"] .form-select:focus {
  background-color: #fff;
  color: #0f172a;
}
.form-control::file-selector-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-right: 0.75rem;
}
:root[data-theme="light"] .form-control::file-selector-button {
  color: #0f172a;
  background: rgba(15, 23, 42, 0.05);
}
select.form-select option {
  background: #0f172a;
  color: #eef2ff;
}
:root[data-theme="light"] select.form-select option {
  background: #fff;
  color: #0f172a;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  box-shadow: 0 10px 28px rgba(79, 140, 255, 0.28);
  font-weight: 700;
  border-radius: 12px;
  color: #fff;
}
.btn-primary:hover {
  filter: brightness(1.06);
  color: #fff;
}
.btn-primary:disabled {
  opacity: 0.55;
  filter: none;
  box-shadow: none;
}
.mobile-full-btn {
  min-height: 48px;
  border-radius: 12px;
  font-size: 0.98rem;
}

.progress {
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
:root[data-theme="light"] .progress {
  background: rgba(15, 23, 42, 0.08);
}
.progress-bar {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.15s ease;
}

.form-status {
  color: var(--muted);
  min-height: 1.2em;
}
.form-status.ok {
  color: var(--success);
}
.form-status.err {
  color: var(--danger);
}

/* File lists */
.file-list {
  --bs-list-group-bg: transparent;
  --bs-list-group-color: var(--text);
  --bs-list-group-border-color: var(--line);
  max-height: 280px;
  overflow: auto;
  border-radius: 12px;
}
.file-list .list-group-item {
  background: var(--chip-bg);
  color: var(--text);
  border-color: var(--line);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  font-size: 0.9rem;
}
.file-list .list-group-item + .list-group-item {
  border-top-width: 1px;
}
.file-list .fname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.file-list .fsize {
  color: var(--muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}
.file-list .btn-x {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  cursor: pointer;
  border-radius: 8px;
}
.file-list .btn-x:hover {
  background: rgba(248, 113, 113, 0.12);
}
.file-list .btn-dl {
  border: 1px solid var(--line);
  background: rgba(79, 140, 255, 0.1);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 8px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}
.file-list .empty {
  color: var(--muted);
  text-align: center;
  justify-content: center;
  border-style: dashed;
}

.file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.file-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--text);
}
.file-chips .chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
.file-chips .chip button {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0;
  line-height: 1;
  cursor: pointer;
}

/* History */
.history-list {
  display: grid;
  gap: 0.55rem;
}
.history-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--chip-bg);
}
.history-item .hi-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(79, 140, 255, 0.14);
  color: var(--accent);
  font-size: 1.1rem;
}
.history-item .hi-name {
  font-weight: 700;
  color: var(--text);
  font-size: 0.92rem;
  word-break: break-all;
}
.history-item .hi-meta {
  color: var(--muted);
  font-size: 0.8rem;
}
.history-empty {
  text-align: center;
  color: var(--muted);
  padding: 1.5rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 1rem;
}
.footer-link {
  color: var(--muted);
  text-decoration: none;
}
.footer-link:hover {
  color: var(--text);
}

/* Mobile */
@media (max-width: 991.98px) {
  :root {
    --header-h: 64px;
  }
  .hero-section {
    padding-top: 1.25rem;
  }
  .navbar-collapse {
    margin-top: 0.65rem;
    padding: 0.65rem;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid var(--line);
    backdrop-filter: blur(16px);
  }
  :root[data-theme="light"] .navbar-collapse {
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
  }
  :root[data-theme="light"] .navbar-collapse .nav-link {
    color: #0f172a;
  }
  .mobile-full-btn {
    width: 100%;
  }
  .d-flex.flex-wrap.gap-2 > .mobile-full-btn {
    flex: 1 1 100%;
  }
  .history-item {
    grid-template-columns: auto 1fr;
  }
  .history-item .hi-meta {
    grid-column: 2;
  }
}

@media (max-width: 420px) {
  .display-6 {
    font-size: 1.65rem;
  }
  .hero-stats .stat-card strong {
    font-size: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
