@font-face {
  font-family: "Pelak";
  src: url("./fonts/PelakFA-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Pelak";
  src: url("./fonts/PelakFA-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Pelak";
  src: url("./fonts/PelakFA-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Pelak";
  src: url("./fonts/PelakFA-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Pelak";
  src: url("./fonts/PelakFA-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Lilij";
  src: url("./fonts/lilj.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #d9d9d9;
  --card: #ffffff;
  --ink: #111111;
  --muted: #6e6e6e;
  --border: #101010;
  --shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Pelak", "Tahoma", "Arial", sans-serif;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  text-align: right;
}

/* ════════════════════════════
   Splash Screen
════════════════════════════ */
.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #1c1666;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* دایره‌های پس‌زمینه */
.splash-bg-circles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.splash-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}

.splash-circle-1 {
  width: 420px; height: 420px;
  top: -140px; right: -120px;
  animation: floatCircle 7s ease-in-out infinite;
}

.splash-circle-2 {
  width: 300px; height: 300px;
  bottom: -80px; left: -90px;
  background: rgba(255,255,255,0.05);
  animation: floatCircle 9s ease-in-out infinite reverse;
}

.splash-circle-3 {
  width: 180px; height: 180px;
  top: 40%; left: 60%;
  background: rgba(255,255,255,0.03);
  animation: floatCircle 11s ease-in-out infinite;
}

@keyframes floatCircle {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%       { transform: translate(12px, -18px) scale(1.04); }
}

/* محتوای مرکزی */
.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  z-index: 1;
}

.splash-logo-wrap {
  width: 100px;
  height: 100px;
  background: rgba(255,255,255,0.1);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  animation: logoIn 0.7s cubic-bezier(0.34,1.56,0.64,1) both;
}

.splash-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

@keyframes logoIn {
  from { opacity: 0; transform: scale(0.6) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.splash-title {
  margin: 0 0 6px;
  font-family: "Lilij", "Pelak", sans-serif;
  font-size: 42px;
  font-weight: 400;
  color: #fff;
  letter-spacing: 1px;
  animation: fadeUp 0.6s 0.2s ease both;
}

.splash-subtitle {
  margin: 0 0 40px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  letter-spacing: 2px;
  text-transform: uppercase;
  animation: fadeUp 0.6s 0.35s ease both;
}

/* وضعیت‌ها */
.splash-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: fadeUp 0.5s 0.5s ease both;
  min-height: 80px;
}

.splash-status.hidden { display: none; }

/* نقاط لودینگ */
.splash-dots {
  display: flex;
  gap: 8px;
}

.splash-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  animation: dotPulse 1.2s ease-in-out infinite;
}

.splash-dots span:nth-child(2) { animation-delay: 0.2s; }
.splash-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1.1); opacity: 1; }
}

.splash-status-text {
  margin: 0;
  font-size: 13px;
  color: rgba(255,255,255,0.45);
  font-weight: 500;
}

/* حالت آفلاین */
.splash-wifi-icon {
  width: 52px;
  height: 52px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 4px;
  animation: wiggle 0.5s ease;
}

.splash-wifi-icon svg { width: 100%; height: 100%; }

@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25%       { transform: rotate(-8deg); }
  75%       { transform: rotate(8deg); }
}

.splash-offline-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.splash-offline-desc {
  margin: 0 0 20px;
  font-size: 13px;
  color: rgba(255,255,255,0.45);
}

.splash-retry-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.2);
  color: #fff;
  font-family: "Pelak", "Tahoma", sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  backdrop-filter: blur(8px);
}

.splash-retry-btn:hover   { background: rgba(255,255,255,0.2); }
.splash-retry-btn:active  { transform: scale(0.96); }
.splash-retry-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* تگ‌لاین پایین */
.splash-tagline {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.2);
  letter-spacing: 2px;
  white-space: nowrap;
  z-index: 1;
  animation: fadeUp 0.6s 0.6s ease both;
}

/* انیمیشن خروج splash */
.splash-hide {
  animation: splashOut 0.65s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes splashOut {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.06); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page {
  max-width: 480px;
  width: min(92vw, 480px);
  margin: 0 auto;
  padding: clamp(16px, 4vw, 24px) clamp(12px, 4vw, 18px) clamp(32px, 7vw, 48px);
}

body.modal-open .page {
  display: none;
}

.hero {
  background: var(--card);
  border-radius: clamp(20px, 6vw, 28px);
  padding: clamp(18px, 4vw, 26px) clamp(16px, 4vw, 22px);
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
  margin-bottom: clamp(12px, 3vw, 18px);
  text-align: right;
}

.hero-text {
  text-align: left;
  direction: ltr;
}

.hero-text h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 6vw, 36px);
  font-weight: 400;
  letter-spacing: 0.5px;
  color: #1c1666;
  font-family: "Lilij", "Pelak", sans-serif;
}

