/* =======================
   پایه‌ها و گرید و فرم
   ======================= */

/* جلوگیری از اسکرول افقی در ویجت */
.tour-gallery-wrap,
.tour-gallery-wrap .tour-gallery-grid { overflow-x: hidden !important; }

/* فرم آپلود */
.tour-gallery-wrap .tour-upload-form {
  display:flex !important; flex-wrap:wrap !important; gap:10px !important; align-items:center !important;
  margin-bottom:14px !important; max-width:100% !important; box-sizing:border-box !important;
  width:100% !important; min-width:0 !important;
}
.tour-gallery-wrap .tour-file-input {
  position:absolute !important; opacity:0 !important; width:1px !important; height:1px !important;
  overflow:hidden !important; clip-path: inset(50%) !important; white-space:nowrap !important;
}
.tour-gallery-wrap .tour-file-trigger {
  padding:10px 14px !important; border:1px solid #d0d7de !important; background:#f6f8fa !important;
  border-radius:8px !important; cursor:pointer !important; font-weight:600 !important;
  transition:all .2s !important; white-space:nowrap !important; max-width:100% !important;
}
.tour-gallery-wrap .tour-file-trigger:hover { background:#eef2f6 !important; }
.tour-gallery-wrap .tour-file-info {
  font-size:13px !important; color:#555 !important; flex:1 1 200px !important; min-width:0 !important; max-width:100% !important;
  overflow:hidden !important; text-overflow:ellipsis !important; white-space:nowrap !important;
}
.tour-gallery-wrap .tour-upload-btn {
  padding:10px 16px !important; border:0 !important; background:#2271b1 !important; color:#fff !important;
  cursor:pointer !important; border-radius:10px !important; font-weight:700 !important; white-space:nowrap !important;
  max-width:100% !important; letter-spacing:.2px !important; transition:transform .15s ease, box-shadow .2s ease, opacity .2s ease !important;
  box-shadow: 0 2px 10px rgba(34,113,177,.15) !important;
}
.tour-gallery-wrap .tour-upload-btn:hover { transform: translateY(-1px) !important; box-shadow: 0 6px 18px rgba(34,113,177,.25) !important; }
.tour-gallery-wrap .tour-upload-btn:active { transform: translateY(0) !important; }
.tour-gallery-wrap .tour-upload-btn:disabled { opacity:.6 !important; cursor:not-allowed !important; }

.tour-gallery-wrap .tour-progress {
  position:relative !important; height:10px !important; background:linear-gradient(0deg,#ececec,#f5f5f5) !important;
  border-radius:999px !important; overflow:hidden !important; display:none !important; flex:1 1 220px !important; min-width:160px !important; max-width:100% !important;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06) !important;
}
.tour-gallery-wrap .tour-progress-bar { position:absolute !important; left:0 !important; top:0 !important; bottom:0 !important; width:0% !important; background:#2ea043 !important; transition:width .2s ease !important; }
.tour-gallery-wrap .tour-progress-text { font-size:12px !important; color:#333 !important; min-width:34px !important; display:none !important; }
.tour-gallery-wrap .tour-upload-msg { font-size:13px !important; color:#333 !important; flex-basis:100% !important; }

/* گالری */
.tour-gallery-wrap .tour-gallery-grid {
  display:grid !important; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)) !important;
  gap:12px !important; max-width:100% !important; box-sizing:border-box !important; width:100% !important;
}
.tour-gallery-wrap .tour-gallery-grid .gallery-item { margin:0 !important; }
.tour-gallery-wrap .tour-gallery-grid img {
  width:100% !important; max-width:100% !important; height:auto !important; display:block !important; border-radius:12px !important;
  box-shadow: 0 2px 12px rgba(0,0,0,.06) !important;
  transition: transform .2s ease, box-shadow .2s ease !important;
}
.tour-gallery-wrap .tour-gallery-grid a.tour-lightbox:hover img {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 20px rgba(0,0,0,.12) !important;
}

/* خط جداکننده‌ی فرم از گالری */
form.tour-upload-form {
  border-bottom: 1px solid #eee !important;
  padding-bottom: 20px !important;
  margin-bottom: 20px !important;
}

/* =======================
   لایت‌باکس و محتوای داخل
   ======================= */

/* قبلی: display:none !important;  --- مشکل‌زا */
.tour-lightbox-modal {
  position:fixed !important; inset:0 !important; padding:20px !important;
  box-sizing:border-box !important; background:rgba(10,14,20,.86) !important;
  display:none; /* بدون !important */
  align-items:center !important; justify-content:center !important; z-index:9999 !important;
  overflow:auto !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
}

/* وقتی باز است */
.tour-lightbox-modal.is-open {
  display:flex !important;
}

.tour-lightbox-content {
  position:relative !important; max-width:90vw !important; max-height:86vh !important; text-align:center !important;
  margin:auto !important; box-sizing:border-box !important;
}
.tour-lightbox-title {
  color:#fff !important; font-size:18px !important; margin-bottom:10px !important; font-weight:600 !important;
  overflow:hidden !important; text-overflow:ellipsis !important; white-space:nowrap !important;
  max-width:90vw !important; opacity:.95 !important;
}
.tour-lightbox-img {
  display:block !important; margin:0 auto 14px !important; border-radius:12px !important;
  max-width:90vw !important; max-height:70vh !important; width:auto !important; height:auto !important;
  box-shadow: 0 10px 40px rgba(0,0,0,.35) !important;
}

/* اکشن‌ها */
.tour-lightbox-actions { display:flex !important; gap:10px !important; justify-content:center !important; flex-wrap:wrap !important; }

/* دکمه‌ی پایه */
.tour-btn {
  --tg-btn-bg: rgba(255,255,255,.08);
  --tg-btn-bd: rgba(255,255,255,.25);
  --tg-btn-fg: #fff;

  padding:10px 14px !important; border-radius:12px !important; font-weight:700 !important;
  border:1px solid var(--tg-btn-bd) !important; background: var(--tg-btn-bg) !important;
  color: var(--tg-btn-fg) !important; text-decoration:none !important; cursor:pointer !important;
  max-width:100% !important;
  display:inline-flex !important; align-items:center !important; gap:8px !important;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease, opacity .2s ease, border-color .2s ease !important;
  box-shadow: 0 2px 12px rgba(0,0,0,.15) !important;
}
.tour-btn:hover { background: rgba(255,255,255,.16) !important; transform: translateY(-1px) !important; box-shadow: 0 8px 26px rgba(0,0,0,.25) !important; }
.tour-btn:active { transform: translateY(0) !important; }
.tour-btn:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,.55), 0 8px 26px rgba(0,0,0,.25) !important;
}

