/* Base reset and theme */
@font-face{
  font-family: 'ASuls';
  src: url('font/A Suls Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face{
  font-family: 'Amiri';
  src: url('font/amiri-regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face{
  font-family: 'YekanPlus';
  src: url('font/YEKAN PLUS.TTF') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face{
  font-family: 'PersianKhatKhati';
  src: url('font/persian-khat-khati-02.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face{
  font-family: 'PersianKhatKhatiNumbers';
  src: url('font/persian-khat-khati-02.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+06F0-06F9, U+0660-0669, U+0030-0039;
}

@font-face{
  font-family: 'DimaShekasteh';
  src: url('font/Dima Shekasteh.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face{
  font-family: 'Noorehira';
  src: url('font/Noorehira_p30download.com.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root{
  --bg: #0b1f14;            /* deep forest green */
  --bg-2: #13261a;          /* darker green layer */
  --accent: #4cc38a;        /* modern emerald */
  --accent-2: #82d6a7;      /* soft mint */
  --ink: #f7f2e8;
  --ink-dim: #e5dccb;
  --wood: #5a3b22;          /* warm brown (kept) */
  --wood-2: #2f1d12;        /* deeper brown */
  --shadow: rgba(0,0,0,.35);
  --glass: rgba(255,255,255,.06);
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background: radial-gradient(1200px 800px at 70% -200px, #1c3a2a 0%, var(--bg) 55%), var(--bg);
  color: var(--ink);
  font-family: "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.6;
}
/* Enforce Vazirmatn on all controls */
input, button, select, textarea{ font-family: "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }
/* Placeholder font consistency */
input::placeholder, textarea::placeholder{ font-family: inherit; }

/* Topbar - Glassmorphism */
.topbar{
  position: sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between;
  padding: 14px 20px;
  background: rgba(11, 31, 20, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.15);
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.brand{display:flex; align-items:center; gap:12px}
.brand-mark{
  height: 40px;
  width: auto;
  filter: drop-shadow(0 2px 4px var(--shadow));
  object-fit: contain;
  transform: translateY(-2px);
}
.topbar h1{margin:0; font-weight:800; letter-spacing:.5px}
.actions{display:flex; align-items:center; gap:12px}
.client-group{display:inline-flex; align-items:center; gap:8px}
.profile-stack{display:inline-flex; flex-direction: column; align-items:center; gap:4px}
.actions input[type="search"]{
  width:min(44vw,560px); padding:10px 14px; border-radius:10px; border:1px solid rgba(255,255,255,.08); background: var(--glass); color:var(--ink);
}
/* Client ID badge */
.client-id{
  display:inline-flex; align-items:center; justify-content:center;
  min-width: 72px; padding: 9px 14px; border-radius: 999px;
  background: rgba(0,30,20,.28);
  border: 1px solid rgba(130,214,167,.35);
  color: var(--accent-2);
  font: 700 14px/1.05 "Vazirmatn", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  letter-spacing: .4px;
  user-select: text;
}
/* Profile icon button */
.profile-btn{ 
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid rgba(130,214,167,.35);
  background:
    radial-gradient(60% 60% at 50% 40%, rgba(255,255,255,.12), rgba(255,255,255,0)) padding-box,
    rgba(0,30,20,.28);
  display:inline-grid; place-items:center; cursor:pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.profile-btn::before{
  content:""; display:block; width:18px; height:18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
  background-size: contain; background-repeat:no-repeat; background-position:center;
  opacity:.9;
}
.profile-btn:hover{ background: rgba(0,50,35,.45); border-color: rgba(130,214,167,.6) }
.profile-btn:focus-visible{ outline:none; box-shadow: 0 0 0 3px rgba(76,195,138,.35) }
/* Display name under profile icon */
.display-name{
  font: 600 12.5px/1 "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--accent-2);
  opacity: .9;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
/* White X icon for search clear button (WebKit) */
input[type="search"]::-webkit-search-cancel-button{
  -webkit-appearance: none;
  height: 16px; width: 16px;
  background-repeat: no-repeat; background-position: center; background-size: 12px 12px;
  opacity: .9; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 3 L13 13 M13 3 L3 13' stroke='%23FFFFFF' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
input[type="search"]:hover::-webkit-search-cancel-button{ opacity: 1 }
button{font:inherit; cursor:pointer}
button.primary{
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); color:#0f2418; border:none; border-radius:10px; padding:10px 14px; font-weight:700; box-shadow: 0 6px 16px rgba(76,195,138,.25);
}
button.ghost{background:transparent; border:1px solid rgba(255,255,255,.15); color:var(--ink); border-radius:10px; padding:9px 14px}
/* Modern secondary button (used by Admin) */
button.secondary{
  display:inline-flex; align-items:center; gap:8px;
  background: rgba(0,30,20,.25);
  border: 1px solid rgba(130,214,167,.35);
  color: var(--accent-2);
  border-radius: 10px; padding: 9px 14px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .12s ease, color .18s ease;
}
button.secondary:hover{
  background: rgba(0,50,35,.45);
  border-color: rgba(130,214,167,.6);
  box-shadow: 0 8px 22px rgba(0,0,0,.35);
}
button.secondary:active{ transform: translateY(1px) scale(.98) }
button.secondary:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(76,195,138,.35), 0 8px 22px rgba(0,0,0,.35);
}
/* Specific modern style for admin button */
#adminBtn{
  letter-spacing:.2px; font-weight:700;
  border: 1px solid transparent; border-radius: 999px; padding: 9px 14px;
  font-size: 14px; line-height: 1.05;
  background:
    linear-gradient(rgba(0,30,20,.28), rgba(0,30,20,.28)) padding-box,
    linear-gradient(90deg, rgba(130,214,167,.55), rgba(76,195,138,.35)) border-box;
  color: var(--accent-2);
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
#adminBtn:hover{
  background:
    linear-gradient(rgba(0,50,35,.42), rgba(0,50,35,.42)) padding-box,
    linear-gradient(90deg, rgba(130,214,167,.75), rgba(76,195,138,.55)) border-box;
  box-shadow: 0 6px 18px rgba(0,0,0,.32), 0 0 0 2px rgba(76,195,138,.12) inset;
}
#adminBtn:active{ transform: translateY(1px); box-shadow: 0 2px 8px rgba(0,0,0,.28) }
#adminBtn:focus-visible{
  outline: none;
  box-shadow: 0 0 0 3px rgba(76,195,138,.35), 0 6px 18px rgba(0,0,0,.32);
}

/* Shelves */
main{padding: 28px 16px 60px}
.shelves{
  max-width: 1400px; /* wider shelf container */
  margin: 0 auto; display:grid; gap:38px;
}
.shelf{
  position:relative; padding: 28px 22px 56px; border-radius:14px; background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(0,60,30,.18));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), inset 0 -10px 40px rgba(0,0,0,.25), 0 12px 40px rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.06);
  overflow-x: hidden; /* keep horizontal overflow inside */
  overflow-y: visible; /* allow labels to show outside */
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hidden shelf animation */
.shelf.hidden {
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-bottom: 0;
  pointer-events: none;
  overflow: hidden;
}
/* Hide decorative horizontal bar near shelf title */
.shelf::before{ display: none }
/* Shelf header container */
.shelf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
}

.shelf-title{margin:0; font-weight:800; color:var(--accent-2); text-shadow:0 2px 10px rgba(0,0,0,.5); position:relative; z-index:3; flex: 1}

/* 3D Scrolls (طومار) */
.scrolls{
  display:flex; flex-wrap: nowrap; gap:18px;
  overflow-x: auto; overflow-y: hidden; /* hide vertical scroll; keep horizontal programmatic */
  -webkit-overflow-scrolling: touch; /* momentum on iOS */
  padding-bottom: 44px; /* reserve space for labels without vertical scroll */
  scroll-snap-type: x proximity;
  width: 100%; min-width: 0; /* contain width */
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Expanded shelf scrolls - allow wrapping to multiple rows */
.shelf.expanded .scrolls{
  flex-wrap: wrap;
  overflow-x: visible;
  overflow-y: visible;
  max-height: none;
  height: auto;
  justify-content: flex-start;
  align-content: flex-start;
  padding-bottom: 60px; /* More space for labels in multi-row layout */
  gap: 50px 18px; /* Increased vertical gap to prevent overlap with labels */
}

/* Hide navigation arrows in expanded shelves */
.shelf.expanded .scroll-nav {
  display: none;
}

/* Keyframes for smooth card animations */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
/* Hide scrollbar visuals (keep scrollable for buttons) */
.scrolls{ -ms-overflow-style: none; scrollbar-width: none; }
.scrolls::-webkit-scrollbar{ display: none; }
.scroll-3d{
  --w: 150px; --h: 210px; /* further reduced height */
  width: var(--w); height: var(--h); position:relative;
  transition: transform .2s ease, filter .2s ease, opacity 0.4s ease, width 0.3s ease, height 0.3s ease; cursor:pointer; isolation:isolate;
  flex: 0 0 auto; /* prevent shrinking and wrap */
  scroll-snap-align: start;
  opacity: 1;
  animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Mobile: smaller cards in expanded shelves */
@media (max-width: 560px) {
  .shelf.expanded .scroll-3d {
    --w: 90px !important; --h: 125px !important; /* smaller size for mobile expanded shelves */
    width: 90px !important;
    height: 125px !important;
  }
  
  /* Alternative selector in case expanded class doesn't work */
  .shelf .scrolls[style*="flex-wrap"] .scroll-3d {
    --w: 90px !important; --h: 125px !important;
    width: 90px !important;
    height: 125px !important;
  }
}
.scroll-3d:hover{
  transform: translateY(-8px) scale(1.04);
  filter: brightness(1.15) saturate(120%);
}
.scroll-3d:hover .scroll-canvas{
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.1)),
    linear-gradient(135deg, rgba(76, 195, 138, 0.2), rgba(130, 214, 167, 0.1));
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 
    0 16px 48px rgba(0, 0, 0, 0.4),
    0 4px 16px rgba(76, 195, 138, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}
.scroll-3d:focus-visible{outline:2px solid var(--accent)}

/* Horizontal nav arrows for shelves (modern green theme) */
.scroll-nav{
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid rgba(130,214,167,.35);
  background: rgba(0,30,20,.35); color: var(--ink);
  display: grid; place-items: center; z-index: 4;
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  opacity: 0; transition: opacity .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .12s ease;
  font-size: 18px; line-height: 1; user-select: none;
}
.scroll-nav.prev{left: 8px}
.scroll-nav.next{right: 8px}
.shelf:hover .scroll-nav{opacity: 1}
@media (hover: none){ .scroll-nav{opacity: 1} }
.scroll-nav:hover{background: rgba(0,50,35,.55); border-color: rgba(130,214,167,.5); box-shadow: 0 10px 28px rgba(0,0,0,.45)}
.scroll-nav:active{transform: translateY(-50%) scale(.96); background: rgba(0,60,42,.7)}
.scroll-nav:focus-visible{outline: none; box-shadow: 0 0 0 3px rgba(76,195,138,.35), 0 10px 28px rgba(0,0,0,.45)}
.scroll-nav[disabled]{opacity:.35; cursor: default; filter: grayscale(25%)}

/* Smaller navigation arrows on mobile */
@media (max-width: 560px) {
  .scroll-nav {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .scroll-nav.prev {
    left: 6px;
  }
  
  .scroll-nav.next {
    right: 6px;
  }
}
.scroll-canvas{
  position:absolute; inset:0; border-radius: 16px; overflow:hidden;
  /* Modern glassmorphism with gradient */
  background: 
    linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05)),
    linear-gradient(135deg, rgba(76, 195, 138, 0.1), rgba(130, 214, 167, 0.05));
  backdrop-filter: blur(20px) saturate(200%);
  -webkit-backdrop-filter: blur(20px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 2px 8px rgba(76, 195, 138, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  /* Enable touch interactions */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Custom card color styling - more vivid and matte */
.scroll-3d.custom-color .scroll-canvas {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--custom-card-color) 50%, rgba(255, 255, 255, 0.12)),
    color-mix(in srgb, var(--custom-card-color) 60%, rgba(255, 255, 255, 0.06))
  ) !important;
  backdrop-filter: blur(6px) saturate(1.4) !important;
  border: 1px solid color-mix(in srgb, var(--custom-card-color) 65%, rgba(255, 255, 255, 0.3)) !important;
  box-shadow: 
    0 8px 32px color-mix(in srgb, var(--custom-card-color) 40%, rgba(0, 0, 0, 0.2)),
    inset 0 1px 0 color-mix(in srgb, var(--custom-card-color) 75%, rgba(255, 255, 255, 0.35)),
    0 4px 16px color-mix(in srgb, var(--custom-card-color) 30%, rgba(0, 0, 0, 0.12)) !important;
  opacity: 0.92 !important;
}

.scroll-3d.custom-color:hover .scroll-canvas {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--custom-card-color) 55%, rgba(255, 255, 255, 0.18)),
    color-mix(in srgb, var(--custom-card-color) 65%, rgba(255, 255, 255, 0.10))
  ) !important;
  backdrop-filter: blur(8px) saturate(1.5) !important;
  border: 1px solid color-mix(in srgb, var(--custom-card-color) 70%, rgba(255, 255, 255, 0.35)) !important;
  box-shadow: 
    0 12px 48px color-mix(in srgb, var(--custom-card-color) 45%, rgba(0, 0, 0, 0.25)),
    inset 0 1px 0 color-mix(in srgb, var(--custom-card-color) 80%, rgba(255, 255, 255, 0.4)),
    0 6px 24px color-mix(in srgb, var(--custom-card-color) 35%, rgba(0, 0, 0, 0.15)) !important;
  opacity: 0.95 !important;
  transform: translateY(-2px) !important;
}

/* Expert badge for custom color cards - styled like card-view-count */
.scroll-3d.custom-color .expert-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
  /* Enhanced glassmorphism for expert badge */
  background: 
    linear-gradient(135deg, rgba(212, 175, 55, 0.4), rgba(184, 148, 31, 0.2)),
    linear-gradient(135deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.1));
  backdrop-filter: blur(8px);
  padding: 4px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.3),
    0 1px 4px rgba(212, 175, 55, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 3px;
  user-select: none;
  pointer-events: none;
  letter-spacing: 0.5px;
}

.scroll-3d.custom-color:hover .expert-badge {
  background: 
    linear-gradient(135deg, rgba(212, 175, 55, 0.6), rgba(184, 148, 31, 0.3)),
    linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.2));
  box-shadow: 
    0 6px 20px rgba(0, 0, 0, 0.4),
    0 2px 8px rgba(212, 175, 55, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
}

