@import url('https://v1.fontapi.ir/css/Vazirmatn');

:root {
  --primary: #7c5cff;
  --accent: #ff6fb0;
  --bg-deep: #0f0c1d;
  --bg-glass: rgba(255, 255, 255, 0.06);
  --border-glass: rgba(255, 255, 255, 0.12);
  --text-main: #f2f0ff;
  --text-muted: #b8b3d1;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  direction: rtl;
  background: radial-gradient(circle at 20% 0%, #2a1f5c 0%, var(--bg-deep) 55%),
              radial-gradient(circle at 90% 90%, #3a1250 0%, transparent 50%);
  background-color: var(--bg-deep);
  color: var(--text-main);
  min-height: 100vh;
}

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

.glass {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 44px; width: 44px; object-fit: contain; border-radius: 12px; }
.brand h1 { font-size: 1.25rem; margin: 0; font-weight: 700; }

.header-actions { display: flex; align-items: center; gap: 10px; }
.btn {
  padding: 10px 18px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; box-shadow: 0 6px 18px rgba(124,92,255,.35); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border-glass); }
.btn-small { padding: 6px 12px; font-size: .8rem; }

.admin-link {
  font-size: .78rem;
  color: var(--text-muted);
  opacity: .55;
  padding: 6px 10px;
}
.admin-link:hover { opacity: 1; }

/* ---------- Banner ---------- */
.banner {
  margin: 18px 28px 6px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  max-height: 200px;
}
.banner img { width: 100%; display: block; max-height: 200px; object-fit: cover; }

/* ---------- Thumbnail Nav ---------- */
.thumb-nav {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 16px 28px;
  scrollbar-width: thin;
}
.thumb-nav a {
  flex: 0 0 auto;
  width: 54px; height: 54px;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  border: 2px solid transparent;
  transition: border-color .15s ease;
}
.thumb-nav a:hover, .thumb-nav a.active { border-color: var(--accent); }

/* ---------- Books Grid ---------- */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  padding: 10px 28px 100px;
}

.book-card {
  padding: 14px;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
  position: relative;
}
.book-card:hover { transform: translateY(-6px) rotate(-0.5deg); box-shadow: 0 14px 30px rgba(0,0,0,.35); }

.book-card .cover {
  width: 100%;
  aspect-ratio: 3/4;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  background-size: cover;
  background-position: center;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-end;
  padding: 8px;
  font-size: 1.8rem;
}
.book-card .title { font-size: .92rem; font-weight: 600; text-align: center; margin: 0; }
.book-card .badge {
  position: absolute;
  top: 20px; left: 20px;
  font-size: .68rem;
  padding: 3px 9px;
  border-radius: 20px;
  background: rgba(0,0,0,.5);
}
.badge.locked { color: #ffb0b0; }
.badge.open { color: #b0ffcf; }

/* ---------- Floating Action Button ---------- */
.fab-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 10px;
}
.fab-main {
  width: 58px; height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255,111,176,.4);
}
.fab-menu {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}
.fab-menu.open { display: flex; }
.fab-menu a, .fab-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  white-space: nowrap;
  font-size: .85rem;
}

/* ---------- Forms / Modals ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(5,3,15,.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  width: 100%;
  max-width: 420px;
  padding: 26px;
}
.modal-box h3 { margin-top: 0; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-size: .85rem; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  background: rgba(255,255,255,.04);
  color: var(--text-main);
  font-family: inherit;
  font-size: .95rem;
}
.form-error { color: #ff8a8a; font-size: .85rem; margin-top: 6px; }
.form-success { color: #86ffb0; font-size: .85rem; margin-top: 6px; }
.modal-close { position: absolute; top: 14px; left: 14px; background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: .8rem;
}

/* ---------- Admin Layout ---------- */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 230px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-sidebar a {
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: .9rem;
}
.admin-sidebar a.active, .admin-sidebar a:hover { background: var(--bg-glass); color: var(--text-main); }
.admin-content { flex: 1; padding: 28px; }
.admin-card { padding: 20px; margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 10px; text-align: right; border-bottom: 1px solid var(--border-glass); font-size: .88rem; }
.status-pill { padding: 3px 10px; border-radius: 20px; font-size: .75rem; }
.status-pill.on { background: rgba(80,255,150,.15); color: #86ffb0; }
.status-pill.off { background: rgba(255,100,100,.15); color: #ff8a8a; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 16px; }
.stat-box { padding: 18px; text-align: center; }
.stat-box .num { font-size: 1.8rem; font-weight: 700; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }

@media (max-width: 720px) {
  .site-header, .banner, .thumb-nav, .books-grid { margin-left: 12px; margin-right: 12px; padding-left: 12px; padding-right: 12px; }
  .admin-wrap { flex-direction: column; }
  .admin-sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
}
