/* تعریف فونت */
@font-face {
  font-family: 'CustomFont';
  src: url('../data/font.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --primary-color: #1e3a8a;
  --secondary-color: #3b82f6;
  --success-color: #10b981;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-color: #1f2937;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'CustomFont', tahoma, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  padding-bottom: 100px;
}

/* --- هدر --- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--card-bg);
  padding: 12px 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-container {
  flex-grow: 1;
  text-align: center;
}

.logo {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary-color);
}

.hamburger-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--primary-color);
}

/* --- منوی کشویی --- */
.nav-menu {
  position: fixed;
  top: 0;
  left: -270px;
  width: 270px;
  height: 100%;
  background-color: var(--card-bg);
  box-shadow: 2px 0 15px rgba(0,0,0,0.1);
  transition: left 0.3s ease;
  z-index: 200;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}

.nav-menu.active {
  left: 0;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  margin: 0 20px 10px auto;
  display: block;
  color: #64748b;
}

.nav-top {
  list-style: none;
  padding: 10px 16px;
  flex: 1;
}

.nav-top li {
  margin-bottom: 6px;
}

.nav-top a {
  display: block;
  padding: 13px 16px;
  color: var(--text-color);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.nav-top a:hover {
  background: #f1f5f9;
  color: var(--primary-color);
}

.nav-bottom {
  margin-top: auto;
  padding: 0 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nav-orders {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  color: #334155;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.nav-orders:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* باکس موجودی */
.balance-box {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  border-radius: 16px;
  padding: 16px;
  color: white;
  text-align: center;
  box-shadow: 0 8px 20px -4px rgba(14, 165, 233, 0.4);
  position: relative;
  overflow: hidden;
}

.balance-box::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -40%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.18) 0%, transparent 70%);
  pointer-events: none;
}

.balance-label {
  font-size: 0.82rem;
  opacity: 0.9;
  margin-bottom: 4px;
  font-weight: 500;
}

.balance-amount {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.charge-btn {
  width: 100%;
  padding: 10px;
  background: white;
  color: #0284c7;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.charge-btn:hover {
  background: #f0f9ff;
  transform: scale(1.02);
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  display: none;
  z-index: 150;
}

.overlay.active {
  display: block;
}

/* --- بخش اصلی خدمات --- */
main {
  padding: 20px 15px;
  max-width: 800px;
  margin: 0 auto;
}

.section-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary-color);
  margin-bottom: 15px;
  position: relative;
}

.section-title::after {
  content: '';
  display: block;
  width: 50px;
  height: 4px;
  background-color: var(--secondary-color);
  margin: 8px auto 0;
  border-radius: 2px;
}

.categories-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 20px;
  scrollbar-width: thin;
}

.category-chip {
  white-space: nowrap;
  padding: 8px 16px;
  background-color: #e2e8f0;
  color: var(--text-color);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.category-chip.active, .category-chip:hover {
  background-color: var(--secondary-color);
  color: #ffffff;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.service-card {
  background-color: var(--card-bg);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 85px;
}

.service-card:active {
  transform: scale(0.97);
}

.service-card h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 4px;
  line-height: 1.4;
}

.service-card span.category-tag {
  font-size: 0.75rem;
  color: #64748b;
}

/* --- جستجو و فوتر --- */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--card-bg);
  padding: 12px 15px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
  z-index: 100;
}

.search-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.search-box input {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #cbd5e1;
  border-radius: 25px;
  outline: none;
  font-size: 0.9rem;
  background: white;
}

.search-box input:focus {
  border-color: var(--secondary-color);
}

.search-results-list {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  margin-bottom: 8px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.15);
  display: none;
  list-style: none;
  z-index: 110;
}

.search-results-list li {
  padding: 12px 15px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-color);
}

.search-results-list li:last-child {
  border-bottom: none;
}

.search-results-list li:hover {
  background-color: #f8fafc;
  color: var(--secondary-color);
}

/* دکمه شناور هوش مصنوعی */
.ai-bot-btn {
  position: fixed;
  bottom: 75px;
  left: 20px;
  width: 55px;
  height: 55px;
  background-color: var(--secondary-color);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  cursor: pointer;
  z-index: 90;
  border: 2px solid #fff;
}

/* --- مدال‌ها --- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 300;
  padding: 20px;
}

.modal-content {
  background-color: var(--card-bg);
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  animation: fadeIn 0.2s ease-in-out;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-content form {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
  padding-bottom: 10px;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.modal-header h2 {
  font-size: 1.1rem;
  color: var(--primary-color);
}

.modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex-grow: 1;
  min-height: 0;
}

.modal-body p {
  font-size: 0.9rem;
  margin-bottom: 12px;
  line-height: 1.6;
  color: #4b5563;
}

.info-badge {
  display: flex;
  justify-content: space-between;
  background-color: #f1f5f9;
  padding: 10px;
  border-radius: 8px;
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-group {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.order-btn {
  flex: 1;
  padding: 10px;
  background-color: var(--success-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.close-modal-btn {
  flex: 1;
  padding: 10px;
  background-color: #94a3b8;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.form-group {
  margin-bottom: 12px;
  text-align: right;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.form-group input, .form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  outline: none;
  font-size: 0.85rem;
}

.submit-order-btn {
  width: 100%;
  padding: 10px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
}

/* --- استایل چت هوش مصنوعی --- */
.chat-box {
  display: flex;
  flex-direction: column;
  height: 320px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 10px;
  overflow-y: auto;
  gap: 10px;
  margin-bottom: 10px;
}

.chat-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.chat-msg.user {
  align-self: flex-start;
  background-color: var(--secondary-color);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.chat-msg.ai {
  align-self: flex-end;
  background-color: #ffffff;
  color: var(--text-color);
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 2px;
}

.chat-input-area {
  display: flex;
  gap: 8px;
}

.chat-input-area input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  outline: none;
  font-size: 0.85rem;
}

.chat-send-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.inline-order-btn {
  display: inline-block;
  margin-top: 6px;
  background-color: var(--success-color);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  border: none;
  font-weight: bold;
}

body.modal-open {
  overflow: hidden;
}
