/* ==========================================================================
   COMPONENTS.CSS — UI Atoms & Molecules
   Referenced from: mtips5s_30_VPS3_UX_UI_Design
   ========================================================================== */

/* CARDS & PANELS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  position: relative;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* METRICS HERO */
.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.metric-sub {
  font-size: 11px;
  color: var(--accent-emerald);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-primary-hover);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.3);
  color: var(--accent-rose);
}
.btn-danger:hover {
  background: var(--accent-rose);
  color: #fff;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.btn-icon:hover {
  color: var(--text-main);
  border-color: var(--accent-primary);
}

/* STATUS PILLS & BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-ice { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); border: 1px solid rgba(6, 182, 212, 0.3); }
.badge-cold { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-warm { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-hot { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-closed { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.3); }

/* LEAD SCORE GAUGE */
.lead-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
}
.lead-score-high { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.lead-score-med { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.lead-score-low { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }

/* FUNNEL STEPPER BAR */
.funnel-stepper {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  overflow-x: auto;
  padding: var(--space-2) 0;
}
.funnel-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.funnel-step.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-primary);
  color: #a5b4fc;
}

/* KANBAN BOARD */
.kanban-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  align-items: start;
}
.kanban-column {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 480px;
}
.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}
.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  cursor: grab;
  transition: all var(--transition-fast);
}
.kanban-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

/* TASK EVIDENCE GALLERY (5 SLOTS) & LIGHTBOX */
.task-image-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.task-image-thumbnail {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: transform var(--transition-fast);
}
.task-image-thumbnail:hover {
  transform: scale(1.08);
  border-color: var(--accent-primary);
}
.task-image-dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.task-image-dropzone:hover, .task-image-dropzone.dragover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.05);
}
.task-image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
}
.task-image-lightbox.active {
  display: flex;
}
.task-image-lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

/* FORMS */
.form-group {
  margin-bottom: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.form-input, .form-select, .form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* TABLE & DATA GRID (VPS3 Enterprise Pattern) */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: var(--space-2);
}

.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.015);
}

.table td {
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  transition: background var(--transition-fast);
}

.table tbody tr:hover td {
  background: rgba(99, 102, 241, 0.04);
}

.table tr:last-child td {
  border-bottom: none;
}

.person {
  font-weight: 700;
  color: var(--text-main);
  display: block;
}

.sub {
  display: block;
  color: var(--text-muted);
  font-size: 11.5px;
  margin-top: 3px;
}

.sub a {
  color: var(--accent-cyan);
  text-decoration: none;
}

.sub a:hover {
  text-decoration: underline;
}

/* FORM ELEMENTS & INPUTS */
input, textarea, select {
  background: var(--bg-surface-elevated) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-main) !important;
  padding: 10px 14px !important;
  font-family: inherit !important;
  font-size: 13.5px !important;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25) !important;
}

.customer-status, .customer-temp, .requirement-status {
  padding: 6px 10px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  border-radius: var(--radius-pill) !important;
  cursor: pointer;
}

/* TOOLBAR & SEARCH */
.toolbar {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.search {
  flex: 1;
  min-width: 240px;
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-sm) !important;
  padding: 10px 14px !important;
  color: var(--text-main) !important;
}

.filter-select {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-sm) !important;
  padding: 9px 14px !important;
  color: var(--text-main) !important;
  cursor: pointer;
}

/* PRIMARY & SECONDARY ACTION BUTTONS */
.primary {
  background: var(--grad-primary) !important;
  color: #fff !important;
  font-weight: 700 !important;
  padding: 10px 18px !important;
  border-radius: var(--radius-sm) !important;
  border: none !important;
  cursor: pointer !important;
  box-shadow: var(--shadow-glow) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.primary:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45) !important;
}

.primary:active {
  transform: translateY(0) !important;
}

.secondary {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--text-main) !important;
  font-weight: 600 !important;
  padding: 8px 14px !important;
  border-radius: var(--radius-sm) !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.secondary:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

/* DIALOGS & OVERLAYS */
dialog {
  margin: auto !important;
  width: min(580px, 92vw) !important;
  max-height: 85vh !important;
  overflow-y: auto !important;
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
  color: var(--text-main) !important;
  padding: 0 !important;
}

dialog[open] {
  display: block !important;
}

dialog form {
  padding: 24px !important;
}

dialog::backdrop {
  background: rgba(5, 8, 16, 0.82) !important;
  backdrop-filter: blur(8px) !important;
}

.dialog-head h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

/* INSIGHT AI CARDS */
.insight {
  border-left: 3px solid var(--accent-primary) !important;
  background: rgba(99, 102, 241, 0.08) !important;
  border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
  padding: 16px !important;
  margin: 12px 0 !important;
  border-top: 1px solid rgba(99, 102, 241, 0.15) !important;
  border-right: 1px solid rgba(99, 102, 241, 0.15) !important;
  border-bottom: 1px solid rgba(99, 102, 241, 0.15) !important;
}

.insight strong {
  color: #a5b4fc !important;
  font-size: 13px !important;
  letter-spacing: 0.02em !important;
}

.feedback-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.feedback-actions .insight-feedback[data-feedback="Đúng"] {
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

.feedback-actions .insight-feedback[data-feedback="Sai"] {
  color: #fb7185 !important;
  border-color: rgba(244, 63, 94, 0.3) !important;
}

.feedback-actions .insight-feedback[data-feedback="Cần xác minh"] {
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}

/* CALENDAR STRIP */
.calendar-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.calendar-day {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  padding: 12px !important;
  min-height: 72px;
  transition: all var(--transition-fast);
}

.calendar-day.today {
  border-color: var(--accent-primary) !important;
  background: rgba(99, 102, 241, 0.12) !important;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.2);
}

.calendar-day span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.calendar-day strong {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  display: block;
  margin: 4px 0;
}

.calendar-day em {
  font-size: 11px;
  font-style: normal;
  color: var(--accent-cyan);
  font-weight: 600;
}

