:root {
  --bg: #ffffff;
  --bg2: #f5f5f5;
  --surface: #ffffff;
  --surface-alt: #fafafa;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --txt: #171717;
  --txt-dim: #737373;
  --accent: #171717;
  --accent-txt: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --danger: #dc2626;
}
[data-theme="dark"] {
  --bg: #0f0f0f;
  --bg2: #171717;
  --surface: #1a1a1a;
  --surface-alt: #202020;
  --border: #2a2a2a;
  --border-strong: #383838;
  --txt: #f5f5f5;
  --txt-dim: #a3a3a3;
  --accent: #f5f5f5;
  --accent-txt: #0f0f0f;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --danger: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Vazirmatn', sans-serif;
  background: var(--bg);
  color: var(--txt);
  overflow-x: hidden;
  line-height: 1.5;
}

/* generic card / glass — now flat & clean */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.glass.glow { box-shadow: var(--shadow); }

/* buttons */
.btn {
  font-family: inherit; font-size: 14px; font-weight: 500;
  padding: 10px 18px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent); color: var(--accent-txt);
}
.btn-primary:hover { opacity: .88; }
.btn-ghost {
  background: transparent; color: var(--txt); border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-alt); }
.btn.full { width: 100%; }

/* header */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
}
.logo { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.logo-mark { font-size: 22px; }
.logo-text {
  font-weight: 700; font-size: 19px; color: var(--txt);
  letter-spacing: -.3px;
}
.nav-desktop { display: flex; gap: 2px; }
.nav-link {
  background: none; border: none; color: var(--txt-dim); font-family: inherit;
  font-size: 14px; font-weight: 500; padding: 8px 12px; border-radius: 8px;
  cursor: pointer; transition: color .15s, background .15s;
}
.nav-link:hover { color: var(--txt); }
.nav-link.active { color: var(--txt); background: var(--surface-alt); }

.header-search {
  margin-inline-start: auto; display: flex; align-items: center; gap: 8px;
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; min-width: 200px;
}
.search-ic { opacity: .5; font-size: 14px; }
.search-inp, .hero-search-inp {
  background: none; border: none; outline: none; color: var(--txt);
  font-family: inherit; font-size: 14px; width: 100%;
}
.search-inp::placeholder, .hero-search-inp::placeholder { color: var(--txt-dim); }

.theme-toggle {
  width: 38px; height: 38px; border-radius: 8px; cursor: pointer;
  background: var(--surface-alt); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; padding: 0;
  transition: background .15s;
}
.theme-toggle:hover { background: var(--border); }
.toggle-knob {
  width: auto; height: auto; background: none !important;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
}

.hamburger { display: none; background: var(--surface-alt); border: 1px solid var(--border); color: var(--txt); font-size: 16px; width: 38px; height: 38px; border-radius: 8px; cursor: pointer; }
.mobile-drawer { display: flex; flex-direction: column; padding: 10px 20px 16px; gap: 6px; border-top: 1px solid var(--border); background: var(--bg); }
.drawer-link { background: var(--surface-alt); border: 1px solid var(--border); color: var(--txt); font-family: inherit; font-size: 15px; padding: 12px; border-radius: 8px; cursor: pointer; text-align: right; }

/* main */
.main { max-width: 1200px; margin: 0 auto; padding: 0 20px 60px; }

/* hero */
.hero { padding: 48px 0 24px; }
.hero-inner { text-align: center; max-width: 720px; margin: 0 auto; }
.hero-title {
  font-weight: 800;
  font-size: clamp(28px, 5vw, 44px); line-height: 1.2; letter-spacing: -.5px;
}
.grad-text { color: var(--txt); }
.hero-sub { color: var(--txt-dim); font-size: 16px; margin: 14px 0 26px; }
.hero-search {
  display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px;
  border-radius: 10px; max-width: 560px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border-strong);
}
.hero-search .search-ic { padding-inline-start: 6px; font-size: 16px; }
.hero-search-inp { flex: 1; font-size: 15px; }
.hero-trending { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.trend-lbl { color: var(--txt-dim); font-size: 13px; }
.trend-chip {
  background: var(--surface-alt); border: 1px solid var(--border); color: var(--txt-dim);
  font-family: inherit; font-size: 13px; padding: 5px 12px; border-radius: 6px; cursor: pointer; transition: color .15s, border-color .15s;
}
.trend-chip:hover { color: var(--txt); border-color: var(--border-strong); }
.hero-stats { display: flex; justify-content: center; gap: 40px; margin-top: 30px; }
.hstat { display: flex; flex-direction: column; align-items: center; }
.hstat b { font-size: 24px; font-weight: 700; color: var(--txt); }
.hstat span { color: var(--txt-dim); font-size: 12px; }

/* categories */
.cats-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 16px 0 8px; }
.cats-row.inline { justify-content: flex-start; margin: 10px 0; }
.cat-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); color: var(--txt-dim);
  font-family: inherit; font-size: 13px; font-weight: 500;
  padding: 7px 14px; border-radius: 8px; cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.cat-chip:hover { color: var(--txt); border-color: var(--border-strong); }
