/* ═══════════════════════════════════════════════════════════════════════════
   components.css — Стили для Шторки, Канбана, Скоринга, Импорта
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Статус-цвета select ────────────────────────────────────────────────── */
.status-select {
  flex: 1;
  padding: 5px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

.status-select.status-new { 
  background-color: rgba(59, 130, 246, 0.1); 
  border-color: rgba(59, 130, 246, 0.2); 
  color: #3b82f6; 
  padding-left: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4l3 3'/%3E%3C/svg%3E");
  background-position: right 8px center, left 8px center;
}
.status-select.status-in-progress { 
  background-color: rgba(245, 158, 11, 0.1); 
  border-color: rgba(245, 158, 11, 0.2); 
  color: #f59e0b; 
  padding-left: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2'%3E%3Cpolygon points='13 2 3 14 12 14 11 22 21 10 12 10 13 2'/%3E%3C/svg%3E");
  background-position: right 8px center, left 8px center;
}
.status-select.status-recall { 
  background-color: rgba(252, 211, 77, 0.1); 
  border-color: rgba(252, 211, 77, 0.2); 
  color: #fcd34d; 
  padding-left: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23fcd34d' stroke-width='2'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z'/%3E%3C/svg%3E");
  background-position: right 8px center, left 8px center;
}
.status-select.status-sent-example { 
  background-color: rgba(139, 92, 246, 0.1); 
  border-color: rgba(139, 92, 246, 0.2); 
  color: #8b5cf6; 
  padding-left: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='17 8 12 3 7 8'/%3E%3Cline x1='12' y1='3' x2='12' y2='15'/%3E%3C/svg%3E");
  background-position: right 8px center, left 8px center;
}
.status-select.status-meeting { 
  background-color: rgba(236, 72, 153, 0.1); 
  border-color: rgba(236, 72, 153, 0.2); 
  color: #ec4899; 
  padding-left: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ec4899' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-position: right 8px center, left 8px center;
}
.status-select.status-success { 
  background-color: rgba(16, 185, 129, 0.1); 
  border-color: rgba(16, 185, 129, 0.2); 
  color: #10b981; 
  padding-left: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-position: right 8px center, left 8px center;
}
.status-select.status-fail { 
  background-color: rgba(239, 68, 68, 0.1); 
  border-color: rgba(239, 68, 68, 0.2); 
  color: #ef4444; 
  padding-left: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E");
  background-position: right 8px center, left 8px center;
}

/* ─── Карточки в сетке ───────────────────────────────────────────────────── */
.card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: normal;
  word-break: break-word;
  line-height: 1.2;
  margin-bottom: 2px;
}

.card-type {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-type-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.score-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 22px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  border: 1px solid;
  flex-shrink: 0;
  padding: 0 8px;
}

.card-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.card-contact {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-fast);
}

.phone-badge {
  background: rgba(99,102,241,0.08);
  border-color: rgba(99,102,241,0.2);
  cursor: default;
}

.link-badge {
  background: rgba(255,255,255,0.03);
  color: #38bdf8;
  text-decoration: none;
}
.link-badge:hover {
  background: rgba(56, 189, 248, 0.1);
  text-decoration: underline;
}

.max-badge {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.max-badge:hover {
  background: rgba(16, 185, 129, 0.2);
  text-decoration: none;
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

/* Канбан карточка */
.kanban-card .card-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.04);
}

/* ─── Зона импорта ───────────────────────────────────────────────────────── */
.import-drop-zone {
  border: 2px dashed rgba(99,102,241,0.25);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-normal);
  background: rgba(99,102,241,0.03);
  margin-bottom: 20px;
}

.import-drop-zone:hover,
.import-drop-zone.drag-over {
  border-color: rgba(99,102,241,0.6);
  background: rgba(99,102,241,0.07);
  box-shadow: 0 0 20px rgba(99,102,241,0.1);
}

.import-drop-zone.drag-over-global {
  border-color: rgba(99,102,241,0.8);
  background: rgba(99,102,241,0.1);
}

.import-zone-icon { font-size: 36px; margin-bottom: 10px; }
.import-zone-title { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.import-zone-sub   { font-size: 13px; color: var(--text-muted); }

/* ─── Шторка деталей (Drawer) ────────────────────────────────────────────── */
#drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-normal);
}

#drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

#lead-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  max-width: 100vw;
  height: 100vh;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: var(--border-glass);
  z-index: 950;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

