/* ============================================================
   ZHENYA CLOUD — Dark Wallpaper Site
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0a0a0a;
  --bg2:      #131313;
  --bg3:      #1e1e1e;
  --border:   #252525;
  --text:     #efefef;
  --dim:      #888;
  --mute:     #444;
  --white:    #ffffff;
  --r:        14px;
  --r-sm:     8px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ── HEADER ── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,10,10,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1440px; margin: 0 auto; padding: 0 40px;
  height: 66px; display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 13px; }
.logo-icon { width: 38px; height: 38px; flex-shrink: 0; }
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-name { font-size: 1.05rem; font-weight: 700; letter-spacing: .04em; color: var(--white); }
.logo-sub  { font-size: .68rem; color: var(--mute); letter-spacing: .1em; text-transform: uppercase; margin-top: 1px; }

.header-nav { display: flex; align-items: center; gap: 32px; }
.header-nav a {
  font-size: .85rem; color: var(--dim); letter-spacing: .03em;
  transition: color .2s; position: relative; padding-bottom: 2px;
}
.header-nav a::after {
  content: ""; position: absolute; left: 0; bottom: -2px;
  width: 0; height: 1px; background: var(--white); transition: width .25s;
}
.header-nav a:hover { color: var(--white); }
.header-nav a:hover::after { width: 100%; }

/* ── HERO ── */
.hero {
  text-align: center; padding: 72px 32px 44px;
  max-width: 680px; margin: 0 auto;
}
.hero h1 {
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 800; letter-spacing: -.04em; color: var(--white); margin-bottom: 14px;
}
.hero p { font-size: 1rem; color: var(--dim); line-height: 1.75; margin-bottom: 22px; }
.hero-stats { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: .82rem; color: var(--mute); }
.dot { opacity: .35; }

/* ── FILTER ── */
.filter-bar { max-width: 1440px; margin: 0 auto; padding: 0 40px 36px; }
.search-wrap { position: relative; max-width: 380px; }
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; stroke: var(--mute); pointer-events: none;
}
.filter-bar input {
  width: 100%; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); padding: 10px 14px 10px 40px;
  font-size: .88rem; outline: none; font-family: inherit; transition: border-color .2s;
}
.filter-bar input::placeholder { color: var(--mute); }
.filter-bar input:focus { border-color: #383838; }

/* ── GALLERY GRID ── */
.gallery {
  max-width: 1440px; margin: 0 auto; padding: 0 40px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
  gap: 28px; flex: 1;
}

/* ── CARD ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: transform .25s cubic-bezier(.25,.46,.45,.94), border-color .25s, box-shadow .25s;
  cursor: pointer;
}
.card:hover {
  transform: translateY(-6px);
  border-color: #333;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
}

/* Photo — full image, no crop */
.card-thumb {
  position: relative;
  background: #0d0d0d;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  min-height: 200px;
}
.card-thumb img {
  width: 100%; height: auto; max-height: 560px;
  object-fit: cover; display: block;
  transition: transform .45s cubic-bezier(.25,.46,.45,.94);
}
.card:hover .card-thumb img { transform: scale(1.08); }

/* Overlay */
.card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0) 30%,
    rgba(0,0,0,.35) 60%,
    rgba(0,0,0,.7) 100%
  );
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0; transition: opacity .3s;
}
.card:hover .card-overlay { opacity: 1; }

.overlay-actions {
  flex: 1; display: flex; align-items: center; justify-content: center;
}

.btn-card-dl {
  display: inline-flex; align-items: center; gap: 8px;
  backdrop-filter: blur(14px);
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.28);
  color: white; font-size: .88rem; font-weight: 700;
  padding: 12px 26px; border-radius: 50px;
  letter-spacing: .04em;
  transform: translateY(10px); opacity: 0;
  transition: background .2s, transform .35s cubic-bezier(.25,.46,.45,.94), opacity .35s;
  text-decoration: none;
}
.card:hover .btn-card-dl { transform: translateY(0); opacity: 1; }
.btn-card-dl:hover { background: rgba(255,255,255,.26); }
.btn-card-dl svg { width: 15px; height: 15px; stroke: white; flex-shrink: 0; }

