/* ============================================================
   PIPELINE STYLES — Kanban Board + Deal Management
   ============================================================ */

/* Pipeline Controls */
.pipe-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.pipe-controls-left, .pipe-controls-right { display: flex; gap: 8px; flex-wrap: wrap; }

.pipe-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #ccc;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.pipe-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.pipe-btn-primary { background: rgba(0,255,136,0.15); border-color: rgba(0,255,136,0.3); color: #00ff88; }
.pipe-btn-primary:hover { background: rgba(0,255,136,0.25); }
.pipe-btn-ghl { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.3); color: #3b82f6; }
.pipe-btn-ghl:hover { background: rgba(59,130,246,0.25); }

/* Pipeline Stats */
.pipe-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.pipe-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.pipe-stat-val {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}
.pipe-stat-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pipe-stat-alert .pipe-stat-val { color: #ef4444; }

/* Kanban Board */
.pipe-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 20px;
  min-height: 400px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}
.pipe-board::-webkit-scrollbar { height: 8px; }
.pipe-board::-webkit-scrollbar-track { background: transparent; }
.pipe-board::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.pipe-column {
  min-width: 240px;
  max-width: 260px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s;
}
.pipe-column-over {
  border-color: rgba(0,255,136,0.4);
  background: rgba(0,255,136,0.03);
}

.pipe-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.pipe-column-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pipe-column-label {
  font-size: 13px;
  font-weight: 600;
  color: #ddd;
  flex: 1;
}
.pipe-column-count {
  font-size: 11px;
  background: rgba(255,255,255,0.08);
  color: #999;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.pipe-column-body {
  padding: 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100px;
}

/* Deal Cards */
.pipe-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.pipe-card:hover {
  border-color: rgba(0,255,136,0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.pipe-card-dragging { opacity: 0.4; }
.pipe-card-overdue { border-color: rgba(239,68,68,0.4); }

.pipe-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.pipe-card-priority { font-size: 10px; }
.pipe-card-model {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex: 1;
}
.pipe-card-mw {
  font-size: 12px;
  font-weight: 600;
  color: #00ff88;
  background: rgba(0,255,136,0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.pipe-card-seller {
  font-size: 12px;
  color: #aaa;
  margin-bottom: 2px;
}
.pipe-card-location {
  font-size: 11px;
  color: #777;
  margin-bottom: 4px;
}
.pipe-card-price {
  font-size: 13px;
  font-weight: 600;
  color: #3b82f6;
  margin-bottom: 4px;
}
.pipe-card-followup {
  font-size: 11px;
  color: #f59e0b;
  margin-bottom: 4px;
}
.pipe-card-followup.overdue { color: #ef4444; font-weight: 600; }
.pipe-card-note {
  font-size: 11px;
  color: #888;
  font-style: italic;
  margin-bottom: 4px;
  line-height: 1.3;
}
.pipe-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}
.pipe-card-date {
  font-size: 10px;
  color: #666;
}
.pipe-ghl-badge {
  font-size: 10px;
  color: #3b82f6;
  background: rgba(59,130,246,0.1);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* Detail CTA Pipeline Button */
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.detail-cta-pipeline {
  background: rgba(59,130,246,0.15) !important;
  border-color: rgba(59,130,246,0.3) !important;
  color: #3b82f6 !important;
  cursor: pointer;
}
.detail-cta-pipeline:hover {
  background: rgba(59,130,246,0.25) !important;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal { display: none; }
.modal.modal-open { display: block; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  z-index: 1000;
}

.modal-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #111;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  width: min(680px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1001;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}
.modal-close:hover { color: #fff; }

.modal-body { padding: 20px 24px 24px; }

.modal-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.modal-section:last-child { border-bottom: none; margin-bottom: 0; }

.modal-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: #00ff88;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 12px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-field label {
  display: block;
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.modal-field input, .modal-field select {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
}
.modal-field input:focus, .modal-field select:focus {
  outline: none;
  border-color: rgba(0,255,136,0.4);
}

/* Follow-up presets */
.followup-presets {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.followup-presets button {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #aaa;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.followup-presets button:hover {
  background: rgba(0,255,136,0.1);
  border-color: rgba(0,255,136,0.3);
  color: #00ff88;
}

/* Notes */
.notes-list {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 10px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}
.note-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
}
.note-auto { opacity: 0.6; }
.note-time { color: #666; font-size: 11px; white-space: nowrap; min-width: 100px; }
.note-text { color: #ccc; }
.note-empty { color: #555; font-style: italic; font-size: 13px; padding: 8px 0; }

.note-input-row {
  display: flex;
  gap: 8px;
}
.note-input-row input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
}
.note-input-row input:focus { outline: none; border-color: rgba(0,255,136,0.4); }
.note-input-row button {
  background: rgba(0,255,136,0.15);
  border: 1px solid rgba(0,255,136,0.3);
  color: #00ff88;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

/* Modal actions */
.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.modal-action-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #ccc;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: all 0.15s;
  display: inline-block;
}
.modal-action-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.modal-action-ghl { color: #3b82f6; border-color: rgba(59,130,246,0.3); }
.modal-action-delete { color: #ef4444; border-color: rgba(239,68,68,0.3); }
.modal-action-delete:hover { background: rgba(239,68,68,0.15); }

.modal-ghl-info {
  font-size: 11px;
  color: #666;
  margin-top: 16px;
  padding: 8px 12px;
  background: rgba(59,130,246,0.05);
  border-radius: 6px;
}

/* Settings */
.settings-desc {
  font-size: 13px;
  color: #888;
  margin: 0 0 16px;
  line-height: 1.5;
}
.settings-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
}
.settings-status {
  font-size: 12px;
  color: #00ff88;
  font-weight: 600;
  margin-left: 8px;
}
.settings-status-off { color: #ef4444; }
.settings-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.settings-list li {
  font-size: 13px;
  color: #999;
  padding: 4px 0;
}
.settings-list li::before {
  content: "→ ";
  color: #00ff88;
}
.settings-list code {
  background: rgba(255,255,255,0.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #3b82f6;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #111;
  border: 1px solid rgba(0,255,136,0.3);
  color: #00ff88;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  z-index: 2000;
  transition: transform 0.3s ease;
  pointer-events: none;
}
#toast.toast-show {
  transform: translateX(-50%) translateY(0);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .pipe-board { flex-direction: column; }
  .pipe-column { min-width: 100%; max-width: 100%; }
  .pipe-controls { flex-direction: column; }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-content { width: 98vw; }
  .pipe-stats { justify-content: center; }
}
