@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #1a1614;
  --surface: #221d19;
  --surface-hover: #2b241f;
  --border: #3a322b;
  --text: #f2ece2;
  --text-muted: #948a7c;
  --accent: #ff4433;
  --accent-dim: #7a2a22;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

h1, h2, .brand {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

code, .mono, .meta {
  font-family: "IBM Plex Mono", monospace;
}

a {
  color: inherit;
}

/* ---------- shared layout ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
}

.brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px 1px var(--accent);
}

.topbar .who {
  color: var(--text-muted);
  font-size: 13px;
}

button, .btn {
  font: inherit;
  cursor: pointer;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 16px;
  transition: background 0.15s, border-color 0.15s;
}

button:hover, .btn:hover {
  background: var(--surface-hover);
  border-color: #4a4038;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1614;
  font-weight: 600;
}

button.primary:hover {
  background: #ff5b4c;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  text-decoration: underline;
  padding: 0;
}

/* ---------- login page ---------- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 32px 28px;
}

.login-card .brand {
  justify-content: center;
  margin-bottom: 24px;
  font-size: 20px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-family: "IBM Plex Mono", monospace;
}

.field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 3px;
  font: inherit;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-card button {
  width: 100%;
  margin-top: 6px;
}

.error-msg {
  color: var(--accent);
  font-size: 13px;
  margin-top: 12px;
  min-height: 1em;
}

/* ---------- app page ---------- */

.app-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 28px 60px;
}

.dropzone {
  margin-top: 28px;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  transition: border-color 0.15s, background 0.15s;
}

.dropzone.drag {
  border-color: var(--accent);
  background: rgba(255, 68, 51, 0.06);
}

.dropzone .hint {
  font-size: 13px;
  margin-top: 6px;
}

.dropzone input[type="file"] {
  display: none;
}

.upload-queue {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.upload-row .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-row .status {
  color: var(--text-muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

.upload-row.done .status { color: #6cbf6c; }
.upload-row.error .status { color: var(--accent); }

.section-title {
  margin: 36px 0 14px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.frame .sprockets {
  display: flex;
  justify-content: space-between;
  padding: 4px 6px;
  background: #14110f;
}

.frame .sprockets span {
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: #4a4038;
}

.frame .thumb {
  aspect-ratio: 1;
  background: #0f0d0b;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.frame .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.frame .info {
  padding: 8px 10px 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.frame .info .fname {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.frame .copy {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 11px;
  padding: 4px 8px;
  opacity: 0;
  transition: opacity 0.15s;
}

.frame:hover .copy {
  opacity: 1;
}

.empty-state {
  color: var(--text-muted);
  font-size: 13px;
  padding: 30px 0;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 6px;
}

.sub-link {
  display: block;
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}

.sub-link:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ---------- gallery toolbar ---------- */

.gallery-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 36px;
  margin-bottom: 14px;
}

.gallery-toolbar input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 4px;
  font-size: 13px;
}

.gallery-toolbar input:focus {
  outline: none;
  border-color: var(--accent);
}

.gallery-toolbar .stats {
  font-size: 12px;
  color: var(--text-muted);
  font-family: "IBM Plex Mono", monospace;
  white-space: nowrap;
}

.load-more {
  display: block;
  margin: 20px auto 0;
  padding: 10px 24px;
}

/* ---------- lightbox ---------- */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 7, 0.9);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox.open {
  display: flex;
}

.lightbox-inner {
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  position: relative;
}

.lightbox-inner img {
  max-width: 100%;
  max-height: 65vh;
  border-radius: 6px;
  border: 1px solid var(--border);
  object-fit: contain;
  background: #0f0d0b;
}

.lightbox-meta {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

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

.lightbox-actions .btn,
.lightbox-actions button {
  text-decoration: none;
  font-size: 13px;
}

.lightbox-actions button.danger {
  background: transparent;
  border-color: var(--accent-dim);
  color: var(--accent);
}

.lightbox-actions button.danger:hover {
  background: rgba(255, 68, 51, 0.1);
}

.lightbox-close {
  position: absolute;
  top: -44px;
  right: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  line-height: 1;
  padding: 4px 8px;
}

.lightbox-close:hover {
  color: var(--text);
}

.frame .thumb {
  cursor: pointer;
}

/* ---------- selection mode ---------- */

.select-check {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: none;
}

.gallery.selecting .select-check {
  display: block;
}

.select-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.gallery.selecting .frame.selected {
  outline: 2px solid var(--accent);
}

.gallery.selecting .copy {
  display: none;
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

button.danger {
  background: transparent;
  border-color: var(--accent-dim);
  color: var(--accent);
}

button.danger:hover {
  background: rgba(255, 68, 51, 0.1);
}

/* ---------- modal (ganti password) ---------- */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 7, 0.75);
  z-index: 60;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 26px 24px;
}

.modal-card h2 {
  font-size: 16px;
  margin: 0 0 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.lightbox-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 320px;
}

.lightbox-meta input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  text-align: center;
}

.lightbox-meta span {
  color: var(--text-muted);
  font-size: 11px;
}

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