/* ============================================
   OSIYO TRAVEL 24 — CRM
   Dizayn tizimi: "yo'lovchi yo'nalishi" mavzusi
   ============================================ */

:root {
  --navy: #16233F;
  --navy-light: #24365C;
  --teal: #1F9D8A;
  --teal-light: #E4F5F2;
  --gold: #E8A94C;
  --gold-light: #FBF0DD;
  --bg: #F4F6F5;
  --surface: #FFFFFF;
  --border: #E1E4E8;
  --text: #1A2033;
  --text-muted: #6B7280;
  --danger: #D64545;
  --danger-light: #FBE9E9;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 10px;
  --shadow: 0 2px 10px rgba(22, 35, 63, 0.06);
  --shadow-lg: 0 12px 40px rgba(22, 35, 63, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ============ TUGMALAR ============ */
.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--navy);
  color: #fff;
}
.btn-primary:hover { background: var(--navy-light); }
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

/* ============ LOGIN EKRANI ============ */
.login-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--navy);
  padding: 20px;
}

/* Sekin "nafas oluvchi" yorug'lik - karta orqasida */
.login-bg-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(480px circle at 22% 28%, rgba(31, 157, 138, 0.30), transparent 60%),
    radial-gradient(520px circle at 82% 76%, rgba(232, 169, 76, 0.22), transparent 60%);
  animation: glow-breathe 10s ease-in-out infinite;
  pointer-events: none;
}
@keyframes glow-breathe {
  0%, 100% { opacity: 0.75; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

/* Ikki qatlamli yulduzlar - chuqurlik hissi (parallax) */
.login-bg-stars {
  position: absolute;
  inset: -10%;
  pointer-events: none;
}
.login-bg-stars--far {
  background-image: radial-gradient(rgba(255,255,255,0.28) 1px, transparent 1.4px);
  background-size: 110px 110px;
  animation: stars-drift 140s linear infinite;
}
.login-bg-stars--near {
  background-image: radial-gradient(rgba(255,255,255,0.5) 1.3px, transparent 1.8px);
  background-size: 70px 70px;
  background-position: 20px 35px;
  animation: stars-drift 70s linear infinite reverse;
}
@keyframes stars-drift {
  from { transform: translate(0, 0); }
  to { transform: translate(-110px, -110px); }
}

/* Egik parvoz yo'llari */
.login-bg-flight {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.login-bg-flight path {
  animation: path-flow 6s linear infinite;
}
.login-bg-flight path:nth-child(2) { animation-duration: 7s; }
.login-bg-flight path:nth-child(3) { animation-duration: 5.5s; }
@keyframes path-flow {
  to { stroke-dashoffset: -150; }
}

/* Yo'llar bo'ylab suzib boruvchi samolyotlar - turli tezlik, o'lcham, chuqurlik */
.login-bg-plane {
  position: absolute;
  inset: 0;
  width: 22px;
  height: 22px;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(232,169,76,0.7);
  offset-rotate: auto;
  offset-distance: 0%;
  pointer-events: none;
}
.plane-1 {
  font-size: 20px;
  offset-path: path("M -50,430 C 180,430 260,120 420,110 C 560,102 620,260 850,60");
  animation: plane-fly 13s linear infinite;
}
.plane-2 {
  font-size: 15px;
  color: var(--teal);
  text-shadow: 0 0 8px rgba(31,157,138,0.6);
  offset-path: path("M -50,90 C 140,90 180,300 360,320 C 540,340 600,150 850,190");
  animation: plane-fly 17s linear infinite;
  animation-delay: -5s;
}
.plane-3 {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  text-shadow: none;
  offset-path: path("M -50,250 C 220,180 300,380 480,300 C 620,240 680,340 850,400");
  animation: plane-fly 20s linear infinite;
  animation-delay: -11s;
}
.plane-4 {
  font-size: 14px;
  color: var(--gold);
  offset-path: path("M -50,340 C 160,300 260,60 460,80 C 600,94 660,220 850,150");
  animation: plane-fly-dim 15.5s linear infinite;
  animation-delay: -3s;
}
@keyframes plane-fly {
  0% { offset-distance: 0%; opacity: 0; }
  6% { opacity: 1; }
  94% { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}
@keyframes plane-fly-dim {
  0% { offset-distance: 0%; opacity: 0; }
  6% { opacity: 0.55; }
  94% { opacity: 0.55; }
  100% { offset-distance: 100%; opacity: 0; }
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 16px;
  padding: 40px 32px 28px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.ticket-perf {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background-image: radial-gradient(circle, var(--bg) 3px, transparent 3.5px);
  background-size: 16px 6px;
  background-repeat: repeat-x;
  background-position: center;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.brand-mark {
  font-size: 24px;
  color: var(--teal);
  transform: rotate(45deg);
  display: inline-block;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--navy);
  line-height: 1.2;
}
.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.field {
  display: block;
  margin-bottom: 16px;
}
.field span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.12s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--teal);
}
.field textarea { resize: vertical; }

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin: -6px 0 14px;
}
.login-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin: 18px 0 0;
  font-family: var(--font-mono);
}

/* ============ TOPBAR ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 28px;
  background: var(--navy);
  color: #fff;
  flex-wrap: wrap;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-orbit-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
}
.orbit-plane {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 11px;
  color: var(--gold);
  text-shadow: 0 0 6px rgba(232,169,76,0.6);
  offset-path: ellipse(78px 22px at 50% 50%);
  offset-rotate: auto;
  offset-distance: 0%;
  animation: brand-orbit 11s linear infinite;
  pointer-events: none;
}
@keyframes brand-orbit {
  to { offset-distance: 100%; }
}
.topbar-brand .brand-mark { color: var(--gold); }
.topbar-brand .brand-name {
  color: #fff;
  font-size: 16px;
}

.topbar-stats {
  display: flex;
  gap: 28px;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 500;
  color: var(--gold);
}
.stat-label {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.search-input {
  padding: 8px 14px;
  border-radius: 20px;
  border: 1.5px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 13px;
  width: 220px;
}
.search-input::placeholder { color: rgba(255,255,255,0.45); }
.search-input:focus {
  outline: none;
  border-color: var(--teal);
  background: rgba(255,255,255,0.14);
}
.topbar-actions .btn-ghost {
  color: rgba(255,255,255,0.8);
  border-color: rgba(255,255,255,0.25);
}
.topbar-actions .btn-ghost:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* ============ YO'NALISH CHIZIG'I (signature element) ============ */
.route-line {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 28px;
  overflow-x: auto;
}
.route-stop {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.route-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}
.route-dot.active { background: var(--teal); }
.route-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 10px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.route-track {
  width: 40px;
  height: 1.5px;
  background: repeating-linear-gradient(90deg, var(--border) 0 5px, transparent 5px 9px);
  flex-shrink: 0;
}

/* ============ BOARD / KANBAN ============ */
.board {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
  padding: 16px 16px 24px;
  align-items: start;
  min-height: calc(100vh - 130px);
}

.column {
  min-width: 0;
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 150px);
}