/* Mobile responsive for expert badge */
@media (max-width: 560px) {
  .scroll-3d.custom-color .expert-badge {
    top: 3px;
    left: 3px;
    font-size: 7px;
    padding: 1px 4px;
    border-radius: 6px;
    letter-spacing: 0.2px;
  }
}

/* Decorations Section Styling */
.decorations-section {
  margin: 16px 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.decorations-toggle {
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.decorations-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
}

.decorations-icon {
  font-size: 16px;
}

.decorations-text {
  flex: 1;
  text-align: right;
}

.decorations-arrow {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.decorations-toggle.expanded .decorations-arrow {
  transform: rotate(180deg);
}

.decorations-content {
  padding: 0 16px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.decorations-content label {
  margin: 0;
}

.decorations-content input[type="color"] {
  width: 60px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.decorations-content input[type="color"]:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(76, 195, 138, 0.2);
}

.decorations-content .field-hint {
  color: var(--ink-2);
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

/* Checkbox styling */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-text {
  font-size: 14px;
  color: var(--ink);
  user-select: none;
}

/* Color label styling */
.color-label {
  transition: opacity 0.3s ease, pointer-events 0.3s ease;
}

.color-label.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.color-label input[type="color"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.scroll-canvas canvas{
  display:block; width:100% !important; height:100% !important;
  /* Enable touch interactions on canvas */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.scroll-label{
  position:absolute; bottom:-36px; left:0; right:0; text-align:center; color:var(--ink);
  font-weight:600; line-height:1.2; font-size:13px;
  z-index:2;
  /* keep titles in one line under the card */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.scroll-label small{
  display:block; color:var(--ink-dim); font-weight:500; opacity:.8; font-size:11px;
  margin-top: 4px; /* افزایش فاصله بین عنوان و نام نویسنده */
  /* keep subtitle in a single line as well */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-view-count{
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
  /* Enhanced glassmorphism for view count badge */
  background: 
    linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.2)),
    linear-gradient(135deg, rgba(76, 195, 138, 0.15), rgba(130, 214, 167, 0.1));
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  padding: 4px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.3),
    0 1px 4px rgba(76, 195, 138, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 3px;
}
.view-icon{
  width: 12px;
  height: 12px;
  fill: currentColor;
  opacity: 0.9;
}

/* Author link styling */
.author-link {
  color: var(--accent) !important;
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.author-link:hover {
  color: var(--accent-2) !important;
  opacity: 0.9;
}

/* Drawer */
.drawer{
  position: fixed; inset: 0 0 0 auto; width: min(480px, 92vw);
  /* Glassy white background */
  background: rgba(255,255,255,.015);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  transform: translateX(105%); transition: transform .3s ease;
  border-left: 1px solid rgba(255,255,255,.1);
  box-shadow: -10px 0 30px rgba(0,0,0,.25);
  z-index: 50;
  overflow-y: auto;
  overflow-x: hidden;
}
.drawer.open{transform: translateX(0)}

/* Custom scrollbar for drawer */
.drawer::-webkit-scrollbar {
  width: 8px;
}
.drawer::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}
.drawer::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, rgba(76, 195, 138, 0.6), rgba(130, 214, 167, 0.4));
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.drawer::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, rgba(76, 195, 138, 0.8), rgba(130, 214, 167, 0.6));
  border-color: rgba(255, 255, 255, 0.2);
}

/* Drawer header with view count and close button */
.drawer-header{
  position: absolute;
  top: 8px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.drawer .close{
  font-size: 28px;
  background: transparent;
  color: var(--ink);
  border: none;
  cursor: pointer;
  padding: 4px 8px;
}

/* Drawer header layout */
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: transparent;
  border-bottom: none;
  min-height: 50px;
  position: relative;
}

.drawer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  transform: translateX(12px);
}

/* View count in drawer header */
.drawer-header .view-count{
  position: static;
  bottom: auto;
  left: auto;
  font-size: 12px;
  color: var(--ink);
  opacity: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0 8px;
  border-radius: 8px;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  min-width: 40px;
  height: 32px;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 500;
}

/* Share button styling */
.share-btn {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  min-width: 40px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  color: var(--accent);
}

.share-btn:hover {
  background: rgba(76, 195, 138, 0.25);
  border-color: rgba(76, 195, 138, 0.5);
  color: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(76, 195, 138, 0.2);
}

/* Bookmark button styling */
.bookmark-btn {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  min-width: 40px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  color: rgba(255, 215, 0, 0.7);
}

.bookmark-btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: all 0.2s ease;
}

.bookmark-btn:hover {
  background: rgba(255, 215, 0, 0.15);
  border-color: rgba(255, 215, 0, 0.4);
  color: #ffd700;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2);
}

.bookmark-btn.bookmarked {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffd700;
}

.bookmark-btn.bookmarked svg {
  fill: #ffd700;
  stroke: none;
}

/* Close button in drawer header */
.drawer-header .close {
  min-width: 40px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--ink);
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.drawer-header .close:hover {
  background: rgba(255, 0, 0, 0.25);
  border-color: rgba(255, 0, 0, 0.5);
  color: #ff6b6b;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 0, 0, 0.2);
}
.parchment{
  position: relative;
  margin: 8px 16px 24px; padding: 20px;
  background: 
    /* Ink stains and aging spots */
    radial-gradient(circle at 15% 25%, rgba(139, 69, 19, 0.15) 8px, transparent 12px),
    radial-gradient(circle at 85% 15%, rgba(160, 82, 45, 0.12) 6px, transparent 10px),
    radial-gradient(circle at 70% 80%, rgba(101, 67, 33, 0.08) 12px, transparent 18px),
    radial-gradient(circle at 25% 70%, rgba(139, 69, 19, 0.1) 5px, transparent 8px),
    radial-gradient(circle at 90% 60%, rgba(160, 82, 45, 0.06) 15px, transparent 20px),
    /* Subtle texture overlay */
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 2px,
      rgba(139, 69, 19, 0.02) 2px,
      rgba(139, 69, 19, 0.02) 4px
    ),
    /* Background image */
    url('img/bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color:#4a2910; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.35), inset 0 0 0 1px rgba(0,0,0,.08);
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Realistic ink blots and aging effects */
.parchment::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    /* Large ink blot */
    radial-gradient(ellipse 40px 25px at 20% 30%, rgba(101, 58, 22, 0.25) 30%, transparent 70%),
    /* Small ink drops */
    radial-gradient(circle 8px at 75% 20%, rgba(139, 69, 19, 0.2) 40%, transparent 60%),
    radial-gradient(circle 12px at 30% 85%, rgba(160, 82, 45, 0.15) 35%, transparent 65%),
    /* Aging stains */
    radial-gradient(ellipse 60px 30px at 80% 70%, rgba(139, 69, 19, 0.08) 50%, transparent 80%),
    radial-gradient(ellipse 35px 20px at 10% 60%, rgba(101, 67, 33, 0.12) 45%, transparent 75%);
  pointer-events: none;
  border-radius: 12px;
}

.parchment::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    /* Subtle paper texture */
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 1px,
      rgba(139, 69, 19, 0.03) 1px,
      rgba(139, 69, 19, 0.03) 2px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 1px,
      rgba(160, 82, 45, 0.02) 1px,
      rgba(160, 82, 45, 0.02) 2px
    );
  pointer-events: none;
  border-radius: 12px;
  opacity: 0.6;
}

