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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: #0d1b2a;
  color: #ecf0f1;
}

/* ===== نقشه ===== */
#map-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}
#map-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ===== HUD بالای صفحه ===== */
#hud-top {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 95vw;
}
.hud-card {
  background: rgba(15, 30, 45, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(52, 152, 219, 0.3);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  white-space: nowrap;
}
.hud-label { opacity: 0.85; }
.tickets-card { padding: 6px 10px; }
.ticket {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(52, 152, 219, 0.2);
  font-size: 0.75rem;
  margin: 0 2px;
}
.ticket.used-up { opacity: 0.3; text-decoration: line-through; }

/* ===== کنترل زوم ===== */
#zoom-controls {
  position: fixed;
  top: 80px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}
#zoom-controls button {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(15, 30, 45, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(52, 152, 219, 0.3);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
#zoom-controls button:hover {
  background: rgba(52, 152, 219, 0.3);
  transform: scale(1.05);
}

/* ===== HUD پایین ===== */
#hud-bottom {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 95vw;
}
#hud-bottom button {
  background: rgba(15, 30, 45, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(52, 152, 219, 0.3);
  color: white;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.15s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
#hud-bottom button:hover:not(:disabled) {
  background: rgba(52, 152, 219, 0.3);
  transform: translateY(-2px);
}
#hud-bottom button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.primary-btn {
  background: linear-gradient(135deg, #27ae60, #16a085) !important;
  border-color: transparent !important;
  font-weight: 600;
}
.success-btn {
  background: linear-gradient(135deg, #3498db, #2980b9) !important;
  border-color: transparent !important;
}

/* ===== پنل‌های کناری ===== */
.side-panel {
  position: fixed;
  width: 300px;
  max-height: calc(100vh - 200px);
  background: rgba(15, 30, 45, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(52, 152, 219, 0.3);
  border-radius: 14px;
  padding: 14px;
  z-index: 10;
  overflow-y: auto;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

.side-right { right: 16px; top: 80px; }
.side-left  { left: 16px; top: 80px; }

.side-panel.collapsed {
  max-height: 44px;
  overflow: hidden;
  padding: 0 14px;
}

.side-panel.collapsed .panel-header {
  height: 44px;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
  align-items: center;
}

.side-panel.collapsed > *:not(.panel-header) {
  display: none;
}

.side-panel.hidden { display: none; }

.side-panel .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(52, 152, 219, 0.2);
}
.side-panel h3 {
  font-size: 0.9rem;
  color: #ecf0f1;
}
.side-panel .collapse-btn {
  background: transparent;
  border: none;
  color: #ecf0f1;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 8px;
  border-radius: 6px;
}
.side-panel .collapse-btn:hover { background: rgba(52, 152, 219, 0.2); }

.side-panel p {
  font-size: 0.85rem;
  line-height: 1.7;
  color: #bdc3c7;
}

/* ===== خط زمانی ===== */
#timeline-list { list-style: none; }
#timeline-list .empty {
  color: #7f8c8d;
  text-align: center;
  padding: 12px;
  font-size: 0.85rem;
}
.timeline-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  border-bottom: 1px dashed rgba(52, 152, 219, 0.15);
  font-size: 0.8rem;
  flex-wrap: wrap;
}
.timeline-item:last-child { border-bottom: none; }
.day-badge {
  background: rgba(52, 152, 219, 0.3);
  color: white;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.7rem;
  white-space: nowrap;
}
.timeline-item.stay .text { color: #2ecc71; font-weight: 600; }

/* ===== پنل مراحل ===== */
.stage-hint {
  font-size: 0.85rem;
  color: #95a5a6;
  text-align: center;
  padding: 20px 8px;
  line-height: 1.7;
}

.stage-title-block {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(52, 152, 219, 0.15);
}

.stage-number {
  display: inline-block;
  background: #3498db;
  color: white;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  margin-bottom: 6px;
}

.stage-title-block h4 {
  font-size: 0.9rem;
  color: #ecf0f1;
}

.stage-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stage-option {
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  background: rgba(52, 152, 219, 0.08);
  border-right: 4px solid #3498db;
  transition: all 0.15s;
  color: #ecf0f1;
}
.stage-option:hover:not(.blocked) {
  background: rgba(52, 152, 219, 0.2);
  transform: translateX(-3px);
}
.stage-option.blocked {
  opacity: 0.4;
  cursor: not-allowed;
}

.stage-option-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 0.85rem;
}
.stage-option-route {
  color: #95a5a6;
  font-size: 0.75rem;
}
.stage-option-info {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: #bdc3c7;
}
.stage-option .reason {
  color: #e74c3c;
  font-size: 0.7rem;
  display: block;
  margin-top: 4px;
}