.hero-subtitle {
  margin: 0 0 10px;
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 600;
  color: #1c1666;
}

.hero-tagline {
  margin: 0;
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 600;
}

.hero-logo {
  width: clamp(96px, 22vw, 140px);
  height: clamp(96px, 22vw, 140px);
  object-fit: contain;
}

.search-wrap {
  margin-bottom: clamp(12px, 3vw, 18px);
}

.search {
  position: relative;
  background: var(--card);
  border-radius: clamp(18px, 5vw, 24px);
  box-shadow: var(--shadow);
  padding: clamp(10px, 3vw, 12px) clamp(14px, 3.5vw, 18px);
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  text-align: right;
}

.search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: clamp(13px, 3.5vw, 16px);
  background: transparent;
  padding-left: 8px;
  text-align: right;
  font-family: "Pelak", "Tahoma", "Arial", sans-serif;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 3vw, 14px);
}

.category-card {
  background: var(--card);
  border-radius: clamp(16px, 5vw, 22px);
  border: 2px solid var(--border);
  padding: clamp(10px, 2.5vw, 12px) clamp(8px, 2.5vw, 10px) clamp(12px, 3vw, 14px);
  text-align: right;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: clamp(90px, 22vw, 110px);
  cursor: pointer;
  transition: transform 0.15s ease;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
  -webkit-text-fill-color: var(--ink);
  text-decoration: none;
}

.category-card:hover {
  transform: translateY(-2px);
}

.category-card img {
  width: clamp(40px, 12vw, 54px);
  height: clamp(40px, 12vw, 54px);
  object-fit: contain;
  margin-bottom: clamp(6px, 2vw, 8px);
}

.category-card span {
  font-size: clamp(12px, 3vw, 14px);
  font-weight: 600;
  font-family: "Pelak", "Tahoma", "Arial", sans-serif;
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
}

.shimmer {
  position: relative;
  overflow: hidden;
  background: #efefef;
}

.shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.category-card.shimmer {
  border: 2px solid transparent;
}

.category-card.shimmer .shimmer-icon {
  width: clamp(40px, 12vw, 54px);
  height: clamp(40px, 12vw, 54px);
  border-radius: 14px;
  background: #e3e3e3;
  margin-bottom: clamp(6px, 2vw, 8px);
}

.category-card.shimmer .shimmer-text {
  width: 70%;
  height: 12px;
  border-radius: 8px;
  background: #e3e3e3;
}

.modal {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(12px, 3vw, 18px);
  overflow-y: auto;
  z-index: 10;
}

.modal.hidden {
  display: none;
}

.modal.search-mode .modal-panel {
  pointer-events: auto;
  margin-top: 0;
}

.modal.search-mode .modal-header {
  display: none;
}

.modal-search {
  background: var(--card);
  border-radius: clamp(18px, 5vw, 24px);
  box-shadow: var(--shadow);
  padding: clamp(10px, 3vw, 12px) clamp(14px, 3.5vw, 18px);
  display: none;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(12px, 3vw, 16px);
}

.modal.search-mode .modal-search {
  display: flex;
}

.modal-search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: clamp(13px, 3.5vw, 16px);
  background: transparent;
  text-align: right;
  font-family: "Pelak", "Tahoma", "Arial", sans-serif;
}


.modal-panel {
  width: min(520px, 100%);
  margin-top: clamp(18px, 5vw, 28px);
}

.modal-header {
  background: var(--card);
  border-radius: clamp(16px, 5vw, 22px);
  box-shadow: var(--shadow);
  padding: clamp(12px, 3vw, 14px) clamp(14px, 3.5vw, 18px);
  display: flex;
  align-items: center;
  flex-direction: row-reverse;
  justify-content: space-between;
  margin-bottom: clamp(12px, 3vw, 16px);
  text-align: right;
}

.modal-header h2 {
  margin: 0;
  font-size: clamp(16px, 4vw, 22px);
  font-weight: 700;
  text-align: center;
  width: 100%;
}

.close-btn {
  width: clamp(32px, 8vw, 38px);
  height: clamp(32px, 8vw, 38px);
  border-radius: 50%;
  background: #111;
  color: #fff;
  border: none;
  font-size: clamp(18px, 5vw, 24px);
  line-height: 1;
  cursor: pointer;
}

.product-list {
  display: grid;
  gap: clamp(12px, 3vw, 16px);
}

.product-card {
  background: var(--card);
  border-radius: clamp(18px, 5vw, 26px);
  box-shadow: var(--shadow);
  padding: clamp(12px, 3vw, 16px);
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: clamp(12px, 3vw, 16px);
  text-align: right;
}

.product-info {
  flex: 1;
}