/* Custom color parchment background - glassy tinted with card color */
.parchment.custom-color-parchment {
  background: linear-gradient(145deg, 
    color-mix(in srgb, var(--custom-parchment-color) 25%, rgba(244, 241, 232, 0.95)),
    color-mix(in srgb, var(--custom-parchment-color) 35%, rgba(232, 226, 208, 0.90))
  );
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  border: 1px solid color-mix(in srgb, var(--custom-parchment-color) 40%, rgba(255, 255, 255, 0.3));
  box-shadow: 
    0 10px 40px rgba(0,0,0,.35), 
    inset 0 0 0 1px color-mix(in srgb, var(--custom-parchment-color) 30%, rgba(255, 255, 255, 0.2)),
    0 4px 16px color-mix(in srgb, var(--custom-parchment-color) 20%, rgba(0, 0, 0, 0.1));
}
/* Custom glassmorphism scrollbar for parchment */
.parchment::-webkit-scrollbar {
  width: 10px;
}
.parchment::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  backdrop-filter: blur(4px);
}
.parchment::-webkit-scrollbar-thumb {
  background: 
    linear-gradient(135deg, rgba(76, 195, 138, 0.6), rgba(130, 214, 167, 0.4)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
  border-radius: 6px;
  border: 1px solid rgba(76, 195, 138, 0.3);
  backdrop-filter: blur(8px) saturate(150%);
  box-shadow: 
    0 2px 8px rgba(76, 195, 138, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.parchment::-webkit-scrollbar-thumb:hover {
  background: 
    linear-gradient(135deg, rgba(76, 195, 138, 0.8), rgba(130, 214, 167, 0.6)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.2));
  border-color: rgba(76, 195, 138, 0.5);
  box-shadow: 
    0 4px 12px rgba(76, 195, 138, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.parchment .title{
  margin:0 0 8px 0;
  font-family: 'ASuls', "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 400;
  text-align: center;
  position: relative;
  z-index: 2;
}
.parchment .meta{
  margin:10px 0 14px 0; color:#4a2910;
  font-family: 'PersianKhatKhati', 'Amiri', "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  position: relative;
  z-index: 2;
}

/* Author link in parchment - dark blood red */
.parchment .author-link {
  color: #5d1a1a !important; /* قرمز خونی تیره واقعی برای پرچمنت */
  font-weight: 600;
}

.parchment .author-link:hover {
  color: #7a2222 !important; /* قرمز خونی کمی روشن‌تر در hover */
  opacity: 1;
}
.view-count{
  position: absolute;
  bottom: 24px;
  left: 16px;
  font-size: 12px;
  color: #6b5a43;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 2;
}

/* Ensure long text (without spaces) wraps within parchment content */
.parchment .title,
.parchment .meta,
.parchment .desc{
  white-space: pre-wrap;           /* respect newlines; allow wrapping */
  overflow-wrap: anywhere;         /* break long words when needed */
  word-break: break-word;          /* legacy support */
  max-width: 100%;
}

/* Add spacing after description since meta follows it now */
.parchment .desc{ margin: 0 0 6px 0; }

/* Parchment title font size */
.parchment .title{
  font-family: 'PersianKhatKhati', 'Noorehira', 'DimaShekasteh', 'Amiri', "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
}

/* Use Amiri font for parchment description text with ruled lines under text */
.parchment .desc{
  font-family: 'PersianKhatKhatiNumbers', 'Noorehira', 'DimaShekasteh', 'PersianKhatKhati', 'Amiri', "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 1.1rem;
  line-height: 1.9;
  padding-bottom: 0.2em;
  position: relative;
  z-index: 2;
}

/* Parchment footer */
.parchment-footer {
  color: #5d1a1a !important; /* قرمز خونی تیره */
  font-family: 'PersianKhatKhati', 'Noorehira', 'DimaShekasteh', 'Amiri', "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif !important;
  font-size: 1rem !important;
  text-align: center !important;
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px solid rgba(93, 26, 26, 0.3);
  font-weight: 500 !important;
  position: relative;
  z-index: 2;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

/* Force PersianKhatKhati font for parchment footer */
.parchment .parchment-footer {
  font-family: 'PersianKhatKhati', serif !important;
  text-align: center !important;
  display: block !important;
  width: 100% !important;
  direction: rtl !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* 3D Viewer */
.viewer3d{
  display: none !important;
}
.viewer3d canvas{display:none !important; width:0 !important; height:0 !important}

/* Footer - Glassmorphism (matching header style) */
.footer{
  padding: 24px;
  text-align: center;
  color: var(--ink);
  background: rgba(11, 31, 20, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,.15);
  box-shadow: 
    0 -4px 16px rgba(0, 0, 0, 0.2),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: 0.4px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.footer-logo {
  height: 42px;
  width: auto;
  opacity: 0.8;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
  transition: opacity 0.2s ease;
}

.footer-logo:hover {
  opacity: 1;
}

/* Mobile responsive footer */
@media (max-width: 560px) {
  .footer {
    padding: 12px 16px;
    font-size: 18px;
    letter-spacing: 0.2px;
    gap: 12px;
  }
  
  .footer-logo {
    height: 38px;
  }
}

@media (max-width: 400px) {
  .footer {
    padding: 10px 12px;
    font-size: 16px;
    letter-spacing: 0.1px;
    gap: 10px;
  }
  
  .footer-logo {
    height: 34px;
  }
}

/* Parchment footer inside the drawer card (refined style) */
.parchment-footer{
  margin-top: 16px;
  padding-top: 6px;
  color: #6b5a43; /* muted brown for parchment */
  text-align: center;
  font-family: 'YekanPlus', 'Amiri', "Vazirmatn", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 16px;
  letter-spacing: .4px;
  position: relative;
}
.parchment-footer::before,
.parchment-footer::after{
  content: "";
  display: inline-block;
  height: 1px;
  width: 24%;
  background: linear-gradient(90deg, rgba(0,0,0,0), rgba(0,0,0,.18), rgba(0,0,0,0));
  vertical-align: middle;
  margin: 0 10px;
}
.parchment-footer span{
  display: inline-block;
  transform: translateY(-1px);
}

@media (max-width: 560px){
  .parchment-footer{ font-size: 15px; }
  .parchment-footer::before,
  .parchment-footer::after{ width: 20%; }
}

/* Reaction bar under parchment */
.reaction-bar{
  margin-top: 12px;
  display: flex; align-items: center; gap: 10px; justify-content: center;
  color: #6b5a43;
}
.reaction-title{ font-family: 'YekanPlus', 'Amiri', "Vazirmatn", system-ui; font-size: 14px }
.reaction-actions{ display: inline-flex; gap: 8px; flex-wrap: wrap; direction: ltr }
.reaction{
  background: rgba(255,255,255,.28);
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 14px;
  min-width: 64px;
  height: auto;
  cursor: pointer; transition: transform .12s ease, background .2s ease, box-shadow .2s ease, border-color .2s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,.10);
  unicode-bidi: isolate;
}
.reaction .rx{ font-family: 'YekanPlus', "Vazirmatn", system-ui; font-size: 13px; color: #3a2f23; letter-spacing: .2px }
/* Emoji label sizing */
.reaction .rx-emoji{ font-size: 18px; line-height: 1; display: inline-block; transform: translateY(1px) }
.reaction:hover{ transform: translateY(-1px); background: rgba(255,255,255,.38); border-color: rgba(0,0,0,.16) }
.reaction:active{ transform: translateY(0); box-shadow: 0 2px 6px rgba(0,0,0,.18) }
.reaction.active{ outline: 2px solid rgba(76,195,138,.35); background: rgba(76,195,138,.10) }

/* Reaction count badge */
.reaction-count{
  position: absolute;
  top: -6px; right: -6px;
  background: rgba(76,195,138,.9);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  font-family: 'YekanPlus', system-ui;
}
.reaction{ position: relative; /* for badge positioning */ }

@media (max-width: 560px){
  .reaction-title{ font-size: 13px }
  .reaction{ padding: 6px 12px; min-width: 56px }
  .reaction .rx-emoji{ font-size: 17px }
  .reaction .rx{ font-size: 12.5px }
}

/* Related Scrolls Section */
.related-scrolls {
  margin: 20px 16px 16px;
  padding: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}

.related-title {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-2);
  text-align: center;
  font-family: 'Vazirmatn', sans-serif;
}

.related-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.related-item {
  padding: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  text-align: center;
}

.related-item:hover {
  background: linear-gradient(135deg, rgba(76, 195, 138, 0.15), rgba(130, 214, 167, 0.08));
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(76, 195, 138, 0.2);
}

.related-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
  line-height: 1.3;
  font-family: 'Vazirmatn', sans-serif;
}

.related-item-author {
  font-size: 12px;
  color: var(--ink-dim);
  opacity: 0.8;
  font-family: 'Vazirmatn', sans-serif;
}

@media (max-width: 560px) {
  .related-scrolls {
    margin: 16px 12px 12px;
    padding: 12px;
  }
  
  .related-items {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  
  .related-item {
    padding: 8px 10px;
  }
  
  .related-title {
    font-size: 14px;
    margin-bottom: 8px;
  }
  
  .related-item-title {
    font-size: 12px;
    margin-bottom: 2px;
  }
  
  .related-item-author {
    font-size: 10px;
  }
}

/* Author Profile Modal - Harmonized with Site Theme */
.author-dialog{
  max-width: 650px; width: 92vw; max-height: 92vh; /* افزایش از 85vh به 92vh */
  border: 1px solid rgba(130,214,167,.25); border-radius: 16px;
  background: linear-gradient(145deg, var(--bg), var(--bg-2));
  backdrop-filter: blur(12px); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(76,195,138,.15);
  overflow: hidden;
}
.author-dialog::backdrop{
  background: rgba(11,31,20,.8); backdrop-filter: blur(8px);
}
.author-content{
  display: flex; flex-direction: column; height: 100%; max-height: 92vh; /* افزایش از 85vh به 92vh */
}
.author-header{
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 28px 18px; margin: 0;
  background: linear-gradient(135deg, rgba(76,195,138,.12), rgba(19,38,26,.8));
  border-bottom: 1px solid rgba(130,214,167,.2);
  backdrop-filter: blur(6px);
}
.author-header h2{
  margin: 0; color: var(--accent-2); font-size: 22px; font-weight: 700;
  font-family: "Vazirmatn", system-ui;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.close-author{
  background: rgba(90,59,34,.3); border: 1px solid rgba(130,214,167,.3);
  color: var(--ink); font-size: 18px; cursor: pointer;
  padding: 6px 10px; border-radius: 8px; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease; backdrop-filter: blur(4px);
}
.close-author:hover{
  background: rgba(90,59,34,.5); border-color: var(--accent);
  transform: scale(1.05);
}
.author-stats{
  padding: 16px 28px; margin: 0;
  background: linear-gradient(135deg, rgba(90,59,34,.15), rgba(19,38,26,.3));
  border-bottom: 1px solid rgba(130,214,167,.15);
  text-align: center;
}
.author-stats span{
  color: var(--accent); font-size: 15px; font-weight: 600;
  font-family: "Vazirmatn", system-ui;
}
.author-scrolls{
  flex: 1; overflow-y: auto; padding: 20px 28px 28px;
  display: grid; gap: 12px; grid-template-columns: 1fr; /* برگرداندن grid layout */
  min-height: 0; /* Important for flex child to scroll */
  max-height: calc(92vh - 120px); /* افزایش از 85vh به 92vh */
  /* Optimized performance */
  contain: layout style paint;
  will-change: scroll-position;
  transform: translateZ(0); /* Force GPU acceleration */
  -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
}
.author-scroll-item{
  padding: 16px 20px; border-radius: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(130,214,167,.15);
  cursor: pointer; 
  /* Remove ALL transitions for maximum performance */
  transition: none;
  will-change: auto; /* Let browser optimize */
  transform: translateZ(0); /* GPU layer */
  contain: layout style; /* Isolate reflows */
}
.author-scroll-item:hover{
  background: rgba(76,195,138,.08);
  border-color: var(--accent);
}
.author-scroll-title{
  font-weight: 600; margin-bottom: 6px; color: var(--ink);
  font-size: 15px; line-height: 1.4;
  font-family: "Vazirmatn", system-ui;
}
.author-scroll-topic{
  font-size: 13px; color: var(--ink-dim); line-height: 1.3;
  padding: 4px 10px; background: rgba(90,59,34,.25);
  border-radius: 12px; display: inline-block;
  border: 1px solid rgba(130,214,167,.15);
  font-family: "Vazirmatn", system-ui;
}

/* Custom scrollbar for author modal */
.author-scrolls::-webkit-scrollbar {
  width: 6px;
}
.author-scrolls::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}
.author-scrolls::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}
.author-scrolls::-webkit-scrollbar-thumb:hover {
  background: var(--accent-2);
}

/* Modern custom scrollbar for drawer only */
.drawer::-webkit-scrollbar {
  width: 10px;
}

.drawer::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(8px);
}

.drawer::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 
    0 2px 6px rgba(255, 255, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.drawer::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 
    0 4px 12px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(12px);
  transform: scaleX(1.1);
}

.drawer::-webkit-scrollbar-thumb:active {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 
    0 2px 6px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(8px);
  transform: scaleX(0.95);
}

.drawer::-webkit-scrollbar-corner {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

/* Share Modal Styling */
.share-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Vazirmatn', sans-serif;
}

.share-modal-content {
  background: linear-gradient(145deg, #f4f1e8, #e8e2d0);
  border-radius: 16px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #2a2017;
  text-align: center;
}

.share-modal-content h3 {
  margin: 0 0 16px 0;
  color: #2a2017;
  font-size: 18px;
  font-weight: 600;
}

.share-scroll-info {
  margin: 16px 0;
  padding: 12px;
  background: rgba(76, 195, 138, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(76, 195, 138, 0.2);
}

.share-scroll-title {
  font-size: 16px;
  font-weight: 600;
  color: #2a2017;
  margin-bottom: 6px;
  line-height: 1.4;
}

.share-scroll-author {
  font-size: 14px;
  color: #5b4a38;
  font-weight: 500;
}

.share-url-container {
  margin: 16px 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.share-url-container input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 12px;
  background: white;
  color: #333;
  text-align: left;
  direction: ltr;
}

.share-modal-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
}

.share-modal-buttons button {
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Vazirmatn', sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 80px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-modal-buttons .copy-btn {
  background: var(--accent);
  color: white;
}

.share-modal-buttons .copy-btn:hover {
  background: var(--accent-2);
}

.share-modal-buttons .close-btn {
  background: #666;
  color: white;
}

.share-modal-buttons .close-btn:hover {
  background: #555;
}

/* Mobile responsive for share modal */
@media (max-width: 560px) {
  .share-modal-content {
    padding: 16px;
    width: 95%;
  }
  
  .share-modal-content h3 {
    font-size: 16px;
    margin-bottom: 12px;
  }
  
  .share-scroll-info {
    padding: 8px;
    margin: 12px 0;
  }
  
  .share-scroll-title {
    font-size: 14px;
    margin-bottom: 4px;
  }
  
  .share-scroll-author {
    font-size: 12px;
  }
  
  .share-modal-buttons {
    gap: 6px;
    margin-top: 16px;
  }
  
  .share-modal-buttons button {
    font-size: 12px;
    padding: 6px 12px;
    min-width: 70px;
    height: 28px;
  }
  
  .share-url-container {
    padding: 8px;
    margin: 12px 0;
  }
  
  .share-url-container input {
    font-size: 11px;
    padding: 6px;
  }
}

/* Original parchment scrollbar styling */
.parchment::-webkit-scrollbar {
  width: 8px;
}

.parchment::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.parchment::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.parchment::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}

/* Mobile responsive */
@media (max-width: 560px) {
  .author-dialog{
    width: 94vw; max-height: 92vh; border-radius: 10px; /* افزایش از 80vh به 92vh */
    max-width: 400px; /* محدودیت عرض در موبایل */
  }
  .author-content{
    max-height: 92vh; /* افزایش از 80vh به 92vh */
  }
  .author-header{
    padding: 14px 16px 10px;
  }
  .author-header h2{
    font-size: 17px;
  }
  .close-author{
    width: 32px; height: 32px; font-size: 16px;
  }
  .author-stats{
    padding: 10px 16px;
  }
  .author-stats span{
    font-size: 14px;
  }
}

/* Bookmarks button in header */
.bookmarks-btn {
  background: linear-gradient(135deg, rgba(76, 195, 138, 0.15), rgba(76, 195, 138, 0.05));
  border: 1px solid rgba(76, 195, 138, 0.3);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  margin-right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.bookmarks-btn:hover {
  background: rgba(76, 195, 138, 0.2);
  border-color: rgba(76, 195, 138, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(76, 195, 138, 0.2);
}

@media (max-width: 560px) {
  .bookmarks-btn {
    width: 32px;
    height: 32px;
  }
}

/* Bookmarks Modal Styles */
.bookmarks-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.bookmarks-modal-content {
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(0,60,30,.18));
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 14px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), inset 0 -10px 40px rgba(0,0,0,.25), 0 12px 40px rgba(0,0,0,.35);
  font-family: 'Vazirmatn', sans-serif;
  overflow: hidden;
}

.bookmarks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
}

.bookmarks-header h3 {
  margin: 0;
  color: var(--accent-2);
  font-size: 18px;
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(0,0,0,.5);
}

.close-bookmarks {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.close-bookmarks:hover {
  background: rgba(76, 195, 138, 0.1);
  transform: scale(1.1);
}

.bookmarks-list {
  max-height: 60vh;
  overflow-y: auto;
  padding: 16px 24px;
}

.bookmark-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.bookmark-item:hover {
  background: linear-gradient(135deg, rgba(76, 195, 138, 0.15), rgba(130, 214, 167, 0.08));
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(76, 195, 138, 0.2);
}

.bookmark-content {
  flex: 1;
}

.bookmark-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
  line-height: 1.3;
}

.bookmark-author {
  font-size: 14px;
  color: var(--ink-dim);
  margin-bottom: 2px;
}

.bookmark-shelf {
  font-size: 12px;
  color: var(--accent);
  opacity: 0.8;
}

.remove-bookmark {
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.3);
  color: #dc3545;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
  line-height: 1;
}

.remove-bookmark:hover {
  background: rgba(220, 53, 69, 0.2);
  border-color: rgba(220, 53, 69, 0.5);
  transform: scale(1.1);
}

.no-bookmarks {
  text-align: center;
  color: var(--ink-dim);
  font-size: 16px;
  padding: 40px 20px;
  opacity: 0.7;
}

@media (max-width: 560px) {
  .bookmarks-modal-content {
    max-width: 95%;
    margin: 20px;
  }
  
  .bookmarks-header {
    padding: 16px 20px;
  }
  
  .bookmarks-header h3 {
    font-size: 16px;
  }
  
  .bookmarks-list {
    padding: 12px 20px;
    max-height: 50vh;
  }
  
  .bookmark-item {
    padding: 10px 12px;
  }
  
  .bookmark-title {
    font-size: 14px;
  }
  
  .bookmark-author {
    font-size: 12px;
  }
  
  .bookmark-shelf {
    font-size: 11px;
  }
}

/* Mobile Header Responsive Styles */
@media (max-width: 560px) {
  .topbar {
    padding: 10px 12px;
  }
  
  .actions {
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .actions::-webkit-scrollbar {
    display: none;
  }
  
  .actions input[type="search"] {
    width: min(30vw, 160px);
    min-width: 100px;
    flex-shrink: 1;
    padding: 8px 10px;
    font-size: 13px;
  }
  
  .client-group {
    gap: 4px;
    flex-shrink: 0;
  }
  
  .client-id {
    min-width: 50px;
    padding: 6px 8px;
    font-size: 11px;
  }
  
  .bookmarks-btn {
    width: 30px;
    height: 30px;
  }
  
  .bookmarks-btn svg {
    width: 12px;
    height: 12px;
  }
  
  .profile-btn {
    width: 30px !important;
    height: 30px !important;
  }
  
  .profile-btn::before {
    width: 14px !important;
    height: 14px !important;
  }
  
  .display-name {
    font-size: 10px;
  }
  
  #adminBtn {
    padding: 4px 8px;
    font-size: 10px;
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* Author Link in Cards */
.author-link[data-author]{
  cursor: pointer; transition: color 0.2s ease;
  position: relative;
  z-index: 10; /* Ensure it's above other elements */
}
.author-link[data-author]:hover{
  color: var(--accent-2); text-decoration: underline;
}

/* Admin Panel */
.admin-dialog{
  max-width: 600px; width: 90vw; max-height: 80vh;
  border: 1px solid rgba(255,255,255,.15); border-radius: 16px;
  background: linear-gradient(145deg, rgba(15,8,4,.95), rgba(25,15,8,.95));
  backdrop-filter: blur(12px); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.admin-dialog::backdrop{
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
}
.admin-content{
  padding: 24px; overflow-y: auto; max-height: 75vh;
}
.admin-step h2{
  margin: 0 0 20px 0; color: var(--accent-2); text-align: center;
  font-size: 20px; font-weight: 700;
}
.admin-step form{
  display: grid; gap: 16px;
}
.admin-step input, .admin-step select, .admin-step textarea{
  width: 100%; padding: 12px 16px; border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px; background: rgba(0,0,0,.3); color: var(--ink);
  font-family: inherit; font-size: 14px;
}
.admin-step input:focus, .admin-step select:focus, .admin-step textarea:focus{
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(212,175,55,.3);
}
.admin-step label{
  display: grid; gap: 6px; font-weight: 600; color: var(--ink);
}
.admin-actions{
  /* Make buttons equal width with a responsive grid */
  display: grid; gap: 12px; margin-bottom: 20px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.admin-actions button{ width: 100%; min-width: 0; min-height: 40px; padding: 10px 14px; font-size: 14px; display:flex; align-items:center; justify-content:center }
#scrollManagementForm{
  background: rgba(0,0,0,.2); padding: 20px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.1); margin-bottom: 20px;
}
#scrollManagementForm h3{
  margin: 0 0 16px 0; color: var(--accent-2); font-size: 16px;
}
.scrolls-list{
  display: grid; gap: 12px; max-height: 300px; overflow-y: auto;
}
.scroll-item{
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: rgba(0,0,0,.3); border-radius: 8px;
  border: 1px solid rgba(255,255,255,.1);
}
.scroll-info{
  flex: 1;
}
.scroll-info .title{
  font-weight: 600; color: var(--accent-2); margin-bottom: 4px;
}
.scroll-info .meta {
  font-size: 0.85rem;
  color: #666;
  margin-top: 4px;
}
.scroll-item .client-info {
  font-size: 0.75rem;
  color: #888;
  margin-top: 2px;
  font-family: 'Courier New', monospace;
  opacity: 0.8;
}
.scroll-actions{
  display: flex; gap: 8px;
}
.scroll-actions button{
  padding: 6px 12px; font-size: 12px; border-radius: 6px;
}
.btn-edit{
  background: rgba(54,162,235,.2); border: 1px solid rgba(54,162,235,.4);
  color: #36a2eb;
}
.btn-delete{
  background: rgba(255,99,132,.2); border: 1px solid rgba(255,99,132,.4);
  color: #ff6384;
}
.btn-edit:hover{ background: rgba(54,162,235,.3); }
.btn-delete:hover{ background: rgba(255,99,132,.3); }

/* Dialog */
dialog{border:none; border-radius:14px; padding:0; background: rgba(30,20,12,.85); color:var(--ink); backdrop-filter: blur(6px); box-shadow: 0 20px 80px rgba(0,0,0,.6)}
dialog::backdrop{background: rgba(0,0,0,.6)}
dialog form{padding:18px 18px 8px; display:grid; gap:12px}
dialog h3{margin:0 0 6px 0}
dialog label{display:grid; gap:6px}
dialog input, dialog textarea{background: rgba(255,255,255,.08); color:var(--ink); border:1px solid rgba(255,255,255,.15); border-radius:10px; padding:10px}
dialog menu{display:flex; justify-content:flex-end; gap:10px; padding:12px; margin:0}
/* Unify dialog menu button sizes */
.admin-dialog menu button{ min-width: 120px; min-height: 40px; padding: 10px 14px; font-size: 14px; display:flex; align-items:center; justify-content:center }

/* Admin Modal Polished Overrides */
.admin-dialog{
  background: linear-gradient(160deg, rgba(5,20,12,.92), rgba(12,26,18,.92));
  border: 1px solid rgba(130,214,167,.25);
  box-shadow: 0 24px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.04) inset;
}
.admin-content{ padding: 26px 22px; }
.admin-step h2{
  color: var(--accent-2);
  letter-spacing: .2px; margin-bottom: 18px;
  text-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.admin-step form{ gap: 14px }
.admin-step input, .admin-step select, .admin-step textarea{
  background: rgba(0,30,20,.25);
  border: 1px solid rgba(130,214,167,.25);
  color: var(--ink);
}
.admin-step input:focus, .admin-step select:focus, .admin-step textarea:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76,195,138,.22);
}
.admin-actions{ margin-bottom: 18px }
#scrollManagementForm{
  background: rgba(0,30,20,.18);
  border: 1px solid rgba(130,214,167,.2);
  box-shadow: 0 10px 30px rgba(0,0,0,.35) inset, 0 8px 28px rgba(0,0,0,.28);
}
#scrollManagementForm h3{ color: var(--accent-2); letter-spacing: .15px }
.scrolls-list{ max-height: 320px }
.scroll-item{
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(130,214,167,.18);
}
.scroll-item:hover{ border-color: rgba(130,214,167,.38); background: rgba(0,30,20,.28) }
.scrolls-list::-webkit-scrollbar{ height: 10px; width: 10px }
.scrolls-list::-webkit-scrollbar-thumb{ background: rgba(130,214,167,.35); border-radius: 999px }
.scrolls-list::-webkit-scrollbar-track{ background: rgba(255,255,255,.04); border-radius: 999px }
.btn-edit{ background: rgba(76,195,138,.18); border-color: rgba(76,195,138,.45); color: var(--accent-2) }
.btn-edit:hover{ background: rgba(76,195,138,.28) }
.btn-delete{ background: rgba(255,99,132,.14); border-color: rgba(255,99,132,.35) }