#lead-drawer.open {
  transform: translateX(0);
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
}

/* Хедер шторки */
.drawer-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 24px 20px;
  border-bottom: var(--border-glass);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: transparent;
  z-index: 10;
}

.drawer-lead-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.drawer-lead-info {
  flex: 1;
  min-width: 0;
}

.drawer-lead-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.drawer-lead-type {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Скор-бар */
.drawer-score-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.score-ring-wrap {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

.score-ring { display: block; }

.score-ring-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.score-label-text {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.score-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Тело шторки */
.drawer-body {
  padding: 20px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-badge {
  font-size: 10px;
  padding: 2px 8px;
  background: rgba(245,158,11,0.15);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius-full);
}

/* Контакты в шторке */
.drawer-contacts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-contact-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: var(--transition-fast);
}

.drawer-contact-btn:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.12);
}

/* Разбивка скоринга */
.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
  font-size: 13px;
  transition: var(--transition-fast);
}

.breakdown-row.passed {
  background: rgba(34,197,94,0.05);
}

.breakdown-row.failed {
  opacity: 0.5;
}

.breakdown-icon { font-size: 14px; flex-shrink: 0; }

.breakdown-criterion {
  flex: 1;
  color: var(--text-secondary);
}

.breakdown-score {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* История статусов */
.status-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

[data-status="new"]         .status-dot, .status-dot[data-status="new"]         { background: #3b82f6; }
[data-status="in-progress"] .status-dot, .status-dot[data-status="in-progress"] { background: #f59e0b; }
[data-status="recall"]      .status-dot, .status-dot[data-status="recall"]      { background: #fcd34d; }
[data-status="sent-example"].status-dot, .status-dot[data-status="sent-example"]{ background: #8b5cf6; }
[data-status="meeting"]     .status-dot, .status-dot[data-status="meeting"]     { background: #ec4899; }
[data-status="success"]     .status-dot, .status-dot[data-status="success"]     { background: #10b981; }
[data-status="fail"]        .status-dot, .status-dot[data-status="fail"]        { background: #ef4444; }

.status-history-label { flex: 1; color: var(--text-secondary); }
.status-history-time  { font-size: 11px; color: var(--text-muted); }

/* ─── Admin-секция в шторке ──────────────────────────────────────────────── */
.drawer-admin-section {
  background: rgba(245,158,11,0.04);
  border: 1px solid rgba(245,158,11,0.12);
  border-radius: var(--radius-md);
  padding: 16px;
  gap: 14px;
}

/* Промпт */
.prompt-field {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.prompt-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.prompt-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}

.prompt-empty {
  text-align: center;
  padding: 16px;
  font-size: 13px;
}

/* AI кнопка */
.btn-ai {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
  padding: 12px 20px;
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.15));
  border: 1px solid rgba(99,102,241,0.35);
  border-radius: var(--radius-md);
  color: var(--text-accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-normal);
  font-family: var(--font-sans);
}

.btn-ai:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(139,92,246,0.25));
  box-shadow: 0 0 20px rgba(99,102,241,0.2);
  transform: translateY(-1px);
}

.btn-ai:disabled {
  opacity: 0.5;
  transform: none;
  cursor: not-allowed;
}

.btn-ai-icon { font-size: 18px; }

/* AI результат */
.ai-result {
  background: rgba(99,102,241,0.05);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.ai-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(99,102,241,0.08);
  border-bottom: 1px solid rgba(99,102,241,0.1);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-accent);
}

.ai-result-text {
  padding: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
}

/* ─── Кнопка Импорт CSV в хедере ─────────────────────────────────────────── */
.btn-import {
  background: rgba(20,184,166,0.1);
  border: 1px solid rgba(20,184,166,0.3);
  color: var(--accent-teal);
}

.btn-import:hover {
  background: rgba(20,184,166,0.2);
  box-shadow: 0 0 15px rgba(20,184,166,0.15);
}

/* Контрол сортировки */
.sort-select {
  padding: 6px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  outline: none;
  font-family: var(--font-sans);
}

/* ─── Пустое состояние ───────────────────────────────────────────────────── */
.leads-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.leads-empty-icon  { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.leads-empty-title { font-size: 18px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.leads-empty-sub   { font-size: 14px; }

/* ─── Адаптивность шторки ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #lead-drawer {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
  }
}