.product-info h3 {
  margin: 0 0 8px;
  font-size: clamp(16px, 4.5vw, 20px);
  font-weight: 700;
}

.product-price {
  margin: 0 0 6px;
  font-size: clamp(14px, 4vw, 18px);
  font-weight: 700;
}

.product-desc {
  margin: 0;
  font-size: clamp(12px, 3.5vw, 14px);
  color: var(--muted);
}

.product-image {
  width: clamp(86px, 24vw, 120px);
  height: clamp(86px, 24vw, 120px);
  border-radius: clamp(14px, 4vw, 18px);
  object-fit: cover;
}

.product-card.shimmer {
  min-height: clamp(110px, 26vw, 130px);
}

.product-card.shimmer .shimmer-title {
  width: 55%;
  height: 14px;
  border-radius: 8px;
  background: #e3e3e3;
  margin-bottom: 10px;
}

.product-card.shimmer .shimmer-line {
  width: 40%;
  height: 12px;
  border-radius: 8px;
  background: #e3e3e3;
  margin-bottom: 8px;
}

.product-card.shimmer .shimmer-line:last-child {
  width: 70%;
  margin-bottom: 0;
}

.product-card.shimmer .shimmer-photo {
  width: clamp(86px, 24vw, 120px);
  height: clamp(86px, 24vw, 120px);
  border-radius: clamp(14px, 4vw, 18px);
  background: #e3e3e3;
}

.footer {
  margin-top: clamp(18px, 6vw, 28px);
  padding: clamp(12px, 4vw, 18px);
  background: var(--card);
  border-radius: clamp(18px, 5vw, 24px);
  box-shadow: var(--shadow);
  display: grid;
  gap: clamp(8px, 3vw, 12px);
  text-align: right;
}

.footer-item {
  display: flex;
  align-items: center;
  gap: clamp(8px, 3vw, 12px);
  font-size: clamp(12px, 3.5vw, 14px);
  font-weight: 600;
  font-family: "Pelak", "Tahoma", "Arial", sans-serif;
}

.footer-item img {
  width: clamp(14px, 4.2vw, 18px);
  height: clamp(14px, 4.2vw, 18px);
  object-fit: contain;
  filter: brightness(0) saturate(100%);
}

.footer-credit {
  margin-top: clamp(4px, 2vw, 8px);
  font-size: clamp(11px, 3vw, 13px);
  color: var(--muted);
  text-align: center;
  font-family: "Pelak", "Tahoma", "Arial", sans-serif;
}

/* ───── Unavailable badge on product card ───── */
.product-card.product-unavailable {
  opacity: 0.6;
  position: relative;
}

/* خط قرمز مورب روی عکس */
.product-card.product-unavailable .product-image {
  filter: grayscale(60%);
  position: relative;
}

.product-card.product-unavailable::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid rgba(255, 59, 59, 0.25);
  pointer-events: none;
  border-radius: clamp(18px,5vw,24px);
}

.unavailable-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 5px 12px;
  background: #ff3b3b;
  color: #fff;
  border-radius: 20px;
  font-size: clamp(11px, 3vw, 13px);
  font-weight: 700;
  font-family: "Pelak", "Tahoma", "Arial", sans-serif;
}

.unavailable-badge::before {
  content: "✕";
  font-size: 11px;
  font-weight: 900;
}

/* ───── Product detail overlay ───── */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
  padding: 0;
}

.detail-overlay.hidden {
  display: none;
}

.detail-panel {
  background: var(--card);
  border-radius: clamp(22px, 6vw, 32px) clamp(22px, 6vw, 32px) 0 0;
  width: min(520px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: clamp(16px, 4vw, 24px);
  position: relative;
  text-align: right;
  direction: rtl;
}

.detail-close {
  position: absolute;
  top: clamp(12px, 3vw, 16px);
  left: clamp(12px, 3vw, 16px);
}

.detail-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: clamp(14px, 4vw, 20px);
  margin-bottom: clamp(14px, 4vw, 20px);
  display: block;
}

.detail-body {
  padding: 0 clamp(4px, 2vw, 8px);
}

.detail-name {
  margin: 0 0 10px;
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 700;
}

.detail-price {
  margin: 0 0 10px;
  font-size: clamp(15px, 4.5vw, 20px);
  font-weight: 700;
  color: #1c1666;
}

.detail-unavailable-msg {
  margin: 0 0 10px;
  padding: 8px 14px;
  background: #fff0f0;
  border: 1.5px solid #ff3b3b;
  border-radius: 12px;
  color: #ff3b3b;
  font-size: clamp(13px, 3.5vw, 15px);
  font-weight: 600;
  font-family: "Pelak", "Tahoma", "Arial", sans-serif;
}

.detail-desc {
  margin: 0;
  font-size: clamp(13px, 3.5vw, 15px);
  color: var(--muted);
  line-height: 1.7;
}