@media (max-width: 560px){
  .admin-content{ padding: 18px 14px }
  .admin-actions{ gap: 8px }
  #scrollManagementForm{ padding: 16px }
}

/* Responsive */
@media (max-width: 1024px){
  .actions input[type="search"]{width: min(56vw, 520px)}
}

@media (max-width: 820px){
  .topbar{flex-direction: column; align-items: stretch; gap: 12px}
  .brand{justify-content: center}
  .actions{flex-wrap: wrap}
  .actions input[type="search"]{flex:1 1 100%; width: 100%}
  .actions .primary{width: 100%}
  main{padding: 18px 12px 48px}
  .shelf{padding: 18px 14px 30px}
  .shelf-title{font-size: 18px; margin-bottom: 14px}
  .scroll-3d{ --w: 120px; --h: 170px }
  .scroll-label{bottom:-28px; font-size:12px}
  .scroll-label small{font-size:10px}
  .viewer3d{height: clamp(240px, 42vh, 420px)}
}

@media (max-width: 560px){
  body{line-height: 1.5}
  .topbar h1{font-size: 18px}
  .scrolls{gap:14px}
  .scroll-3d{ --w: 108px; --h: 155px }
  .viewer3d{height: clamp(200px, 40vh, 360px)}
  .drawer{inset: 0; width: 100vw}
  .parchment{margin: 4px 10px 18px; padding: 16px}
  .parchment .title{ font-size: 20px; }
  /* Card title size on mobile - allow wrapping for long titles */
  .scroll-label{ 
    font-size: 10px; 
    white-space: normal;
    line-height: 1.2;
    bottom: -40px; /* Fixed position to prevent moving up */
    height: auto;
    min-height: 32px; /* Reserve space for 2-3 lines */
  }
  .scroll-label small{ 
    font-size: 9px;
    white-space: normal;
    line-height: 1.2;
  }
  #adminBtn{ padding: 8px 12px; font-size: 13px }
  .client-id{ padding: 8px 12px; font-size: 13px; line-height: 1 }
  .profile-btn{ width: 34px; height: 34px }
  .display-name{ font-size: 12px }
  /* Smaller admin buttons on small mobile */
  .admin-actions{ grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; place-content: center; justify-items: center }
  .admin-actions button{ min-height: 36px; padding: 8px 12px; font-size: 13px; width: auto; min-width: 140px }
  .admin-dialog menu{ gap: 8px }
  .admin-dialog menu{ justify-content: center }
  .admin-dialog menu button{ min-width: 110px; min-height: 36px; padding: 8px 12px; font-size: 13px }
  /* Center header actions */
  .actions{ justify-content: center }
  
  /* Existing scrolls heading size on mobile */
  #existingScrolls h3 { font-size: 14px; }
  
  /* Smaller view count on mobile */
  .card-view-count{
    font-size: 8px;
    padding: 1px 4px;
    bottom: 2px;
    left: 4px;
  }
  .card-view-count .view-icon{
    width: 10px;
    height: 10px;
  }
  
  /* Drawer view count position on mobile */
  .view-count{
    bottom: 18px;
  }
}

