:root{
  --bg:#f6f8fb;
  --card:#fff;
  --accent:#0f6cff;
  --muted:#6b7280;
  --green:#10b981;
  --red:#ef4444;
  --gray:#6b7280;
  --orange:#f59e0b;
  --container-max: 1280px; /* default desktop container width */
}

body {
  font-family: Inter, system-ui, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: #0b1220;
  font-size: 12px;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden; /* kill horizontal scroll */
}

html { width: 100%; overflow-x: hidden; }
h1{
  margin: 0;
}

.wrap {
  width: 90%;
  max-width: var(--container-max);
  min-height: 100vh;
  padding: 20px;
  box-sizing: border-box;
  margin: 0 auto;   /* centers the container */
}

/* Header */
.header {
  display:flex;
  align-items:center;
  gap:20px;
  margin-bottom:10px;
}

.logo {
  width:115px;
  height:115px;
  background:none;
  border-radius:8px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:bold;
  color:#374151;
}

.header-info h1 {
  font-size:30px;
  font-weight:700;
  margin:0 0 4px 0;
  color:#111827;
}
.header-info {
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}
.header-info .subtitle {
  color:var(--muted);
  font-size:14px;
  margin-bottom: 10px;
}

.header-info-right{
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
}
.header-info-left {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  flex-direction: column;
}

/* ElevenLabs ConvAI Widget */
.convai-widget-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
}
.convai-widget-container elevenlabs-convai {
  width: 100%;
  max-width: 400px;
}

/* Top Stats Section */
.top-section {
  background:white;
  border-radius:12px;
  padding:24px;
  margin-bottom:24px;
  box-shadow:0 1px 3px rgba(0,0,0,0.1);
  display:flex;
  justify-content: space-around;
  gap:32px;
  width: 100%;
}

.total-reviews {
  text-align:left;
}
.total-reviews .number {
  font-size:20px;
  font-weight:500;
  color:#111827;
}
.total-reviews .label {
  color: #000000;
  font-size:20px;
  margin-right: 3px;
}

.overall-summary h3 {
  font-size:24px;
  font-weight:600;
  margin:0 0 12px 0;
  color:#111827;
  margin-top: 20px;
}
.summary-list {
  list-style:none;
  margin:0;
  padding:0;
  font-size:15px;
  line-height:1.5;
}
.summary-list li {
  margin-bottom:4px;
  color:#374151;
}
.summary-list li:before {
  content:"•";
  color:var(--muted);
  margin-right:8px;
}

.top-themes {
  min-width:200px;
  margin-top: 20px;
}
.top-themes h3 {
  font-size:16px;
  font-weight:600;
  margin:0 0 12px 0;
  color:#111827;
}
.theme-item {
  display:flex;
  justify-content:space-between;
  font-size:15px;
  margin-bottom:4px;
  color:#374151;
}

.pie-chart-container {
  width: 100%;
  max-width: 100%;
  height: 300px;
  overflow: hidden; /* prevent chart from overflowing */
}

/* Main Content Grid */
.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 32px;
  margin-bottom: 24px;
  width: 100%;
  box-sizing: border-box;
}

.main-grid > * { min-width: 0; }

.chart-section {
  width: 100%;
  flex: 3;
  background:white;
  border-radius:12px;
  padding:24px 12px 24px 12px;
  box-shadow:0 1px 3px rgba(0,0,0,0.1);
  min-height: 320px;
  height: clamp(320px, 45vw, 460px);
}

.chart-section canvas,
.pie-chart-container canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  object-fit: contain; /* ensure chart fits within container */
}

/* ✅ Sentiment Cards */
.sentiment-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* responsive 4 cards */
  gap: 20px;
  width: 100%;
  padding: 0 12px 0 12px;
  box-sizing: border-box;
}

.sentiment-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 180px;
}

.sentiment-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

/* Light background colors for each card */
.sentiment-card.positive { background-color: rgba(16, 185, 129, 0.1); }
.sentiment-card.negative { background-color: rgba(239, 68, 68, 0.1); }
.sentiment-card.neutral  { background-color: rgba(107, 114, 128, 0.1); }
.sentiment-card.doubtful { background-color: rgba(245, 158, 11, 0.1); }

/* Title */
.sentiment-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: #111827;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
}

/* Count */
.sentiment-card .count {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #000;
}

/* Percentage pill */
.sentiment-card .percentage {
  display: inline-block;
  background: #6b7280;
  border-radius: 50px;
  padding: 6px 12px;
  font-size: 13px;
  color: #fff;
  font-weight: 600;
}

/* Bottom Section */
.bottom-section {
  background:white;
  border-radius:12px;
  padding:24px;
  box-shadow:0 1px 3px rgba(0,0,0,0.1);
  width: 100%;
}

.section-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:20px;
}
.sentiment-card.active {
  border: 2px solid #000000; /* Adds a small blue border using the accent color */
}

.dimension-buttons {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:24px;
  justify-content: space-between;
}

.dim-btn {
  padding: 8px 16px;
  border-radius: 20px;
  background: #f3f4f6;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: #374151;
  transition: all 0.2s;
  flex: 1;
  text-align: center;
}
.dim-btn:hover {
  background:#e5e7eb;
}
.dim-btn.active {
  background:var(--accent);
  color:white;
  border-color:var(--accent);
}