.overlay-bottom { display: none; }

/* Card info bar */
.card-info {
  padding: 14px 18px 16px;
  display: flex; flex-direction: column; gap: 7px;
}
.card-title {
  font-size: .92rem; font-weight: 600; color: var(--white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.card-date {
  display: flex; align-items: center; gap: 5px;
  font-size: .74rem; color: var(--dim); flex-shrink: 0;
}
.card-date svg { width: 11px; height: 11px; opacity: .5; }
.card-right-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.card-res {
  font-size: .7rem; color: var(--dim);
  background: var(--bg3); padding: 2px 8px; border-radius: 20px;
  letter-spacing: .02em;
}
.card-size {
  font-size: .7rem; color: var(--mute);
  background: var(--bg3); padding: 2px 8px; border-radius: 20px;
}

/* ── EMPTY STATE ── */
.empty-state {
  grid-column: 1 / -1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 120px 0; color: var(--mute);
}
.empty-icon svg { width: 72px; height: 72px; margin-bottom: 20px; opacity: .2; }
.empty-state p { font-size: .95rem; }

/* ── FOOTER ── */
.site-footer { background: var(--bg2); border-top: 1px solid var(--border); margin-top: auto; }
.footer-inner { max-width: 1440px; margin: 0 auto; padding: 32px 40px; }
.copyright-block { display: flex; align-items: flex-start; gap: 14px; }
.copyright-icon { width: 20px; height: 20px; flex-shrink: 0; opacity: .35; margin-top: 2px; }
.copyright-main { font-size: .85rem; color: var(--dim); margin-bottom: 6px; }
.copyright-sub { font-size: .8rem; color: var(--mute); line-height: 1.65; }
.copyright-sub a { color: var(--dim); text-decoration: underline; text-underline-offset: 3px; transition: color .2s; }
.copyright-sub a:hover { color: var(--white); }


/* ── ADMIN STYLES ── */
.admin-wrap { max-width: 1000px; margin: 48px auto; padding: 0 32px; flex: 1; }
.login-box {
  max-width: 400px; margin: 0 auto;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 40px;
}
.login-box h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 28px; color: var(--white); }
.admin-section { margin-bottom: 56px; }
.admin-section h2 {
  font-size: 1.25rem; font-weight: 700; color: var(--white);
  margin-bottom: 24px; display: flex; align-items: center; gap: 12px;
}
.count-badge {
  background: var(--bg3); border: 1px solid var(--border);
  font-size: .78rem; color: var(--mute); padding: 2px 10px; border-radius: 20px;
}
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: .83rem; color: var(--dim); margin-bottom: 8px; }
.form-group input[type="text"],
.form-group input[type="password"] {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text);
  padding: 11px 14px; font-size: .9rem; outline: none; font-family: inherit;
  transition: border-color .2s;
}
.form-group input:focus { border-color: #444; }
.drop-zone {
  position: relative; border: 2px dashed var(--border); border-radius: var(--r);
  padding: 48px 24px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s; margin-bottom: 20px; background: var(--bg2);
}
.drop-zone:hover, .drop-zone.drag-over { border-color: #444; background: var(--bg3); }
.drop-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop-zone-content svg { width: 48px; height: 48px; stroke: var(--mute); margin-bottom: 16px; }
.drop-zone-content p { font-size: .95rem; color: var(--dim); margin-bottom: 6px; }
.drop-zone-content p span { color: var(--white); text-decoration: underline; text-underline-offset: 3px; }
.drop-hint { font-size: .8rem !important; color: var(--mute) !important; }
.file-list { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; max-height: 200px; overflow-y: auto; }
.file-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg3); border-radius: var(--r-sm);
  padding: 8px 12px; font-size: .82rem; color: var(--dim);
}
.file-item span:last-child { color: var(--mute); }
.btn-primary {
  display: inline-block; background: var(--white); color: #000;
  font-weight: 700; font-size: .9rem; padding: 12px 28px;
  border-radius: var(--r-sm); border: none; cursor: pointer;
  font-family: inherit; letter-spacing: .02em; transition: background .2s, transform .15s;
}
.btn-primary:hover { background: #e8e8e8; transform: translateY(-1px); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-sm {
  font-size: .78rem; padding: 6px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border); cursor: pointer; font-family: inherit;
  font-weight: 500; transition: all .2s; text-decoration: none; display: inline-block;
}
.btn-outline { background: transparent; color: var(--dim); }
.btn-outline:hover { background: var(--bg3); color: var(--white); }
.btn-danger { background: transparent; color: #e74c3c; border-color: rgba(231,76,60,.3); }
.btn-danger:hover { background: rgba(231,76,60,.1); border-color: #e74c3c; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.admin-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.admin-thumb { aspect-ratio: 16/10; background: var(--bg3); overflow: hidden; }
.admin-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.admin-card-info { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.admin-card-title { font-size: .85rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-card-meta { font-size: .74rem; color: var(--mute); }
.admin-card-actions { display: flex; gap: 8px; margin-top: 4px; }
.nav-btn { background: none; border: none; cursor: pointer; font-family: inherit; }
.alert { padding: 12px 16px; border-radius: var(--r-sm); font-size: .875rem; margin-bottom: 24px; }
.alert-error { background: rgba(192,57,43,.15); border: 1px solid rgba(192,57,43,.4); color: #e74c3c; }
.alert-success { background: rgba(39,174,96,.12); border: 1px solid rgba(39,174,96,.35); color: #2ecc71; }
.empty-text { color: var(--mute); font-size: .9rem; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .gallery { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
}
@media (max-width: 768px) {
  .header-inner { padding: 0 20px; }
  .hero { padding: 48px 20px 32px; }
  .filter-bar, .gallery, .footer-inner { padding-left: 20px; padding-right: 20px; }
  .gallery { grid-template-columns: 1fr; gap: 18px; }
  .viewer-stage { padding: 16px 60px 0; }
  .viewer-panel { padding: 16px 20px 20px; flex-direction: column; align-items: flex-start; gap: 16px; }
  .viewer-nav { width: 40px; height: 40px; }
  .viewer-prev { left: 10px; }
  .viewer-next { right: 10px; }
}
@media (max-width: 480px) {
  .logo-sub { display: none; }
  #viewerImg { max-height: calc(100vh - 200px); }
}

/* ── PAGINATION ── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 40px 24px 16px;
}
.pg-numbers { display: flex; align-items: center; gap: 6px; }
.pg-num {
  min-width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); font-size: .875rem; font-weight: 500;
  color: var(--dim); text-decoration: none; border: 1px solid transparent;
  transition: all .15s;
}
.pg-num:hover { background: var(--bg3); color: var(--white); border-color: var(--border); }
.pg-active {
  background: var(--white) !important; color: #000 !important;
  border-color: var(--white) !important; font-weight: 700;
}
.pg-btn {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); border: 1px solid var(--border); text-decoration: none;
  color: var(--dim); transition: all .15s;
}
.pg-btn svg { width: 18px; height: 18px; }
.pg-btn:hover:not(.pg-disabled) { background: var(--bg3); color: var(--white); }
.pg-disabled { opacity: .3; cursor: default; pointer-events: none; }
.pg-dots { color: var(--mute); padding: 0 4px; font-size: .875rem; }
.pg-info {
  text-align: center; color: var(--mute); font-size: .8rem;
  padding-bottom: 32px;
}
.search-clear {
  color: var(--mute); text-decoration: none; font-size: .85rem;
  padding: 0 8px; transition: color .15s;
}
.search-clear:hover { color: var(--white); }