/* Popular Shelf Special Styling - Golden border for shelf only */
.popular-shelf {
  /* Keep only subtle background difference */
  background: rgba(255, 215, 0, 0.05);
  /* Add golden border to shelf */
  border: 2px solid rgba(255, 215, 0, 0.6);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(255, 140, 0, 0.2);
  /* Keep basic styling */
  position: relative;
  overflow: hidden;
  margin: 25px 0;
  padding: 15px;
}

/* Center cards in popular shelf on desktop */
.popular-shelf .scrolls {
  justify-content: center;
}

/* On mobile, align popular shelf cards to start (left) to avoid clipping */
@media (max-width: 560px) {
  .popular-shelf .scrolls {
    justify-content: flex-start;
  }
}

.popular-shelf::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 215, 0, 0.3), 
    rgba(255, 255, 255, 0.4),
    rgba(255, 215, 0, 0.3),
    transparent
  );
  animation: shimmer 4s infinite;
  pointer-events: none;
  z-index: 1;
}

.popular-shelf::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent,
    rgba(255, 215, 0, 0.1),
    transparent,
    rgba(255, 140, 0, 0.08),
    transparent
  );
  animation: rotate 8s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.popular-shelf .shelf-title {
  background: linear-gradient(135deg, 
    #FFD700 0%, 
    #FFA500 25%,
    #FF8C00 50%,
    #FFD700 75%,
    #FFFF00 100%
  );
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 28px;
  font-weight: 900;
  text-shadow: 
    0 3px 6px rgba(255, 140, 0, 0.4),
    0 0 30px rgba(255, 215, 0, 0.3),
    0 0 60px rgba(255, 140, 0, 0.2);
  letter-spacing: 1px;
  animation: 
    glow 2s ease-in-out infinite alternate,
    gradientShift 3s ease-in-out infinite;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.6));
}

