/* ==========================================================================
   استایل‌های مدرن و راست‌چین مینی‌اپ تلگرام با فونت اختصاصی وزیرمتن
   (SalehiWorks AI Scout - Modern Telegram Mini App Stylesheet)
   ========================================================================== */

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

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

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

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

:root {
  --bg-color: var(--tg-theme-bg-color, #0f172a);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #1e293b);
  --text-color: var(--tg-theme-text-color, #f8fafc);
  --hint-color: var(--tg-theme-hint-color, #94a3b8);
  --accent-color: var(--tg-theme-button-color, #38bdf8);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(148, 163, 184, 0.15);
  --badge-green: rgba(16, 185, 129, 0.15);
  --badge-green-text: #34d399;
  --badge-amber: rgba(245, 158, 11, 0.15);
  --badge-amber-text: #fbbf24;
  --badge-rose: rgba(244, 63, 94, 0.15);
  --badge-rose-text: #fb7185;
  --badge-cyan: rgba(6, 182, 212, 0.15);
  --badge-cyan-text: #22d3ee;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
}

body {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  direction: rtl;
  text-align: right;
  line-height: 1.7;
  padding-bottom: 90px;
  min-height: 100vh;
  margin: 0;
  padding-left: 0;
  padding-right: 0;
}

/* هدر اصلی برنامه */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
  padding: 16px 16px 12px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.brand-badge {
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.time-badge {
  font-size: 0.75rem;
  color: var(--hint-color);
  background: var(--card-bg);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* نوار جستجو */
.search-container {
  position: relative;
  margin-bottom: 12px;
}

.search-input {
  width: 100%;
  background: var(--secondary-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 10px 42px 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-color);
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--hint-color);
  font-size: 1rem;
  pointer-events: none;
}

/* تب‌های ناوبری بالا */
.nav-tabs {
  display: flex;
  background: var(--secondary-bg);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  border: 1px solid var(--card-border);
}

.nav-tab {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--hint-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  background: transparent;
  font-family: inherit;
}

.nav-tab.active {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.tab-badge {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 700;
}

/* نوار فیلتر دسته‌بندی‌ها (اسکرول افقی نرم) */
.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  padding-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  white-space: nowrap;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--hint-color);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.filter-pill.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 600;
}

.iran-toggle-wrapper {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--hint-color);
}

.iran-checkbox {
  accent-color: #0ea5e9;
  cursor: pointer;
  width: 15px;
  height: 15px;
}

/* کارت ابزارها */
.deals-container {
  padding: 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.deal-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 16px 16px;
  position: relative;
  transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
  backdrop-filter: blur(8px);
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

.deal-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.deal-card.sliding-out {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-category {
  font-size: 0.72rem;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 3px 10px;
  border-radius: 12px;
}

.new-offer-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  padding: 3px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.card-title-row {
  margin-bottom: 12px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  transition: color 0.2s ease;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.card-title:hover {
  color: #38bdf8;
}

.source-badge {
  font-size: 0.68rem;
  color: var(--hint-color);
  background: var(--secondary-bg);
  padding: 2px 6px;
  border-radius: 6px;
}

/* ردیف آفرها و مشخصات */
.pricing-badges-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--secondary-bg);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.85rem;
}

.badge-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px 8px;
}

.badge-label {
  font-weight: 600;
  color: #ffffff;
}

.badge-value {
  color: #cbd5e1;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* توضیحات فارسی و انگلیسی */
.card-desc {
  font-size: 0.88rem;
  color: #e2e8f0;
  margin-bottom: 12px;
  line-height: 1.7;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.card-desc-en {
  font-size: 0.78rem;
  color: var(--hint-color);
  font-style: italic;
  direction: ltr;
  text-align: left;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}
  line-height: 1.5;
}

/* باکس سناریوی نمونه‌کار */
.portfolio-box {
  background: rgba(14, 165, 233, 0.08);
  border-right: 3px solid #0ea5e9;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.84rem;
  color: #bae6fd;
}

.portfolio-title {
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* دکمه‌های اکشن کارت */
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--card-border);
}

.link-btn {
  font-size: 0.82rem;
  font-weight: 600;
  color: #38bdf8;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.1);
  transition: all 0.2s ease;
}

.link-btn:hover {
  background: rgba(56, 189, 248, 0.2);
}

.check-btn {
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.check-btn:hover {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.check-btn.uncheck-btn {
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
}

.check-btn.uncheck-btn:hover {
  background: #f43f5e;
  color: #ffffff;
  border-color: #f43f5e;
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.4);
}

/* وضعیت خالی (Empty State) */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--hint-color);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
}

.empty-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}

.empty-subtitle {
  font-size: 0.85rem;
  line-height: 1.6;
}

/* لودینگ */
.loading-box {
  text-align: center;
  padding: 40px;
  color: var(--hint-color);
  font-size: 0.95rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(56, 189, 248, 0.2);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

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