@import url("https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css");

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  background: var(--page-bg);
  color: var(--ink-900);
  direction: rtl;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: inherit; }

#app { min-height: 100vh; }

/* ==========================================================================
   قالب مشترک صفحات احراز هویت (Login / VerifyOtp / SelectCity)
   ========================================================================== */
.auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--page-bg);
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 32px 28px; text-align: center;
  box-shadow: var(--shadow-md);
}
.auth-logo {
  width: 52px; height: 52px; border-radius: 14px; background: var(--brand-green-600);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
}
.auth-card h1 { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.auth-card p { font-size: 12.5px; color: var(--ink-500); margin-bottom: 24px; line-height: 1.8; }

.field-group { text-align: right; margin-bottom: 14px; }
.field-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field-input {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 14px; font-size: 14px; color: var(--ink-900); background: var(--surface);
  text-align: center; letter-spacing: 1px;
}
.field-input:focus { outline: none; border-color: var(--brand-green-500); }
.field-input.ltr { direction: ltr; text-align: center; letter-spacing: 3px; font-size: 18px; font-weight: 700; }

.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; background: var(--brand-green-600); color: #fff; border: none;
  border-radius: 10px; padding: 12px 18px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.btn-primary:hover { background: var(--brand-green-500); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; background: transparent; color: var(--ink-500); border: none;
  padding: 10px; font-size: 13px; cursor: pointer; margin-top: 8px;
}
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }

.auth-error {
  background: #fdeceb; color: #9a2f26; border-radius: 10px;
  padding: 10px 12px; font-size: 12.5px; margin-bottom: 14px;
}
.auth-hint {
  background: var(--brand-green-50); color: var(--brand-green-700); border-radius: 10px;
  padding: 10px 12px; font-size: 12px; margin-bottom: 14px; direction: ltr;
}

/* ==========================================================================
   هدر صفحات داخلی (نمایندگی‌ها / کالاهای نمایندگی)
   ========================================================================== */
.app-shell { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--surface); }

.app-header {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
}
.app-header h1 { font-size: 16px; font-weight: 800; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: none;
  background: var(--page-bg); color: var(--ink-700); cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.city-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand-green-50); color: var(--brand-green-700);
  border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600;
  margin: 12px 16px 0;
}

/* ---- لیست نمایندگی‌ها / لیست شهرها ---- */
.simple-list { padding: 12px 16px 90px; }
.simple-list-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-sm);
}
.simple-list-item {
  display: flex; align-items: center; gap: 12px; padding: 16px 14px;
  text-decoration: none; color: inherit; border-bottom: 1px solid var(--border);
  cursor: pointer; background: none; width: 100%; border-inline: none; border-top: none;
  font-family: inherit; text-align: right;
}
.simple-list-item:last-child { border-bottom: none; }
.simple-list-item:hover, .simple-list-item:active { background: var(--brand-green-50); }
.simple-list-icon {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand-green-100); color: var(--brand-green-700);
  display: flex; align-items: center; justify-content: center;
}
.simple-list-texts { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.simple-list-texts .name { font-weight: 700; font-size: 14.5px; }
.simple-list-texts .loc { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.simple-list-chevron { color: var(--ink-300); flex-shrink: 0; }

.empty-state { text-align: center; color: var(--ink-500); font-size: 13px; padding: 40px 16px; }

/* ---- لیست کالاهای یک نمایندگی ---- */
.updated-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px; font-size: 12px; color: var(--ink-500);
  background: var(--brand-green-50); border-bottom: 1px solid var(--brand-green-100);
}
.product-list { padding: 6px 16px 90px; }
.product-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.product-row .p-icon {
  width: 46px; height: 46px; border-radius: 12px; background: var(--brand-green-50);
  display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.product-row .p-body { flex: 1; min-width: 0; }
.product-row .p-status { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: var(--status-available-fg); margin-bottom: 3px; }
.product-row .p-status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--status-available-dot); }
.product-row .p-status.half { color: var(--status-half-fg); }
.product-row .p-status.half .dot { background: var(--status-half-dot); }
.product-row .p-name { font-weight: 700; font-size: 14px; }
.product-row .p-sub { font-size: 11.5px; color: var(--ink-500); margin: 1px 0 8px; }
.price-row { display: flex; gap: 18px; }
.price-block { text-align: center; }
.price-block .p-label { font-size: 10px; color: var(--ink-300); margin-bottom: 2px; }
.price-block .p-value { font-size: 12.5px; color: var(--ink-700); font-weight: 600; }
.price-block.cash .p-value { font-size: 14px; color: var(--brand-green-700); font-weight: 800; }

/* ==========================================================================
   ناوبری پایین + شیت تماس (مختص همین اپ)
   ========================================================================== */
.app-bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  padding: 8px 4px calc(env(safe-area-inset-bottom, 0px) + 8px);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: none; background: transparent; cursor: pointer; text-decoration: none;
  color: var(--ink-300); font-size: 10.5px; padding: 2px 8px;
}
.nav-item.active { color: var(--brand-green-600); font-weight: 700; }

.contact-backdrop { position: fixed; inset: 0; background: rgba(15, 25, 20, .45); z-index: 25; }
.contact-sheet {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 30;
  background: var(--surface); border-radius: 18px 18px 0 0;
  padding: 18px 18px calc(env(safe-area-inset-bottom, 0px) + 80px);
  box-shadow: 0 -8px 24px rgba(16, 32, 24, 0.15);
}
.contact-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.contact-sheet-head h3 { font-size: 15px; font-weight: 700; }
.close-panel { border: none; background: var(--page-bg); color: var(--ink-500); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; }
.contact-row { display: flex; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--ink-900); text-decoration: none; }
.contact-row:last-child { border-bottom: none; }
.contact-row .icon { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; background: var(--brand-green-100); color: var(--brand-green-700); display: flex; align-items: center; justify-content: center; }

/* ---- Loading ---- */
.loading-row { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 0; color: var(--ink-500); font-size: 13.5px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--border); border-top-color: var(--brand-green-600); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.app-shell-loading {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: var(--page-bg, #f4f7f5); font-family: Tahoma, sans-serif; color: #6b7670;
}
.app-shell-loading-logo { width: 56px; height: 56px; border-radius: 16px; /*background: #1a8449;*/ display: flex; align-items: center; justify-content: center; }
.app-shell-loading-spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #e4e9e6; border-top-color: #1a8449; animation: spin .8s linear infinite; }

#blazor-error-ui {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
  background: #fff3cd; color: #664d03; border-top: 1px solid #ffe69c;
  padding: 12px 16px; font-size: 13px; text-align: center;
}
#blazor-error-ui .reload { color: var(--brand-green-700); font-weight: 700; margin-inline-start: 8px; }
#blazor-error-ui .dismiss { cursor: pointer; margin-inline-start: 12px; }

/* ---- دکمه نصب PWA ---- */
.install-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--brand-green-600); color: #fff; border: none;
  border-radius: 8px; padding: 6px 10px; font-size: 11px; font-weight: 700;
  cursor: pointer; flex-shrink: 0;
}
.install-btn:hover { background: var(--brand-green-500); }