@keyframes glow {
  from {
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
  }
  to {
    filter: drop-shadow(0 0 20px rgba(255, 140, 0, 0.9));
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Remove all special sizing for popular shelf cards - keep them normal */

/* Keep scroll-canvas normal - add matte golden background */
.popular-shelf .scroll-canvas {
  background: linear-gradient(135deg, 
    rgba(184, 134, 11, 0.15), 
    rgba(161, 98, 7, 0.08),
    rgba(133, 77, 14, 0.05)
  );
  border: 2px solid rgba(184, 134, 11, 0.4);
  box-shadow: 
    0 4px 12px rgba(161, 98, 7, 0.2),
    0 2px 6px rgba(184, 134, 11, 0.15);
}

.popular-shelf .scroll-canvas:hover {
  border-color: rgba(255, 215, 0, 0.6);
  box-shadow: 
    0 6px 18px rgba(255, 140, 0, 0.3),
    0 3px 9px rgba(255, 215, 0, 0.2);
}

.popular-shelf .scroll-label {
  color: #FFD700; /* Golden color for scroll titles */
  font-weight: 700;
  text-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.5),
    0 0 10px rgba(255, 215, 0, 0.3);
}

.popular-shelf .author-link {
  color: #FFD700 !important; /* Golden color for author names */
  text-shadow: 
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 0 8px rgba(255, 215, 0, 0.4);
}

.popular-shelf .scroll-nav {
  background: linear-gradient(135deg, 
    rgba(255, 215, 0, 0.3), 
    rgba(255, 140, 0, 0.2)
  );
  border-color: rgba(255, 215, 0, 0.5);
  color: #FF8C00;
  box-shadow: 0 4px 12px rgba(255, 140, 0, 0.2);
}

.popular-shelf .scroll-nav:hover {
  background: linear-gradient(135deg, 
    rgba(255, 215, 0, 0.5), 
    rgba(255, 140, 0, 0.3)
  );
  border-color: rgba(255, 215, 0, 0.7);
  box-shadow: 0 6px 18px rgba(255, 140, 0, 0.3);
}

/* Mobile responsive for popular shelf */
@media (max-width: 560px) {
  .popular-shelf .shelf-title {
    font-size: 20px;
  }
  
  .popular-shelf .scroll-3d {
    transform: scale(1.02);
  }
  
  .popular-shelf .scroll-3d:hover {
    transform: translateY(-8px) scale(1.05);
  }
}

/* Show all scrolls button - positioned next to shelf title */
.show-all-btn {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.25), 
    rgba(255, 255, 255, 0.1)
  ), linear-gradient(135deg, 
    rgba(76, 195, 138, 0.3), 
    rgba(130, 214, 167, 0.2)
  );
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 6px 12px;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(10px) saturate(150%);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.show-all-btn:hover {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.35), 
    rgba(255, 255, 255, 0.15)
  ), linear-gradient(135deg, 
    rgba(76, 195, 138, 0.4), 
    rgba(130, 214, 167, 0.3)
  );
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 
    0 4px 12px rgba(76, 195, 138, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.show-all-btn:active {
  transform: translateY(0);
  box-shadow: 
    0 2px 6px rgba(76, 195, 138, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Mobile responsive for show all button and shelf header */
@media (max-width: 560px) {
  .show-all-btn {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 50px;
  }
  
  .shelf-header {
    gap: 12px;
  }
  
  .shelf-title {
    font-size: 18px; /* Slightly smaller on mobile */
  }
  
  /* Expanded shelf on mobile - adjust gap and layout */
  .shelf.expanded .scrolls{
    gap: 40px 12px; /* Vertical gap 40px, horizontal gap 12px */
    justify-content: center;
    padding-bottom: 50px; /* Adequate space for labels on mobile */
  }
}

@media (max-width: 400px){
  .scroll-3d{ --w: 96px; --h: 140px }
  /* Extra small buttons on very small screens */
  #adminBtn{ padding: 7px 10px; font-size: 12.5px }
  .client-id{ padding: 7px 10px; font-size: 12.5px; line-height: 1 }
  .profile-btn{ width: 32px; height: 32px }
  .display-name{ font-size: 11.5px }
  .admin-actions{ grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; place-content: center; justify-items: center }
  .admin-actions button{ min-height: 32px; padding: 6px 10px; font-size: 12.5px; width: auto; min-width: 120px }
  .admin-dialog menu{ gap: 6px }
  .admin-dialog menu{ justify-content: center }
  .admin-dialog menu button{ min-width: 100px; min-height: 32px; padding: 6px 10px; font-size: 12.5px }
  .actions{ justify-content: center }
  .actions .primary{padding: 10px 12px}
  .brand-mark{font-size: 22px}
}

/* Custom Notification System */
.notification-container {
  position: fixed !important;
  top: 20px !important;
  right: 20px !important;
  z-index: 2147483647 !important;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  isolation: isolate;
}

.notification {
  min-width: 300px;
  max-width: 400px;
  padding: 16px 20px;
  border-radius: 12px;
  font-family: 'Vazirmatn', system-ui;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  pointer-events: auto;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

.notification.success {
  background: linear-gradient(135deg, 
    rgba(76, 195, 138, 0.9), 
    rgba(130, 214, 167, 0.8)
  );
  color: #ffffff;
  border-color: rgba(76, 195, 138, 0.4);
}

.notification.error {
  background: linear-gradient(135deg, 
    rgba(220, 53, 69, 0.9), 
    rgba(255, 99, 132, 0.8)
  );
  color: #ffffff;
  border-color: rgba(220, 53, 69, 0.4);
}

.notification.info {
  background: linear-gradient(135deg, 
    rgba(54, 162, 235, 0.9), 
    rgba(99, 179, 237, 0.8)
  );
  color: #ffffff;
  border-color: rgba(54, 162, 235, 0.4);
}

.notification-icon {
  display: inline-block;
  margin-left: 8px;
  font-size: 16px;
}

.notification-close {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  transition: all 0.2s ease;
}

.notification-close:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

/* Mobile responsive notifications */
@media (max-width: 560px) {
  .notification-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }
  
  .notification {
    min-width: auto;
    max-width: none;
    width: 100%;
    padding: 14px 16px;
    font-size: 13px;
  }
  
  .notification-close {
    width: 20px;
    height: 20px;
    font-size: 12px;
  }
}