.cat-chip.active {
  color: var(--accent-txt); border-color: transparent; background: var(--accent);
}
.cat-icon { font-size: 14px; }

/* sections */
.gallery-section { padding-top: 16px; }
.section-head { margin-bottom: 8px; }
.section-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; letter-spacing: -.3px; }
.section-title.home-sec { margin: 26px 0 12px; }

/* masonry */
.masonry {
  columns: 4; column-gap: 16px; margin-top: 16px;
}
@media (max-width: 1100px) { .masonry { columns: 3; } }
@media (max-width: 760px) { .masonry { columns: 2; column-gap: 12px; } }
@media (max-width: 460px) { .masonry { columns: 1; } }

.wall-card {
  break-inside: avoid; margin-bottom: 16px; border-radius: 10px; overflow: hidden;
  cursor: pointer; position: relative; border: 1px solid var(--border);
  background: var(--surface); transition: border-color .15s;
}
.wall-card:hover { border-color: var(--border-strong); }
.wall-img-wrap { position: relative; width: 100%; height: 0; overflow: hidden; }
.wall-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .3s;
}
.wall-img.show { opacity: 1; }
.skeleton {
  position: absolute; inset: 0; height: 100%;
  background: var(--surface-alt);
}
.wall-overlay {
  position: absolute; inset: 0; padding: 12px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.05) 55%, transparent 75%);
  opacity: 0; transition: opacity .2s;
}
.wall-card:hover .wall-overlay { opacity: 1; }
.wall-top { display: flex; justify-content: flex-start; }
.res-badge {
  background: rgba(0,0,0,0.55); color: #fff;
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 5px;
}
.wall-bottom { color: #fff; }
.wall-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.wall-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; opacity: .9; margin-bottom: 8px; }
.wall-stats { display: flex; gap: 8px; }
.wall-view-btn {
  text-align: center; background: #fff; color: #171717;
  padding: 7px; border-radius: 6px; font-size: 12px; font-weight: 600;
}

.empty { text-align: center; padding: 60px 20px; color: var(--txt-dim); font-size: 16px; }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; padding: 24px;
  max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto;
  position: relative; box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.modal-box.wide { max-width: 920px; }
.modal-close {
  position: absolute; top: 14px; left: 14px; width: 32px; height: 32px;
  border-radius: 8px; background: var(--surface-alt); border: 1px solid var(--border);
  color: var(--txt); cursor: pointer; font-size: 14px; z-index: 5;
}
.modal-close:hover { background: var(--border); }

/* detail */
.detail { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
.detail-img-glow { position: relative; border-radius: 10px; overflow: hidden; }
.detail-img { width: 100%; display: block; border-radius: 10px; border: 1px solid var(--border); }
.detail-info { display: flex; flex-direction: column; }
.cat-tag {
  align-self: flex-start; background: var(--surface-alt); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 6px; font-size: 13px; color: var(--txt-dim); margin-bottom: 10px;
}
.detail-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; letter-spacing: -.3px; }
.detail-desc { color: var(--txt-dim); font-size: 14px; line-height: 1.7; margin-bottom: 14px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag-chip {
  background: var(--surface-alt); border: 1px solid var(--border); color: var(--txt-dim);
  font-size: 12px; padding: 4px 10px; border-radius: 6px; font-family: inherit;
}
.tag-chip.clickable { cursor: pointer; transition: border-color .15s, color .15s; }
.tag-chip.clickable:hover { color: var(--txt); border-color: var(--border-strong); }
.tag-chip.sel { background: var(--accent); color: var(--accent-txt); border-color: transparent; }
.detail-specs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px;
}
.spec {
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; display: flex; justify-content: space-between; align-items: center;
}
.spec span { color: var(--txt-dim); font-size: 12px; }
.spec b { font-size: 14px; }
.dl-btn { width: 100%; font-size: 15px; padding: 13px; }
.related { margin-top: 20px; }
.related-title { font-size: 14px; color: var(--txt-dim); margin-bottom: 10px; }
.related-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.related-thumb { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: pointer; transition: opacity .15s; border: 1px solid var(--border); }
.related-thumb:hover { opacity: .8; }

