:root {
  --bg: #0f1117;
  --surface: #181b24;
  --surface-2: #222633;
  --text: #eef0f6;
  --muted: #9aa0b4;
  --accent: #ff4757;
  --accent-hover: #ff2e43;
  --border: #2a2f3f;
  --radius: 10px;
}

[data-theme="light"] {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --text: #1c1e26;
  --muted: #5c6378;
  --border: #dde2ec;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.container { max-width: 1320px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}
.logo { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.5px; }
.logo-accent { color: var(--accent); }
.main-nav { display: flex; gap: 18px; font-weight: 600; font-size: 0.94rem; flex-wrap: wrap; }
.main-nav a:hover { color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 10px; }
.search-form {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.search-form input {
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 7px 14px;
  width: 210px;
  outline: none;
  font-size: 0.9rem;
}
.search-form button, .icon-btn {
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  padding: 7px 12px;
  font-size: 1rem;
}
.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
}

/* Main Layout */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 28px;
  padding-top: 24px;
  padding-bottom: 48px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.section-header h1 { font-size: 1.35rem; font-weight: 700; }
.badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.82rem;
}

/* Album Grid */
.album-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.album-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.album-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.album-thumb {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  background: var(--surface-2);
  overflow: hidden;
}
.album-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}
.album-card:hover .album-thumb img { transform: scale(1.04); }
.thumb-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
}
.album-body { padding: 10px 12px; }
.album-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.album-title a:hover { color: var(--accent); }
.album-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--muted);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}
.page-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 7px 13px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.page-ellipsis { color: var(--muted); padding: 0 4px; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 22px; }
.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.widget-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.popular-list { display: flex; flex-direction: column; gap: 12px; }
.popular-item { display: flex; gap: 10px; align-items: center; }
.popular-item img {
  width: 58px;
  height: 74px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--surface-2);
}
.popular-name {
  font-size: 0.85rem;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.popular-item:hover .popular-name { color: var(--accent); }
.popular-views { font-size: 0.75rem; color: var(--muted); margin-top: 3px; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 0.78rem;
}
.tag-pill:hover { border-color: var(--accent); color: var(--accent); }
.tag-pill span { color: var(--muted); }

/* Post Detail */
.post-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.breadcrumbs { font-size: 0.84rem; color: var(--muted); margin-bottom: 10px; }
.breadcrumbs a:hover { color: var(--accent); }
.post-title { font-size: 1.55rem; line-height: 1.3; margin-bottom: 8px; }
.post-submeta { display: flex; gap: 16px; color: var(--muted); font-size: 0.85rem; margin-bottom: 14px; }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.info-box {
  background: var(--surface-2);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 20px;
  display: grid;
  gap: 6px;
  font-size: 0.94rem;
}
.pw-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pw-row input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
  width: 150px;
}
.copy-btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.download-section {
  text-align: center;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 22px;
}
.download-section h3 { margin-bottom: 12px; font-size: 1.05rem; }
.download-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.dl-btn {
  background: var(--accent);
  color: #fff;
  padding: 10px 22px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 0.92rem;
  transition: background 0.15s;
}
.dl-btn:hover { background: var(--accent-hover); }

.video-section { margin-bottom: 22px; display: grid; gap: 16px; }
.video-wrap { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 8px; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; }

.gallery-section { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.gallery-item { width: 100%; display: flex; justify-content: center; }
.gallery-img {
  border-radius: 8px;
  cursor: zoom-in;
  max-height: 92vh;
  width: auto;
}

.related-section { margin-top: 28px; }
.section-heading { font-size: 1.2rem; margin-bottom: 14px; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox.hidden { display: none; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 6px; }
.lb-close, .lb-nav {
  position: fixed;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 0;
  cursor: pointer;
  border-radius: 99px;
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
}
.lb-close { top: 18px; right: 20px; font-size: 1.2rem; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }

/* Admin */
.admin-panel h1 { margin-bottom: 16px; }
.alert {
  background: #1f3a2e;
  border: 1px solid #2e7d5b;
  color: #a7f3d0;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.admin-topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.stats-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-pill { background: var(--surface); border: 1px solid var(--border); padding: 8px 14px; border-radius: 8px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.admin-card h2 { font-size: 1.1rem; margin-bottom: 10px; }
.admin-card h3 { font-size: 0.95rem; margin: 14px 0 8px; }
.muted { color: var(--muted); font-size: 0.88rem; margin-bottom: 12px; }
.login-box { max-width: 380px; display: grid; gap: 12px; }
.stack-form { display: grid; gap: 10px; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
input, textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  width: 100%;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.btn-danger {
  background: #7f1d1d;
  color: #fecaca;
  border: 0;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }
.status-success { color: #34d399; font-weight: 600; }
.status-error { color: #f87171; font-weight: 600; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 20px 0;
  font-size: 0.86rem;
  color: var(--muted);
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-links { display: flex; gap: 16px; }
.footer-links a:hover { color: var(--accent); }

@media (max-width: 1024px) {
  .main-layout { grid-template-columns: 1fr; }
  .album-grid { grid-template-columns: repeat(3, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .album-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .search-form input { width: 150px; }
  .post-detail { padding: 14px; }
  .post-title { font-size: 1.25rem; }
}
