/* Dashboard Styles */
:root {
  --primary-color: #2196f3;
  --success-color: #4caf50;
  --warning-color: #ff9800;
  --danger-color: #f44336;
  --neutral-color: #9e9e9e;
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --card-hover-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

.dashboard-container {
  min-height: 100vh;
}

/* Header */
.dashboard-header {
  background: var(--bg-gradient);
  color: white;
  padding: 30px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.header-left h1 {
  font-size: 2rem;
  margin-bottom: 5px;
}

.header-subtitle {
  font-size: 1rem;
  opacity: 0.9;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.date-filter {
  background: rgba(255, 255, 255, 0.2);
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.filter-icon {
  margin-right: 8px;
}

.btn-refresh {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  padding: 10px 15px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s;
}

.btn-refresh:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(180deg);
}

/* Main Content */
.dashboard-main {
  padding: 30px 40px;
  max-width: 1600px;
  margin: 0 auto;
}

.section-title {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: #333;
}

/* Stats Section */
.stats-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 3rem;
  opacity: 0.8;
}

.stat-content {
  flex: 1;
}

.stat-content h3 {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 5px;
}

.stat-percentage {
  font-size: 1.2rem;
  color: #666;
}

.stat-trend {
  font-size: 0.85rem;
  color: #666;
  display: flex;
  align-items: center;
  gap: 5px;
}

.trend-icon {
  color: var(--success-color);
}

.stat-chart {
  width: 100px;
  height: 60px;
}

/* Quality Section */
.quality-section {
  margin-bottom: 30px;
}

.quality-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: var(--card-shadow);
  transition: all 0.3s;
}

.card:hover {
  box-shadow: var(--card-hover-shadow);
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 20px;
  color: #333;
}

.satisfaction-score {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.score-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: var(--bg-gradient);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.score-value {
  font-size: 3rem;
  font-weight: 700;
}

.score-max {
  font-size: 1.2rem;
  opacity: 0.8;
}

/* Insights Section */
.insights-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.wordcloud-card #wordCloud {
  min-height: 300px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#recommendationsList {
  max-height: 400px;
  overflow-y: auto;
}

.recommendation-item {
  padding: 15px;
  border-left: 4px solid var(--primary-color);
  background: #f5f5f5;
  margin-bottom: 12px;
  border-radius: 4px;
}

.recommendation-item.high {
  border-left-color: var(--danger-color);
  background: #ffebee;
}

.recommendation-item.medium {
  border-left-color: var(--warning-color);
  background: #fff3e0;
}

.recommendation-item.low {
  border-left-color: var(--success-color);
  background: #e8f5e9;
}

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

.recommendation-category {
  font-weight: 600;
  text-transform: capitalize;
}

.recommendation-priority {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.recommendation-priority.high {
  background: var(--danger-color);
  color: white;
}

.recommendation-priority.medium {
  background: var(--warning-color);
  color: white;
}

.recommendation-priority.low {
  background: var(--success-color);
  color: white;
}

.recommendation-text {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.5;
}

.recommendation-affected {
  font-size: 0.8rem;
  color: #999;
  margin-top: 5px;
}

/* Conversations Section */
.conversations-section {
  margin-bottom: 30px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.filters {
  display: flex;
  gap: 10px;
}

.filter-select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s;
}

.filter-select:hover {
  border-color: var(--primary-color);
}

.table-wrapper {
  overflow-x: auto;
}

.conversations-table {
  width: 100%;
  border-collapse: collapse;
}

.conversations-table th {
  background: #f5f5f5;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #555;
  border-bottom: 2px solid #ddd;
}

.conversations-table td {
  padding: 12px;
  border-bottom: 1px solid #eee;
}

.conversations-table tbody tr:hover {
  background: #f9f9f9;
}

.loading-row {
  text-align: center;
  padding: 40px !important;
  color: #999;
}

.rating-stars {
  color: #ffc107;
  font-size: 1.1rem;
}

.sentiment-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.sentiment-badge.positive {
  background: #e8f5e9;
  color: #2e7d32;
}

.sentiment-badge.neutral {
  background: #e3f2fd;
  color: #1976d2;
}

.sentiment-badge.negative {
  background: #ffebee;
  color: #c62828;
}

.btn-view {
  padding: 6px 12px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.3s;
}

.btn-view:hover {
  background: #1976d2;
  transform: translateY(-1px);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.pagination button {
  padding: 8px 12px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
}

.pagination button:hover:not(:disabled) {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination button.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s;
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s;
}

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

.modal-header {
  padding: 20px 25px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #999;
  transition: all 0.3s;
}

.modal-close:hover {
  color: #333;
  transform: rotate(90deg);
}

.modal-body {
  padding: 25px;
}

.conversation-turn {
  margin-bottom: 20px;
  padding: 15px;
  border-radius: 8px;
  background: #f9f9f9;
}

.turn-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 600;
}

.turn-speaker {
  color: var(--primary-color);
}

.turn-time {
  color: #999;
  font-size: 0.85rem;
}

.turn-text {
  line-height: 1.6;
  color: #555;
}

.loading {
  text-align: center;
  padding: 20px;
  color: #999;
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .dashboard-main {
    padding: 20px;
  }

  .stats-section,
  .quality-grid,
  .insights-section {
    grid-template-columns: 1fr;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