/* forms */
.form-heading { font-size: 20px; font-weight: 700; margin-bottom: 18px; transition: color .3s; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { margin-bottom: 14px; }
.field-label { font-size: 13px; color: var(--txt-dim); margin-bottom: 6px; font-weight: 500; }
.inp {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; color: var(--txt);
  font-family: inherit; font-size: 14px; outline: none; transition: border-color .15s;
}
.inp:focus { border-color: var(--txt); }
textarea.inp { resize: vertical; }
select.inp { cursor: pointer; }
select.inp option { background: var(--surface); color: var(--txt); }
.select-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; }
.ai-gen { margin-top: 16px; }
.ai-row { display: flex; gap: 8px; }
.ai-row .inp { flex: 1; }
.form-preview { margin-top: 16px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.form-preview img { width: 100%; display: block; max-height: 260px; object-fit: cover; }

/* login */
.login-box { text-align: center; }
.login-emoji { font-size: 40px; margin-bottom: 8px; }
.login-box .field { text-align: right; }
.err-msg { color: var(--danger); font-size: 13px; margin-bottom: 12px; }
.login-hint { color: var(--txt-dim); font-size: 12px; margin-top: 14px; }

/* filter */
.filter-card { padding: 0; overflow: hidden; margin-bottom: 18px; }
.filter-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.filter-toggle { color: var(--txt-dim); }
.filter-body { max-height: 0; overflow: hidden; transition: max-height .25s ease; padding: 0 18px; }
.filter-body.open { max-height: 600px; padding: 0 18px 18px; }
.filter-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tag-filter { margin-top: 14px; }
.tag-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.clear-btn { margin-top: 14px; }

/* admin */
.admin-wrap { padding-top: 26px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; margin-bottom: 22px; }
.admin-title { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.admin-sub { color: var(--txt-dim); font-size: 14px; margin-top: 4px; }
.admin-head-btns { display: flex; gap: 10px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { display: flex; align-items: center; gap: 12px; padding: 16px 18px; box-shadow: none; }
.stat-icon { width: 42px; height: 42px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; background: var(--surface-alt) !important; box-shadow: none; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--txt-dim); font-size: 12px; margin-top: 2px; }

.manage-card { padding: 18px; box-shadow: none; }
.manage-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.manage-list { display: flex; flex-direction: column; gap: 8px; }
.manage-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.manage-thumb { width: 52px; height: 52px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.manage-info { flex: 1; min-width: 0; }
.manage-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.manage-meta { color: var(--txt-dim); font-size: 12px; margin-top: 3px; }
.manage-btns { display: flex; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 14px; transition: background .15s; }
.icon-btn.edit:hover { background: var(--surface-alt); }
.icon-btn.del:hover { background: var(--surface-alt); }

/* footer */
.footer { border-top: 1px solid var(--border); background: var(--bg); margin-top: 40px; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 36px 20px 18px; display: grid; grid-template-columns: 1.5fr 2fr; gap: 30px; }
.footer-tag { color: var(--txt-dim); font-size: 14px; margin-top: 10px; max-width: 320px; }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.fcol h4 { font-size: 14px; margin-bottom: 12px; }
.fcol a { display: block; color: var(--txt-dim); font-size: 13px; text-decoration: none; margin-bottom: 8px; transition: color .15s; }
.fcol a:hover { color: var(--txt); }
.footer-bottom { max-width: 1200px; margin: 0 auto; padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; color: var(--txt-dim); font-size: 13px; }
.remix-link { color: var(--txt); text-decoration: underline; font-weight: 600; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: var(--accent-txt);
  padding: 11px 22px; border-radius: 8px; font-size: 14px; z-index: 300;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

/* dropzone */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: 10px;
  padding: 28px 20px; text-align: center; cursor: pointer;
  background: var(--surface-alt); transition: border-color .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--txt); }
.drop-icon { font-size: 30px; margin-bottom: 8px; }
.drop-title { font-weight: 600; font-size: 14px; }
.drop-sub { color: var(--txt-dim); font-size: 13px; margin-top: 4px; }

/* remove decorative animations */
.fade-up { }

/* responsive */
@media (max-width: 860px) {
  .nav-desktop { display: none; }
  .hamburger { display: block; }
  .header-search { min-width: 0; flex: 1; }
  .detail { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .hero-stats { gap: 24px; }
}
@media (max-width: 520px) {
  .header-search { display: none; }
  .select-row { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
  .detail-specs { grid-template-columns: 1fr; }
}