:root {
  --bg: #111111;
  --card: #1c1c1c;
  --accent: #d9a44a;
  --text: #f2f2f2;
  --text-dim: #a0a0a0;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(17,17,17,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #2a2a2a;
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
  flex: 0 0 auto;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.tab-btn {
  border: none;
  background: #262626;
  color: var(--text-dim);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 15px;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--accent);
  color: #1a1200;
  font-weight: 600;
}

.searchbar {
  width: 100%;
  padding: 12px 16px;
  gap: 10px;
  display: flex;
}

.searchbar input {
  flex: 1;
  padding: 12px 14px;
  font-size: 16px; /* zapobiega auto-zoomowi w Safari na iOS */
  border-radius: 12px;
  border: 1px solid #333;
  background: var(--card);
  color: var(--text);
}

.searchbar input:focus { outline: 2px solid var(--accent); }

.sync-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-dim);
}

.sync-bar button {
  background: var(--accent);
  color: #1a1200;
  border: none;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: #2a2a2a;
  border-radius: 4px;
  overflow: hidden;
  display: none;
}

.progress-track.active { display: block; }

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width .2s;
}

.view { padding: 8px 16px 60px; }
.view.hidden { display: none; }

.category-grid, .media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.tile {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  aspect-ratio: 4 / 3;
  cursor: pointer;
  border: 1px solid #262626;
}

.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tile .label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
  font-weight: 600;
  font-size: 15px;
}

.tile .count {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-dim);
  display: block;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 0;
  color: var(--text-dim);
  font-size: 14px;
}

.crumbs button {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
}

.media-tile { aspect-ratio: 1 / 1; }
.media-tile .video-badge {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,0.6);
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 12px;
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 20px;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.94);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox.hidden { display: none; }

.lightbox img, .lightbox video {
  max-width: 92vw;
  max-height: 78vh;
  border-radius: 10px;
}

.lightbox-desc {
  color: var(--text-dim);
  max-width: 640px;
  text-align: center;
  padding: 14px 20px 0;
  font-size: 14px;
}

.lightbox-actions {
  display: flex;
  gap: 16px;
  margin-top: 18px;
}

.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #262626;
  border: none;
  color: var(--text);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn.share { background: var(--accent); color: #1a1200; }

.close-btn {
  position: absolute;
  top: 18px; right: 18px;
  background: #262626;
  border: none;
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #1a1200;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

.toast.show { opacity: 1; }

/* Panel logowania (admin) */
.login-box, .upload-box, .list-box {
  max-width: 480px;
  margin: 40px auto;
  background: var(--card);
  padding: 24px;
  border-radius: var(--radius);
}

.login-box input, .upload-box input[type=text], .upload-box textarea {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid #333;
  background: #141414;
  color: var(--text);
  font-size: 16px;
}

.login-box button, .upload-box button {
  width: 100%;
  padding: 13px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #1a1200;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: #262626;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.chip.selected { background: var(--accent); color: #1a1200; font-weight: 600; }

.admin-list { max-width: 900px; margin: 20px auto; padding: 0 16px; }
.admin-item {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--card);
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 10px;
}
.admin-item img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; }
.admin-item .meta { flex: 1; font-size: 14px; color: var(--text-dim); }
.admin-item .meta textarea { width: 100%; background: #141414; color: var(--text); border: 1px solid #333; border-radius: 8px; padding: 6px; font-size: 13px; }
.admin-item button { background: #3a1c1c; color: #ffb3b3; border: none; padding: 8px 12px; border-radius: 8px; cursor: pointer; }

.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-top: 14px; }
.result-tile { border-radius: 10px; overflow: hidden; background: var(--card); cursor: pointer; }
.result-tile img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }

@media (max-width: 480px) {
  .topbar h1 { font-size: 15px; }
  .tab-btn { padding: 8px 12px; font-size: 13px; }
}