/* ===== مودال ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}
.modal.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  background: #1a2c3d;
  color: #ecf0f1;
  border-radius: 16px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: slideUp 0.3s ease;
  border: 1px solid rgba(52, 152, 219, 0.3);
}

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

.modal-content.modal-small { max-width: 420px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(52, 152, 219, 0.2);
  position: sticky;
  top: 0;
  background: #1a2c3d;
  border-radius: 16px 16px 0 0;
  z-index: 1;
}
.modal-header h2 { margin: 0; font-size: 1.1rem; color: #ecf0f1; }

.close-btn {
  background: transparent;
  color: #bdc3c7;
  font-size: 1.2rem;
  padding: 4px 10px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}
.close-btn:hover { background: rgba(52, 152, 219, 0.2); color: #fff; }

#optimal-body { padding: 20px; }

.optimal-warning {
  background: rgba(243, 156, 18, 0.15);
  border-right: 4px solid #f39c12;
  color: #f39c12;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  line-height: 1.6;
}

.optimal-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.optimal-stat {
  background: rgba(52, 152, 219, 0.1);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  border-right: 4px solid #3498db;
}
.optimal-stat .label {
  display: block;
  font-size: 0.75rem;
  color: #95a5a6;
  margin-bottom: 4px;
}
.optimal-stat .value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: #ecf0f1;
}

.optimal-timeline-title {
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: #ecf0f1;
}
.optimal-timeline { list-style: none; padding: 0; margin: 0; }
.optimal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  border-bottom: 1px dashed rgba(52, 152, 219, 0.15);
  font-size: 0.85rem;
  flex-wrap: wrap;
}
.optimal-item:last-child { border-bottom: none; }
.optimal-item.stay .text { color: #2ecc71; font-weight: 600; }

.confirm-body { padding: 20px; }
.confirm-body p {
  margin-bottom: 12px;
  line-height: 1.7;
  font-size: 0.9rem;
  color: #bdc3c7;
}
.confirm-hint { color: #7f8c8d; font-size: 0.8rem !important; }
.confirm-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.confirm-actions button {
  flex: 1;
  padding: 12px;
  font-size: 0.9rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  color: white;
  transition: all 0.15s;
}
.confirm-yes { background: #e67e22; }
.confirm-yes:hover { background: #d35400; }
.confirm-no { background: #7f8c8d; }
.confirm-no:hover { background: #95a5a6; }

#stay-prompt {
  padding: 0 20px 12px;
  color: #bdc3c7;
  font-size: 0.9rem;
}
#stay-options {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stay-card {
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s;
  border-right: 5px solid #16a085;
  background: rgba(22, 160, 133, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ecf0f1;
}
.stay-card:hover {
  transform: translateX(-4px);
  background: rgba(22, 160, 133, 0.25);
}
.stay-card .stay-name { font-weight: 600; }
.stay-card .stay-price { color: #2ecc71; font-weight: 600; }
.stay-card .stay-discount {
  font-size: 0.75rem;
  color: #e67e22;
  margin-right: 6px;
}

.finish {
  text-align: center;
  padding: 24px;
  border-radius: 12px;
}
.finish.win {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}
.finish.lose {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}
.finish h2 { margin-bottom: 8px; font-size: 1.2rem; }
.finish p { margin: 6px 0; color: #ecf0f1; font-size: 0.9rem; }
.finish .stars { font-size: 1.6rem; margin: 12px 0; }
.finish strong { color: #f39c12; }

/* ===== موبایل ===== */
@media (max-width: 900px) {
  .side-panel { width: 240px; }
}
@media (max-width: 640px) {
  .side-panel {
    width: calc(100vw - 32px);
    left: 16px !important;
    right: 16px !important;
    max-height: 50vh;
  }
  .side-left, .side-right { top: auto; bottom: 100px; }
  .side-panel.collapsed { max-height: 44px; }
}

