/**
 * Styles - Métriques de conversation WhatsApp
 * Style SaaS-like (dark theme, cards, badges)
 */

/* Modal overlay */
.metrics-modal-overlay,
.details-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

/* Modal content */
.metrics-modal-content,
.details-modal-content {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.metrics-modal-content {
  width: 900px;
}

.details-modal-content {
  width: 600px;
}

/* Modal header */
.metrics-modal-header,
.details-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #333;
  background: #222;
}

.metrics-modal-header h3,
.details-modal-header h3 {
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.btn-close {
  background: none;
  border: none;
  color: #999;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-close:hover {
  background: #333;
  color: #fff;
}

/* Loading state */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  color: #999;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top: 3px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* KPI Cards */
.kpi-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 24px;
  background: #1a1a1a;
}

.kpi-card {
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.kpi-label {
  color: #999;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.kpi-value {
  color: #fff;
  font-size: 24px;
  font-weight: 700;
}

/* Contacts section */
.contacts-section {
  padding: 0 24px 24px;
}

.contacts-section h4 {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px 0;
}

/* Table */
.contacts-table {
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  overflow: hidden;
}

.table-header {
  display: grid;
  grid-template-columns: 180px 120px 100px 100px 80px 80px 80px;
  background: #333;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table-header > div,
.table-row > div {
  padding: 12px 16px;
  border-right: 1px solid #333;
}

.table-header > div:last-child,
.table-row > div:last-child {
  border-right: none;
}

.table-body {
  max-height: 400px;
  overflow-y: auto;
}

.table-row {
  display: grid;
  grid-template-columns: 180px 120px 100px 100px 80px 80px 80px;
  border-bottom: 1px solid #333;
  align-items: center;
  transition: background 0.2s;
}

.table-row:hover {
  background: #2a2a2a;
}

/* Contact cell */
.contact-name {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.contact-number {
  color: #999;
  font-size: 12px;
  font-family: monospace;
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.status-badge.pending {
  background: #333;
  color: #999;
}

.status-badge.read {
  background: #1e40af;
  color: #93c5fd;
}

.status-badge.responded {
  background: #059669;
  color: #86efac;
}

/* Response cell */
.response-cell {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

/* Type cell */
.type-cell {
  color: #999;
  font-size: 13px;
}

/* Delay cell */
.delay-cell {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

/* Action cell */
.btn-view-details {
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-view-details:hover {
  background: #0056b3;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 40px;
  color: #999;
}

/* Contact details modal */
.contact-info {
  padding: 20px 24px;
  border-bottom: 1px solid #333;
  background: #222;
}

.contact-number {
  color: #fff;
  font-family: monospace;
  font-size: 16px;
  margin-bottom: 4px;
}

.contact-status {
  color: #999;
  font-size: 14px;
}

/* Timeline */
.conversation-timeline {
  padding: 24px;
  max-height: 400px;
  overflow-y: auto;
}

.conversation-timeline h4 {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 20px 0;
}

.timeline-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeline-item {
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 16px;
}

.timeline-time {
  color: #999;
  font-size: 12px;
  font-family: monospace;
  margin-bottom: 8px;
}

.timeline-event {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.timeline-icon {
  font-size: 16px;
}

.timeline-label {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

/* Event content */
.event-content {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 12px;
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  margin-top: 8px;
}

.event-media {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: #999;
  font-size: 14px;
}

.btn-play {
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-play:hover {
  background: #047857;
}

/* Response summary */
.response-summary {
  padding: 24px;
  border-top: 1px solid #333;
  background: #222;
}

.response-summary h4 {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px 0;
}

.response-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.response-info div {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 12px;
}

.response-info strong {
  color: #999;
  font-size: 12px;
  display: block;
  margin-bottom: 4px;
}

.response-info span {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.response-content,
.response-media {
  margin-top: 20px;
}

.response-content h5,
.response-media h5 {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px 0;
}

.content-box {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 16px;
  color: #fff;
  font-size: 14px;
  line-height: 1.6;
}

.no-response {
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
  .metrics-modal-content {
    width: 95vw;
    max-height: 95vh;
  }
  
  .kpi-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
  }
  
  .table-header,
  .table-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .table-header > div,
  .table-row > div {
    border-right: none;
    border-bottom: 1px solid #333;
    padding: 8px 12px;
  }
  
  .table-header > div:last-child,
  .table-row > div:last-child {
    border-bottom: none;
  }
  
  .response-info {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* Scrollbar */
.contacts-table .table-body::-webkit-scrollbar,
.conversation-timeline::-webkit-scrollbar {
  width: 6px;
}

.contacts-table .table-body::-webkit-scrollbar-track,
.conversation-timeline::-webkit-scrollbar-track {
  background: #1a1a1a;
}

.contacts-table .table-body::-webkit-scrollbar-thumb,
.conversation-timeline::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

.contacts-table .table-body::-webkit-scrollbar-thumb:hover,
.conversation-timeline::-webkit-scrollbar-thumb:hover {
  background: #444;
}
