/* ════════════════════════════════════════════ */
/* CUSTOMER 360 & LIVE CALL MONITOR            */
/* Uses design system variables from style.css */
/* ════════════════════════════════════════════ */

/* ── Modal Overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 16, 32, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal-overlay.hidden { display: none !important; }

.modal-360 {
  background: rgba(8, 16, 32, 0.88);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  padding: 36px;
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: modal360In 0.3s ease;
}

@keyframes modal360In {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 16px; right: 20px;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}
.modal-close:hover {
  background: rgba(91, 181, 162, 0.15);
  color: var(--text-primary);
}


/* ── Customer 360 Header ── */
.c360-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-medium);
  margin-bottom: 24px;
}

.c360-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-seafoam), var(--ocean-mid));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 600;
  color: white;
  flex-shrink: 0;
  font-family: var(--font-serif);
  letter-spacing: 1px;
}

.c360-name-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.c360-name-block h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}

#c360-segment {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 12px;
  display: inline-block;
  width: fit-content;
}
.seg-vip { background: rgba(200, 168, 78, 0.15); color: var(--accent-gold); }
.seg-active, .seg-active-high-value { background: rgba(91, 181, 162, 0.12); color: var(--accent-seafoam); }
.seg-new { background: rgba(135, 206, 235, 0.15); color: var(--ocean-light); }
.seg-at-risk { background: rgba(232, 116, 97, 0.12); color: var(--accent-coral); }
.seg-lapsed { background: rgba(155, 149, 144, 0.12); color: var(--medium-gray); }
.seg-one-time { background: rgba(45, 122, 79, 0.1); color: var(--palm); }

#c360-location {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.c360-ltv { text-align: right; flex-shrink: 0; }
.c360-ltv-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.c360-ltv-value {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 500;
  color: var(--text-value);
}


/* ── Quick Stats ── */
.c360-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.c360-stat {
  background: rgba(91, 181, 162, 0.08);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.c360-stat-val {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--text-value);
}

.c360-stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}


/* ── Sections ── */
.c360-section { margin-bottom: 28px; }

.c360-section h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-medium);
}

.c360-empty {
  text-align: center;
  padding: 20px;
  color: var(--text-tertiary);
  font-size: 0.88rem;
  font-style: italic;
}


/* ── Style DNA Bars ── */
.style-dna-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dna-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dna-label {
  min-width: 90px;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.dna-track {
  flex: 1;
  height: 10px;
  background: rgba(91, 181, 162, 0.08);
  border-radius: 5px;
  overflow: hidden;
}

.dna-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.8s ease;
}

.dna-pct {
  min-width: 36px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: right;
}


/* ── Purchase Timeline ── */
.purchase-timeline {
  padding-left: 20px;
  border-left: 2px solid rgba(91, 181, 162, 0.2);
  max-height: 300px;
  overflow-y: auto;
}

.purchase-item {
  position: relative;
  padding: 0 0 18px 20px;
}
.purchase-item:last-child { padding-bottom: 0; }

.purchase-dot {
  position: absolute;
  left: -27px; top: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent-seafoam);
  border: 2px solid rgba(8, 16, 32, 0.8);
}

.purchase-content {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.purchase-date { font-size: 0.78rem; color: var(--text-secondary); min-width: 100px; }
.purchase-product { font-size: 0.9rem; font-weight: 500; color: var(--text-primary); }
.purchase-price { font-family: var(--font-serif); font-size: 1rem; color: var(--text-value); }
.purchase-collection {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(232, 180, 78, 0.1);
  color: var(--accent-gold);
}


/* ── Communication Log ── */
.comms-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
}

.comm-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(91, 181, 162, 0.06);
  border-radius: 10px;
  transition: var(--transition);
}
.comm-item:hover { background: rgba(91, 181, 162, 0.12); }

.comm-icon { font-size: 1.2rem; flex-shrink: 0; padding-top: 2px; }
.comm-content { flex: 1; }
.comm-date { font-size: 0.75rem; color: var(--text-secondary); }
.comm-summary { font-size: 0.88rem; color: var(--text-primary); margin-top: 2px; }
.comm-outcome { margin-top: 4px; display: inline-block; }
.comm-duration { font-size: 0.78rem; color: var(--text-tertiary); flex-shrink: 0; }


/* ── Collection Box History ── */
.cb-card {
  padding: 14px 16px;
  background: rgba(91, 181, 162, 0.06);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  margin-bottom: 10px;
}

