/* Gallery — dark minimal theme */

:root {
  --bg: #111214;
  --bg-soft: #1a1c1f;
  --bg-card: #1e2024;
  --border: #2c2f34;
  --text: #e8e6e1;
  --text-dim: #9a9890;
  --accent: #d9a441;
  --danger: #d9534f;
  --ok: #4caf7d;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.brand {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text);
}
.brand:hover { text-decoration: none; color: var(--accent); }
.site-nav a { margin-left: 18px; color: var(--text-dim); font-size: 14px; }
.site-nav a:hover { color: var(--text); text-decoration: none; }

.site-main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px; }
.site-footer { text-align: center; padding: 20px; color: var(--text-dim); font-size: 13px; border-top: 1px solid var(--border); }

.page-title { font-weight: 500; letter-spacing: 1px; margin: 6px 0 22px; }
.breadcrumb { margin: 0; font-size: 14px; }
.breadcrumb a { color: var(--text-dim); }
.empty-note { color: var(--text-dim); }

/* Flash messages */
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 18px; font-size: 14px; }
.flash-ok { background: rgba(76, 175, 125, .15); border: 1px solid var(--ok); }
.flash-err { background: rgba(217, 83, 79, .15); border: 1px solid var(--danger); }
.flash-warn { background: rgba(217, 164, 65, .12); border: 1px solid var(--accent); }

/* Album grid */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}
.album-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s ease, border-color .15s ease;
}
.album-card:hover { transform: translateY(-3px); border-color: var(--accent); text-decoration: none; }
.album-cover { aspect-ratio: 4 / 3; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-cover-empty { color: var(--text-dim); font-size: 14px; }
.album-meta { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.album-title { color: var(--text); font-weight: 500; }
.album-count { color: var(--text-dim); font-size: 13px; }

/* Photo grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.photo-tile {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 4px;
  background: var(--bg-soft);
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.photo-tile:hover img { transform: scale(1.04); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .94);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.lightbox[hidden] { display: none; }
body.lb-open { overflow: hidden; }
.lightbox img { max-width: 92vw; max-height: 92vh; object-fit: contain; }
.lb-btn {
  position: absolute;
  background: none;
  border: none;
  color: #fff;
  font-size: 42px;
  cursor: pointer;
  padding: 14px 20px;
  opacity: .7;
}
.lb-btn:hover { opacity: 1; }
.lb-close { top: 8px; right: 12px; }
.lb-prev { left: 6px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 6px; top: 50%; transform: translateY(-50%); }
.lb-counter { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); color: var(--text-dim); font-size: 14px; }

/* Forms */
.auth-box { max-width: 380px; margin: 40px auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
form label { display: block; margin-bottom: 14px; font-size: 14px; color: var(--text-dim); }
input[type=text], input[type=password], select {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 9px 11px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 15px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }

.btn {
  display: inline-block;
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #181818; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }

/* Admin */
.admin-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 24px; }
.admin-section h2 { margin: 0 0 14px; font-size: 17px; font-weight: 600; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.admin-table th { color: var(--text-dim); font-weight: 500; }
.admin-table td form { display: inline; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form label { margin-bottom: 0; }
.inline-form input, .inline-form select { width: auto; min-width: 160px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--text); font-size: 14px; }
.checkbox-row input { width: auto; margin: 0; }

/* Admin photo manager */
.manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.manage-tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-soft);
  cursor: grab;
}
.manage-tile.dragging { opacity: .4; }
.manage-tile img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; pointer-events: none; }
.manage-tile .tile-bar { display: flex; justify-content: space-between; align-items: center; padding: 5px 7px; font-size: 11px; color: var(--text-dim); gap: 4px; }
.manage-tile .tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-tile.is-cover { border-color: var(--accent); }
.cover-star { color: var(--accent); }
.tile-actions { display: flex; gap: 4px; }
.tile-actions button { background: none; border: none; cursor: pointer; font-size: 13px; padding: 1px 4px; color: var(--text-dim); }
.tile-actions button:hover { color: var(--text); }
.tile-actions .t-del:hover { color: var(--danger); }

.hint { color: var(--text-dim); font-size: 13px; }

@media (max-width: 600px) {
  .site-header { padding: 14px 16px; }
  .site-main { padding: 16px; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
}
