*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f6f8;
  color: #1a1a1a;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: #0ab39c; text-decoration: none; }
button { font: inherit; cursor: pointer; }

:root {
  --accent: #0ab39c;
  --accent-dark: #079b85;
  --line: #e5e7eb;
  --muted: #6b7280;
  --bg-card: #fff;
  --danger: #dc2626;
}

/* ---------- Auth ---------- */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: 360px;
  background: var(--bg-card);
  padding: 32px 28px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-card h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 6px;
  text-align: center;
}
.auth-card label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--muted);
  gap: 4px;
}
.auth-card input,
.field input, .field textarea, .field select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  width: 100%;
}
.auth-card button,
.btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: 500;
  font-size: 13px;
}
.btn:hover, .auth-card button:hover { background: var(--accent-dark); }
.btn.secondary {
  background: #fff;
  border: 1px solid var(--line);
  color: #1a1a1a;
}
.btn.secondary:hover { background: #f8f9fa; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.error { color: var(--danger); font-size: 12px; margin: 0; text-align: center; }

/* ---------- Admin layout ---------- */
.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.admin-sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
}
.admin-sidebar .brand {
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 13px;
  margin-bottom: 24px;
}
.admin-sidebar nav a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: #374151;
  font-size: 13px;
  margin-bottom: 2px;
}
.admin-sidebar nav a.active,
.admin-sidebar nav a:hover {
  background: #f1f5f4;
  color: var(--accent-dark);
}
.admin-sidebar .footer {
  margin-top: auto;
  font-size: 12px;
  color: var(--muted);
}
.admin-sidebar .footer a { display: block; margin-top: 8px; }

.admin-main {
  padding: 32px 36px 60px;
  max-width: 1280px;
  width: 100%;
}
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.admin-header h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
}
.admin-header .crumbs a { color: var(--muted); }
.admin-header .crumbs { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
}
.card + .card { margin-top: 18px; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.field textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }

/* ---------- Gallery list ---------- */
.gallery-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.gallery-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: grab;
  transition: opacity 0.15s ease, box-shadow 0.15s ease;
}
.gallery-card:active { cursor: grabbing; }
.gallery-card.dragging {
  opacity: 0.4;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}
.gallery-card .btn { cursor: pointer; }
.gallery-card .cover {
  aspect-ratio: 4 / 5;
  background: #f1f5f4;
  position: relative;
  overflow: hidden;
}
.gallery-card .cover img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%; 
  height: 100%; 
  object-fit: cover;
}
.gallery-card .info {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.gallery-card .title {
  font-weight: 500;
  margin: 0 0 4px;
  font-size: 14px;
}
.gallery-card .meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.badge {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f4;
  color: #0a6e63;
  margin-right: 6px;
}
.badge.draft { background: #fef3c7; color: #92400e; }
.gallery-card .actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
}

/* ---------- Editor: photo grid ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}
.toolbar .spacer { flex: 1; }

.dropzone {
  display: block;
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: #fff;
  margin-bottom: 18px;
}
.dropzone.hover { border-color: var(--accent); background: #f1fbf9; color: var(--accent-dark); }
.dropzone input[type=file] { display: none; }
.dropzone .upload-btn {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 500;
}

.upload-list {
  margin: 0 0 18px;
  font-size: 12px;
  color: var(--muted);
}
.upload-list li { padding: 4px 0; }
.upload-list .ok { color: #047857; }
.upload-list .err { color: var(--danger); }

.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.photo-tile {
  position: relative;
  aspect-ratio: 1;
  background: #f1f5f4;
  border-radius: 6px;
  overflow: hidden;
  cursor: grab;
  user-select: none;
}
.photo-tile.dragging { opacity: 0.4; }
.photo-tile img {
  width: 100%; height: 100%; object-fit: cover;
}
.photo-tile .tile-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.photo-tile:hover .tile-actions { opacity: 1; }
.tile-actions button {
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tile-actions button:hover { background: rgba(0,0,0,0.85); }
.photo-tile.is-cover::before {
  content: 'COVER';
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 1;
}

.empty {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

/* ---------- Dropzone hint (inline, replaces full dropzone label) ---------- */
.dropzone-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 18px;
  background: #fafafa;
  flex-wrap: wrap;
}
.dropzone-hint svg { flex-shrink: 0; color: var(--accent); }
.upload-link {
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
}
.upload-link input[type=file] { display: none; }
.upload-link:hover { text-decoration: underline; }

/* ---------- Page-wide drop overlay ---------- */
#page-drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 179, 156, 0.1);
  border: 3px dashed var(--accent);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
#page-drop-overlay.visible { display: flex; }
.drop-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: rgba(255,255,255,0.95);
  border-radius: 16px;
  padding: 40px 56px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
  color: var(--accent-dark);
  font-size: 18px;
  font-weight: 500;
}
.drop-overlay-inner svg { stroke: var(--accent); }

/* ---------- Trash ---------- */
.trash-card { margin-top: 18px; }
.trash-card .photo-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(220, 38, 38, 0.08);
  pointer-events: none;
}
.tile-restore {
  background: rgba(10, 179, 156, 0.85) !important;
}
.tile-perm-del {
  background: rgba(220, 38, 38, 0.75) !important;
}

/* ---------- Hero image focal point ---------- */
.hero-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1120 / 480;
  overflow: hidden;
  background: #f1f5f4;
  border-radius: 6px;
}
.hero-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-preview-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(10, 179, 156, 0.9);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.6);
  pointer-events: none;
  transform: translateY(-50%);
  top: 50%;
}
#hero-pos-slider { width: 100%; }

/* ---------- Google Photos import ---------- */
.gp-import {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
  background: #fafafa;
}
.gp-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 10px;
}
.gp-row {
  display: flex;
  gap: 8px;
}
.gp-row input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  background: #fff;
}
.gp-row input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.gp-status {
  margin-top: 8px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
}
.gp-status.loading { background: #f1f5f4; color: var(--muted); }
.gp-status.ok      { background: #f0fdf4; color: #166534; }
.gp-status.err     { background: #fef2f2; color: var(--danger); }
.gp-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ---------- Translations Manager ---------- */
.tabs {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.tab-btn {
  background: transparent;
  border: none;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 12px;
  position: relative;
  transition: color 0.2s;
}
.tab-btn:hover { color: var(--accent); }
.tab-btn.active { color: #1a1a1a; }
.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -9px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

.trans-item {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin-bottom: 16px;
}
.trans-item h4 {
  margin: 0 0 16px 0;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.trans-status {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
}
.trans-status.missing {
  background: #fee2e2;
  color: #dc2626;
}
.trans-status.ok {
  background: #dcfce7;
  color: #16a34a;
}
.trans-lang-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.trans-input-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.trans-input-group label {
  width: 30px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}
.trans-input-group .g-input {
  flex: 1;
}
.trans-input-group .g-btn {
  padding: 8px 12px;
}

/* ---------- Flash toast ---------- */
.admin-flash {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 14px;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.admin-flash.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.admin-flash.is-err {
  background: var(--danger);
}

/* ---------- Confirm modal ---------- */
.admin-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  animation: admin-fade-in 0.15s ease;
}
.admin-confirm-box {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 24px 24px 20px;
  width: 420px;
  max-width: 92vw;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.admin-confirm-box p {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.45;
  color: #1a1a1a;
}
.admin-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
@keyframes admin-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