.dimension-buttons {
  display: flex;
  justify-content: space-between;
  background: #fff;
  border-radius: 50px;
  padding: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.content-grid {
  display:grid;
  grid-template-columns:minmax(0, 1fr) minmax(280px, 520px);
  gap:32px;
}

.insights-section h4 {
  font-size:20px;
  font-weight:600;
  color:#494f5a;
  margin:0 0 8px 0;
  text-transform:uppercase;
  letter-spacing:0.5px;
}

.insights-content {
  font-size:16px;
  line-height:1.6;
  color:#374151;
  margin-bottom:24px;
}

.insights-list {
  list-style:none;
  margin:0 0 24px 0;
  padding:0;
}
.insights-list li {
  font-size:16px;
  line-height:1.5;
  color:#374151;
  margin-bottom:8px;
  padding-left:16px;
  position:relative;
}
.insights-list li:before {
  content:"•";
  color:var(--accent);
  position:absolute;
  left:0;
}

.reviews-container {
  background:#f9fafb;
  border-radius:8px;
  padding:16px;
  max-height:500px;
  overflow-y:auto;
}
.reviews-container h4 {
  font-size:14px;
  font-weight:600;
  color:var(--muted);
  margin:0 0 16px 0;
  text-transform:uppercase;
  letter-spacing:0.5px;
}
.review-item {
  background:white;
  border-radius:8px;
  padding:16px;
  margin-bottom:12px;
  border-left:3px solid #e5e7eb;
}
.review-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:8px;
}
.review-author {
  font-weight:600;
  color:#111827;
  font-size:14px;
}
.review-rating {
  color:var(--orange);
  font-size:12px;
}
.review-text {
  font-size:13px;
  line-height:1.5;
  color:#374151;
}
.review-date {
  font-size:11px;
  color:var(--muted);
  margin-top:8px;
}

.subtitle-start {
  display: flex;
  justify-content: flex-start;
}
.aligning {
  min-width: 300px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.note {
  display: block;
  margin-top:0px;
  font-size:15px;
  margin-bottom: 10px;
}

.side {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.count-side {
  display: flex;
  flex-direction: column;
}

/* Media Queries */
@media (max-width: 1200px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  .top-section {
    flex-wrap: wrap;
  }
  .top-section > * {
    flex: 1 1 100%;
  }
  .sentiment-cards {
    grid-template-columns: repeat(2, 1fr);
    grid-column: 1 / -1;
    padding-left: 16px;
    padding-right: 16px;
  }
  .content-grid {
    grid-template-columns:1fr;
  }
  .reviews-container {
    max-height: 420px;
  }
}

.title2 {
  display: none;
}
@media (max-width: 992px) {
  :root { --container-max: 900px; }
  .header { flex-direction: column; align-items: center; gap: 12px; }
  .header-info-left .title, .header-info-right .title1 { display: none !important; }
  .title2 { display: block; }
  .logo { width: 88px; height: 88px; }
  .pie-chart-container { height: 260px; }
  .dim-btn { font-size: 15px; }
  .sentiment-cards { grid-template-columns: repeat(2, 1fr); }
  .content-grid { display: flex; flex-direction: column; gap: 16px; }
}

@media (max-width: 768px) {
  :root { --container-max: 680px; }
  .top-section {
    flex-direction: column;
    gap: 16px;
  }
  .top-section > * { width: 100%; }
  .wrap { width: 94%; padding: 16px; }
  .header { flex-direction: column; align-items: center; gap: 12px; }
  /* .header-info { flex-direction: column; align-items: flex-start; gap: 8px; } */
  .header-info h1 { font-size: 20px; }
  .title2 { display: block; }
  .logo { width: 72px; height: 72px; }
  .sentiment-cards { grid-template-columns: 1fr; }
  .dimension-buttons {
    flex-wrap: wrap;
    border-radius: 16px;
    gap: 8px;
    justify-content: flex-start;
    width: 100%;
  }
  .dim-btn { flex: 1 1 100%; }
  .summary-list { font-size: 14px; }
  .insights-content { font-size: 15px; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .pie-chart-container { max-width: 100%; height: 220px; }
  .reviews-container { max-height: 50vh; }
  .convai-widget-container elevenlabs-convai { max-width: 280px; }
  
}

@media (max-width: 600px) {
  .review-header { flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media (max-width: 740px) {
  .wrap { width: 100%; padding-left: 16px; padding-right: 16px; }
  .top-section, .chart-section, .bottom-section { width: auto; }
  .top-themes { min-width: 0; }
  .pie-chart-container { max-width: 100%; height: 220px; }
  .content-grid { display: flex; flex-direction: column; gap: 16px; }
  .sentiment-cards { grid-template-columns: 1fr; }
  .title1 .title { display: none !important; }
}

/* Filter Section */
.filter-section {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

.filter-header h3 {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.filter-status {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.filter-status.active {
  color: var(--accent);
}

.filter-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.filter-input, .filter-select {
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  color: #111827;
  background: white;
  transition: border-color 0.2s;
}

.filter-input:focus, .filter-select:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-buttons {
  display: flex;
  gap: 12px;
}

.btn-primary, .btn-secondary {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: #0c5fd7;
}

.btn-primary:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.filter-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px;
  background: #f0f9ff;
  border-radius: 8px;
  color: var(--accent);
  font-size: 14px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #e0f2fe;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  .filter-controls {
    grid-template-columns: 1fr;
  }
  
  .filter-buttons {
    flex-direction: column;
  }
  
  .btn-primary, .btn-secondary {
    width: 100%;
  }
}

.fullscreen-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5); /* Semi-transparent black overlay */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000; /* Above ConvAI widget (z-index: 1000) */
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s linear 0.3s, opacity 0.3s ease;
}

.fullscreen-loader.active {
  visibility: visible;
  opacity: 1;
  transition: visibility 0s, opacity 0.3s ease;
}

.fullscreen-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0f2fe;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}