.timeline-item.tour .text {
  color: #9b59b6;
  font-weight: 600;
}

.timeline-item.tour .phase-badge {
  background: rgba(155, 89, 182, 0.3);
}

.timeline-detail {
  display: block;
  width: 100%;
  font-size: 0.7rem;
  color: #95a5a6;
  margin-top: 4px;
  padding-right: 8px;
  line-height: 1.4;
}

/* ===== مودال درخواست مشتری ===== */
.brief-modal-body {
  padding: 20px;
}

#brief-modal-text {
  font-size: 0.95rem;
  line-height: 1.9;
  color: #ecf0f1;
  margin-bottom: 20px;
  text-align: justify;
}

.brief-modal-actions {
  display: flex;
  justify-content: center;
}

.brief-modal-btn {
  background: linear-gradient(135deg, #27ae60, #16a085);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 32px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.brief-modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px #27ae6055;
}
#header-brief {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-left: 1px solid #d9decf;
  border-right: 1px solid #d9decf;
  margin: 0 4px;
  max-width: 750px;
  overflow: hidden;
}

#header-brief-text {
  font-size: 10px;
  color: #738679;
  cursor: help;
  line-height: 1.5;
  
  /* ✅ حداکثر دو خط */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  
  /* ✅ فاصله‌ی مناسب */
  max-height: 3em;   /* ۲ خط × ۱.۵ */
}

/* ✅ موبایل: یک خط */
@media (max-width: 700px) {
  #header-brief {
    max-width: 140px;
    padding: 0 6px;
  }
  
  #header-brief-text {
    font-size: 9px;
    -webkit-line-clamp: 1;
    max-height: 1.4em;
  }
}

#tour-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#tour-modal.hidden {
  display: none;
}

.tour-modal-content {
  position: relative;
  width: 95vw;
  height: 95vh;
  border-radius: 20px;
  overflow: hidden;
  border: 3px solid #d4a050;
  box-shadow: 0 0 80px #d4a050aa;
}

#tour-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.tour-info {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.85);
  padding: 14px 22px;
  border-radius: 12px;
  border: 1px solid #d4a050;
  color: #f0e8d0;
  font-family: Vazirmatn, sans-serif;
  text-align: right;
  backdrop-filter: blur(8px);
  z-index: 10;
}

.tour-info h2 {
  font-size: 1.4rem;
  margin: 0 0 6px;
  color: #ffd070;
}

.tour-info p {
  font-size: 0.95rem;
  margin: 0;
  color: #d4c890;
}

/* ✅ باکس توضیحات جاذبه */
.tour-info-box {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  width: 90%;
  max-width: 600px;
  background: rgba(10, 20, 30, 0.92);
  border: 2px solid #d4a050;
  border-radius: 16px;
  padding: 20px 28px;
  color: #f0e8d0;
  font-family: Vazirmatn, sans-serif;
  text-align: right;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 40px #000a;
  opacity: 0;
  transition: all 0.5s ease;
  z-index: 10;
}

.tour-info-box.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tour-info-box h3 {
  font-size: 1.6rem;
  margin: 0 0 10px;
  color: #ffd070;
}

.tour-info-box p {
  font-size: 1rem;
  margin: 6px 0;
  line-height: 1.8;
  color: #d4c890;
}

.tour-description {
  font-size: 0.95rem !important;
  color: #b8c8b8 !important;
  line-height: 1.9 !important;
  margin-top: 12px !important;
  padding-top: 12px;
  border-top: 1px solid #d4a05044;
}

.tour-close {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid #d4a050;
  color: #ffd070;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 10;
}

.tour-close:hover {
  background: #d4a050;
  color: #000;
}