/* === ENTRY ANIMATIONS === */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes flashUpdate {
  0%   { border-bottom-color: rgba(244, 166, 28, 0.6); }
  100% { border-bottom-color: var(--glass-border); }
}

/* === DASHBOARD LAYOUT === */
.dash-container {
  position: relative;
  z-index: 1;
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px 56px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 100vh;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--glass-border);
  transition: border-bottom-color 0.3s ease;
}
.dash-header.flash-update {
  animation: flashUpdate 1.5s ease-out;
}

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

.dash-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dash-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-title {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
}

.dash-subtitle {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  color: var(--text-secondary);
  opacity: 0.7;
}

.dash-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

.dash-back-link {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 13px;
  color: var(--accent-cyan);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(244, 166, 28, 0.15);
  transition: all 0.2s ease;
}
.dash-back-link:hover {
  background: rgba(244, 166, 28, 0.08);
}

/* === KPI ROW === */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  width: 100%;
}

.kpi-card {
  background:
    radial-gradient(circle at top right, rgba(244, 166, 28, 0.08), transparent 60%),
    rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 24px;
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  min-width: 0;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  opacity: 0;
  animation: fadeSlideUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-card:nth-child(3) { animation-delay: 0.3s; }
.kpi-card:nth-child(4) { animation-delay: 0.4s; }

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
}
.kpi-card:hover {
  transform: translateY(-4px);
  border-color: rgba(244, 166, 28, 0.2);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2), 0 0 24px rgba(244, 166, 28, 0.04);
}

.kpi-icon-row {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.kpi-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(244, 166, 28, 0.06);
  border: 1px solid rgba(244, 166, 28, 0.1);
}

.kpi-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 44px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 6px;
  line-height: 1.1;
}

.kpi-label-ar {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.kpi-label-en {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  color: rgba(247, 242, 232, 0.4);
  direction: ltr;
  text-align: left;
}

/* === CHARTS ROW === */
.charts-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.dash-card {
  background:
    radial-gradient(ellipse at top right, rgba(244, 166, 28, 0.06), transparent 50%),
    radial-gradient(ellipse at bottom left, rgba(200, 27, 65, 0.04), transparent 50%),
    rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 28px;
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  opacity: 0;
  animation: scaleIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 0.5s;
}
.charts-row:nth-of-type(2) .dash-card { animation-delay: 0.5s; }
.charts-row:nth-of-type(3) .dash-card { animation-delay: 0.7s; }
.charts-row:nth-of-type(4) .dash-card { animation-delay: 0.9s; }
.charts-row:nth-of-type(5) .dash-card { animation-delay: 1.1s; }

.dash-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), var(--accent-blue), transparent);
  opacity: 0.4;
}

.dash-card:hover {
  transform: translateY(-4px);
  border-color: rgba(244, 166, 28, 0.15);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25), 0 0 30px rgba(244, 166, 28, 0.04);
}

.dash-card.wide-card {
  grid-column: span 2;
}

.dash-card-title {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dash-card-subtitle {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  color: var(--text-secondary);
  opacity: 0.6;
  margin-bottom: 24px;
}

/* === HORIZONTAL BAR CHART === */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 40px;
  align-items: center;
  gap: 12px;
}

.bar-label {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 28px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
  transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
  min-width: 4px;
}

.bar-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-cyan);
  text-align: center;
}

/* === PRODUCT CHART === */
.product-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-section-label {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 1px;
  margin-bottom: 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.product-bar-row .bar-label {
  font-weight: 700;
  color: var(--text-primary);
}

.product-fill {
  box-shadow: 0 0 12px rgba(244, 166, 28, 0.12);
}

/* === DONUT CHART === */
.donut-container {
  display: flex;
  align-items: center;
  gap: 24px;
  justify-content: center;
}

.donut-ring {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 0 40px rgba(244, 166, 28, 0.06);
}
.donut-ring::after {
  content: '';
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--bg-primary);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.donut-center-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 13px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-count {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-inline-start: auto;
}

/* === LANGUAGE SPLIT === */
.lang-split-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.lang-bar {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

.lang-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.lang-segment.ar-segment {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #221300;
}
.lang-segment.en-segment {
  background: rgba(200, 27, 65, 0.7);
  color: white;
}

.lang-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.lang-label-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.lang-label-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.lang-label-text {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 13px;
  color: var(--text-secondary);
}

/* === TIMELINE CHART === */
.timeline-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding-top: 16px;
  padding-bottom: 24px;
}

.timeline-bar {
  flex: 1;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--chart-timeline), rgba(56, 189, 248, 0.2));
  min-width: 8px;
  transition: height 1s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  cursor: default;
}
.timeline-bar:hover {
  filter: brightness(1.3);
  box-shadow: 0 -4px 16px rgba(56, 189, 248, 0.2);
}

.timeline-bar-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.timeline-bar-count {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--chart-timeline);
  font-weight: 600;
}

/* === QUALITY GAUGE === */
.quality-gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 8px;
}

.gauge-dial {
  width: 180px;
  height: 90px;
  position: relative;
  overflow: hidden;
}

.gauge-bg {
  position: absolute;
  inset: 0;
  border-radius: 180px 180px 0 0;
  background: rgba(255, 255, 255, 0.04);
  border: 3px solid rgba(255, 255, 255, 0.06);
  border-bottom: none;
}

.gauge-fill-arc {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 180px;
  height: 90px;
  border-radius: 180px 180px 0 0;
  background: conic-gradient(
    from 180deg at 50% 100%,
    #ef4444 0deg,
    #f4a61c 60deg,
    #4ade80 120deg,
    #14b8a6 180deg
  );
  clip-path: polygon(0 100%, 50% 100%, 50% 0, 0 0);
  transform-origin: 50% 100%;
  transform: rotate(var(--rotation, 0deg));
  transition: transform 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.gauge-center {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gauge-score {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.gauge-max {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
}

.gauge-label-text {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-cyan);
}

.gauge-breakdown {
  display: flex;
  gap: 24px;
}

.gauge-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.gauge-metric-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.gauge-metric-label {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 11px;
  color: var(--text-secondary);
}

/* === HIGH INTENT TABLE === */
.intent-table {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.intent-table-row {
  display: grid;
  grid-template-columns: 50px 1fr auto auto auto;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  align-items: center;
  transition: background 0.2s ease, transform 0.2s ease;
}
.intent-table-row:nth-child(odd) {
  background: rgba(255,255,255,0.01);
}
.intent-table-row:hover {
  background: rgba(244, 166, 28, 0.04);
  transform: scale(1.005);
}
.intent-table-row + .intent-table-row {
  border-top: 1px solid rgba(255,255,255,0.03);
}

.intent-row-lang {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  text-align: center;
}

.intent-row-title {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intent-row-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.intent-row-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(244, 166, 28, 0.08);
  color: var(--accent-cyan);
  white-space: nowrap;
}

/* === FOLLOW-UP LIST === */
.followup-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.followup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.03);
}

.followup-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-cyan);
  min-width: 28px;
  text-align: center;
}

.followup-text {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.dash-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 24px;
  font-size: 13px;
}

/* === RESPONSIVE === */
@media (max-width: 1100px) {
  .dash-container { padding: 24px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .dash-card.wide-card { grid-column: span 1; }
}

@media (max-width: 720px) {
  .dash-container { padding: 16px; }
  .kpi-row { grid-template-columns: 1fr; }
  .dash-header { flex-direction: column; gap: 16px; align-items: flex-start; }
  .bar-row { grid-template-columns: 100px 1fr 36px; }
}