/* دکمه دانلود = پرایمری */
.tour-download {
  --tg-btn-bg: linear-gradient(135deg,#3b82f6 0%, #2563eb 100%);
  --tg-btn-bd: transparent;
  --tg-btn-fg: #fff;
  border: none !important;
  background: linear-gradient(135deg,#3b82f6 0%, #2563eb 100%) !important;
  color:#fff !important;
}
.tour-download:hover { filter: brightness(1.06) !important; }
.tour-download::before {
  content: "";
  width: 18px !important;
  height: 18px !important;
  display: inline-block !important;
  mask: url("data:image/svg+xml;utf8,<svg width='20' height='20' viewBox='0 0 0.375 0.375' fill='none' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M.188.026a.01.01 0 0 1 .011.011V.21L.255.154A.011.011 0 1 1 .271.17L.196.245a.01.01 0 0 1-.016 0L.105.17A.011.011 0 1 1 .121.154L.176.21V.038A.01.01 0 0 1 .187.027M.063.25a.013.013 0 0 1 .013.013V.3c0 .014.011.025.025.025h.175A.025.025 0 0 0 .3.3V.262a.013.013 0 0 1 .025 0V.3a.05.05 0 0 1-.05.05H.1A.05.05 0 0 1 .05.3V.262A.013.013 0 0 1 .063.249' fill='%23fff'/></svg>") no-repeat center / contain !important;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg width='20' height='20' viewBox='0 0 0.375 0.375' fill='none' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M.188.026a.01.01 0 0 1 .011.011V.21L.255.154A.011.011 0 1 1 .271.17L.196.245a.01.01 0 0 1-.016 0L.105.17A.011.011 0 1 1 .121.154L.176.21V.038A.01.01 0 0 1 .187.027M.063.25a.013.013 0 0 1 .013.013V.3c0 .014.011.025.025.025h.175A.025.025 0 0 0 .3.3V.262a.013.013 0 0 1 .025 0V.3a.05.05 0 0 1-.05.05H.1A.05.05 0 0 1 .05.3V.262A.013.013 0 0 1 .063.249' fill='%23fff'/></svg>") no-repeat center / contain !important;
  background: currentColor !important;
}


/* دکمه بستن */
.tour-btn-close {
  position:absolute !important; right:-12px !important; top:-12px !important;
  width:42px !important; height:42px !important; border-radius:999px !important;
  padding:0 !important; display:grid !important; place-items:center !important;
  background: rgba(15,17,22,.6) !important; border:1px solid rgba(255,255,255,.25) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,.25) !important;
}
.tour-btn-close::before {
  content: "" !important;
  width: 16px !important; height:16px !important; display:block !important;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 24 24'><path d='M18.3 5.71L12 12.01 5.7 5.7 4.29 7.11l6.3 6.3-6.29 6.29 1.41 1.41L12 14.83l6.29 6.29 1.41-1.41-6.29-6.29 6.3-6.3z'/></svg>") no-repeat center / contain !important;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 24 24'><path d='M18.3 5.71L12 12.01 5.7 5.7 4.29 7.11l6.3 6.3-6.29 6.29 1.41 1.41L12 14.83l6.29 6.29 1.41-1.41-6.29-6.29 6.3-6.3z'/></svg>") no-repeat center / contain !important;
  background: #fff !important;
}
.tour-btn-close:hover { background: rgba(15,17,22,.78) !important; }

/* =======================
   ناوبری (فلش‌های اسلایدر)
   ======================= */
.tour-btn-nav {
  position: absolute !important; top: 50% !important; transform: translateY(-50%) !important;
  width: 48px !important; height: 48px !important; display: grid !important; place-items: center !important;
  padding: 0 !important; font-size: 22px !important; line-height: 1 !important; user-select: none !important;
  border-radius: 999px !important; color: #fff !important;
  background: rgba(15,17,22,.55) !important; border: 1px solid rgba(255,255,255,.25) !important;
  box-shadow: 0 6px 26px rgba(0,0,0,.35) !important;
  backdrop-filter: blur(3px) !important; -webkit-backdrop-filter: blur(3px) !important;
}
.tour-btn-nav:hover { background: rgba(15,17,22,.75) !important; transform: translateY(-50%) scale(1.04) !important; }
.tour-btn-prev { left: -56px !important; }
.tour-btn-next { right: -56px !important; }

@media (max-width: 1024px) {
  .tour-btn-prev { left: -24px !important; }
  .tour-btn-next { right: -24px !important; }
}
@media (max-width: 768px) {
  .tour-btn-prev { left: -10px !important; }
  .tour-btn-next { right: -10px !important; }
  .tour-btn-nav { width:44px !important; height:44px !important; }
}

/* حالت فوکِس برای دسترسی‌پذیری */
.tour-btn-nav:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(250,204,21,.65), 0 6px 26px rgba(0,0,0,.35) !important;
}

/* =======================
   ریسپانسیو و ترجیحات کاربر
   ======================= */
@media (max-width: 640px){
  .tour-gallery-wrap .tour-progress { flex:1 1 100% !important; min-width:0 !important; }
  .tour-gallery-wrap .tour-progress-text { flex:0 0 auto !important; }
  .tour-lightbox-img { max-height:62vh !important; }
  .tour-lightbox-title { white-space:normal !important; font-size:16px !important; }
}

/* احترام به کاربرانی که انیمیشن نمی‌خواهند */
@media (prefers-reduced-motion: reduce) {
  .tour-btn, .tour-gallery-wrap .tour-upload-btn,
  .tour-gallery-wrap .tour-gallery-grid img,
  .tour-btn-nav, .tour-lightbox-modal, .tour-lightbox-content,
  .tour-gallery-wrap .tour-progress-bar {
    transition: none !important;
    animation: none !important;
  }
}