.column-header {
  padding: 10px 10px 8px;
  border-bottom: 1px dashed var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}
.column-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.column-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}
.column-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11.5px;
  line-height: 1.25;
  color: var(--navy);
  word-break: break-word;
}
.column-meta {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  margin-top: 4px;
  padding-left: 14px;
}
.column-add {
  background: var(--bg);
  border: none;
  border-radius: 6px;
  width: 22px;
  height: 22px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1;
  flex-shrink: 0;
  margin-top: 4px;
}
.column-add:hover { background: var(--teal-light); color: var(--teal); }

.column-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 80px;
}
.column-body.drag-over {
  background: var(--teal-light);
  outline: 2px dashed var(--teal);
  outline-offset: -6px;
}

/* ============ LEAD KARTOCHKASI ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px;
  cursor: grab;
  position: relative;
  transition: box-shadow 0.12s ease, transform 0.12s ease;
}
.card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.card.dragging { opacity: 0.4; }

.card-name {
  font-weight: 600;
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 3px;
  padding-right: 16px;
  word-break: break-word;
}
.card-phone {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  word-break: break-all;
}
.card-divider {
  border-top: 1px dashed var(--border);
  margin: 6px 0;
}
.card-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-size: 10px;
}
.card-sum {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--teal);
  background: var(--teal-light);
  padding: 2px 7px;
  border-radius: 10px;
}
.card-sum.empty { color: var(--text-muted); background: var(--bg); }
.card-owner {
  color: var(--text-muted);
}
.card-source {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 11px;
  opacity: 0.55;
}
.card-note {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 5px;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.35;
}

.column-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 10.5px;
  padding: 18px 6px;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 35, 63, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--navy);
}
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
#lead-form { padding: 20px 22px 22px; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}
.modal-footer-right {
  display: flex;
  gap: 10px;
}

/* ============ RESPONSIV ============ */
/* Katta/o'rta monitorlarda barcha 10 ustun bitta qatorga sig'adi (grid). */
/* Torroq ekranlarda (planshet/telefon) ustunlar o'qib bo'lmas darajada torayib
   ketmasligi uchun gorizontal skrollga qaytamiz. */
@media (max-width: 900px) {
  .board {
    display: flex;
    overflow-x: auto;
    gap: 10px;
  }
  .column {
    flex: 0 0 220px;
  }
}

@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .topbar-stats { gap: 16px; }
  .search-input { width: 160px; }
  .board { padding: 16px; }
}

/* Focus ko'rinishi (keyboard) */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
