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

:root {
  --bg: #0b0d12;
  --bg-elev: #12151c;
  --bg-elev-2: #1a1e28;
  --border: #262b36;
  --text: #eef0f4;
  --text-muted: #8b93a3;
  --accent: #6c5ce7;
  --accent-hover: #7d6ef0;
  --danger: #e5484d;
  --success: #2fbf71;
  --radius: 14px;
  --font-head: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand { font-family: var(--font-head); }

a { color: inherit; text-decoration: none; }

.muted { color: var(--text-muted); }
.center { text-align: center; }

/* ---------- Header / Footer ---------- */
.site-header, .admin-header {
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  background: var(--bg-elev);
}
.admin-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1000px;
  margin: 0 auto;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.brand-sub {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.85rem;
}
.admin-nav a {
  margin-left: 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.admin-nav a:hover { color: var(--text); }

.site-footer {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* ---------- Buttons / Forms ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: rgba(229,72,77,0.15); color: var(--danger); }
.btn-danger:hover { background: rgba(229,72,77,0.25); }
.btn-small { padding: 8px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.field span {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}
.field input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
}

.alert {
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}
.alert-error { background: rgba(229,72,77,0.12); color: #ff8a8d; border: 1px solid rgba(229,72,77,0.3); }
.alert-success { background: rgba(47,191,113,0.12); color: #6fe3a4; border: 1px solid rgba(47,191,113,0.3); }

.share-link, .share-box {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.share-link input, .share-box input {
  flex: 1;
  min-width: 200px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
}

/* ---------- Auth ---------- */
.admin-body { min-height: 100vh; }
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
}
.auth-title {
  margin: 0 0 22px;
  font-size: 1.4rem;
}

/* ---------- Admin dashboard ---------- */
.admin-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 24px;
}
.card-narrow { max-width: 440px; }
.card-title {
  margin: 0 0 18px;
  font-size: 1.1rem;
}
.upload-form { max-width: 480px; }

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.admin-item {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.admin-thumb {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #000;
}
.admin-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.play-badge-mini {
  position: absolute;
  top: 50%; left: 50%;
  width: 36px; height: 36px;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.55);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.play-badge-mini::after {
  content: '';
  width: 0; height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid #fff;
  margin-left: 3px;
}
.admin-item-body { padding: 10px 12px 14px; }
.admin-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-item-link {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Public photo page ---------- */
.photo-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}
.photo-frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}
.photo-img {
  width: 100%;
  height: auto;
  display: block;
}
.play-overlay {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.5));
}
.play-icon { width: 84px; height: 84px; }
.play-overlay-sm .play-icon { width: 52px; height: 52px; }
.play-circle { fill: rgba(0,0,0,0.45); stroke: rgba(255,255,255,0.85); stroke-width: 2; }
.play-triangle { fill: #fff; }

.photo-title {
  font-size: 1.4rem;
  margin: 20px 0 6px;
  line-height: 1.3;
}
.back-link {
  display: inline-block;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.back-link:hover { color: var(--text); }

/* ---------- Public homepage ---------- */
.home-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px;
}
.home-item { display: block; }
.home-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}
.home-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}
.home-item:hover .home-thumb img { transform: scale(1.04); }
.home-item-title {
  margin: 8px 2px 0;
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
  .admin-header-inner, .home-main, .admin-main { padding-left: 24px; padding-right: 24px; }
}