.cb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.cb-date { font-size: 0.82rem; color: var(--text-secondary); }
.cb-items { font-size: 0.88rem; color: var(--text-primary); margin-bottom: 4px; }
.cb-value { font-family: var(--font-serif); font-size: 1.05rem; color: var(--text-value); }


/* ── Next Best Action ── */
.next-action {
  padding: 20px;
  border-radius: 14px;
  border-left: 4px solid;
}

.next-action-seafoam { background: rgba(91, 181, 162, 0.08); border-left-color: var(--accent-seafoam); }
.next-action-gold { background: rgba(232, 180, 78, 0.08); border-left-color: var(--accent-gold); }
.next-action-coral { background: rgba(232, 116, 97, 0.08); border-left-color: var(--accent-coral); }

.next-action-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.next-action-type { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); }
.next-action-urgency { font-size: 0.72rem; text-transform: uppercase; }
.next-action-text { font-size: 0.95rem; color: rgba(242, 232, 213, 0.85); line-height: 1.5; }
.next-action-reason { font-size: 0.82rem; color: var(--text-secondary); margin-top: 8px; font-style: italic; }


/* ── Recommended Pieces ── */
.recommended-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.rec-card {
  text-align: center;
  padding: 14px;
  background: rgba(10, 22, 40, 0.6);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  transition: var(--transition);
}
.rec-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.rec-image {
  width: 100%; height: 120px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}

.rec-image-placeholder {
  width: 100%; height: 120px;
  background: linear-gradient(135deg, rgba(242, 232, 213, 0.1), rgba(91, 181, 162, 0.15));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.rec-name { font-size: 0.85rem; font-weight: 500; color: var(--text-primary); margin-bottom: 4px; }
.rec-price { font-family: var(--font-serif); font-size: 1rem; color: var(--text-value); }
.rec-match { font-size: 0.72rem; color: var(--accent-seafoam); margin-top: 4px; }


/* ════════════════════════════════════════════ */
/* LIVE CALL MONITOR                           */
/* ════════════════════════════════════════════ */

/* ── Live Indicator ── */
.live-calls-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(232, 116, 97, 0.08);
  border: 1px solid rgba(232, 116, 97, 0.2);
  border-radius: var(--radius-pill);
  margin-left: 16px;
}

.live-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-coral);
  animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(232, 116, 97, 0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(232, 116, 97, 0); }
}

.live-text {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-coral);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.live-btn {
  padding: 4px 12px;
  background: var(--accent-coral);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.live-btn:hover { background: #d4634f; }

/* ── Live Panel ── */
.live-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px;
  background: rgba(8, 16, 32, 0.92);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: 1px solid var(--border-medium);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.2);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.live-panel.hidden { display: none !important; }
.live-panel.slide-in { transform: translateX(0); }

.live-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-medium);
}

.live-panel-header h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-primary);
  margin: 0;
}

/* ── Live Call Info ── */
.live-call-info {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--border-medium);
}

.live-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.live-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.live-field span:last-child {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* ── Live Transcript ── */
.live-transcript {
  flex: 1;
  padding: 16px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transcript-placeholder {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.88rem;
  padding: 40px 0;
  font-style: italic;
}

.transcript-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: bubbleIn 0.2s ease;
}

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

.agent-bubble {
  align-self: flex-start;
  background: rgba(91, 181, 162, 0.15);
  border-bottom-left-radius: 4px;
}

.customer-bubble {
  align-self: flex-end;
  background: rgba(232, 180, 78, 0.15);
  border-bottom-right-radius: 4px;
}

.transcript-role {
  font-size: 0.68rem;
  color: var(--medium-gray);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
}

.agent-bubble .transcript-role { color: var(--accent-seafoam); }
.customer-bubble .transcript-role { color: var(--accent-gold); }

.transcript-text {
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.4;
}


/* ── Responsive ── */
@media (max-width: 768px) {
  .modal-360 {
    padding: 24px 20px;
    margin: 10px;
  }

  .c360-header {
    flex-direction: column;
    text-align: center;
  }

  .c360-ltv { text-align: center; }
  .c360-stats { grid-template-columns: repeat(3, 1fr); }
  .live-panel { width: 100%; }
  .recommended-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .c360-stats { grid-template-columns: repeat(2, 1fr); }
}


/* ── Print ── */
@media print {
  .modal-overlay { background: white; }
  .modal-360 {
    background: white !important;
    border: 1px solid #ddd !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
  }
  .live-panel { display: none; }
}
