/* ==========================================================================
   MMG Talkadot Sync Pro – Front-End Styles
   ========================================================================== */

:root {
  --tdot-font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --tdot-text-color: #222;
  --tdot-muted-color: #555;
  --tdot-border-color: #e4e8ec;
  --tdot-bg-color: #fff;
  --tdot-accent-color: #0096d6;
  --tdot-accent-light: #00c2a8;
  --tdot-testimonial-bg: #f3f4f6;
}

/* -------------------------- Base Widget Container ------------------------ */

.tdot-widget {
  font-family: var(--tdot-font-family);
  color: var(--tdot-text-color);
  background: var(--tdot-bg-color);
  border: 1px solid var(--tdot-border-color);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  padding: 1.25em;
  margin: 1.5em auto;
  text-align: center;
}

/* ----------------------------- Testimonials ----------------------------- */

.tdot-testimonials-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
  align-items: stretch;
  gap: 1.75rem;
  margin: 2em 0;
  font-family: var(--tdot-font-family, inherit);
}

.tdot-testimonial-card {
  min-width: 0;
  display: flex;
  height: 100%;
}

.tdot-testimonial-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 280px;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 2rem 2rem 1.75rem;
  background: var(--tdot-testimonial-bg, #f3f4f6);
  border: 1px solid #eceef1;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
  overflow: hidden;
}

.tdot-quote-mark {
  position: absolute;
  font-family: Georgia, serif;
  font-size: 5rem;
  line-height: 1;
  color: #cfd5de;
  pointer-events: none;
  user-select: none;
}

.tdot-quote-mark--open {
  top: 14px;
  left: 18px;
}

.tdot-quote-mark--close {
  right: 18px;
  bottom: 6px;
}

.tdot-quote-text {
  position: relative;
  z-index: 1;
  padding-top: 1.2rem;
  margin-bottom: 2rem;
  font-size: 1rem;
  line-height: 1.7;
  color: #222;
  word-wrap: break-word;
}

.tdot-testimonial-person {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: auto;
}

.tdot-avatar {
  position: relative;
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  border-radius: 50%;
  background: linear-gradient(135deg,
  var(--tdot-accent-color, #0096d6),
  var(--tdot-accent-light, #00b0ff)
);
  overflow: hidden;
}

.tdot-avatar-head {
  position: absolute;
  top: 22px;
  left: 50%;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  transform: translateX(-50%);
}

.tdot-avatar-body {
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 42px;
  height: 28px;
  background: #ffffff;
  border-radius: 50% 50% 0 0;
  transform: translateX(-50%);
}

.tdot-person-meta {
  min-width: 0;
}

.tdot-person-name {
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.35;
  color: #222;
}

/* 2-column */
@media (min-width: 768px) {
  .tdot-testimonials-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 3-column */
@media (min-width: 1100px) {
  .tdot-testimonials-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ==========================================================================
   Global Chart Widget Layout (Talkadot Dashboard Style + Unified Sizing)
   ========================================================================== */

.tdot-chart-widget {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  border: 1px solid var(--tdot-border-color, #e5e8eb);
  border-radius: 8px;
  padding: 1.25em 1.5em 1.5em;
  background: var(--tdot-bg-color, #fff);
  font-family: var(--tdot-font-family, system-ui, sans-serif);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  width: 100%;
  max-width: 360px;
  min-height: 320px;
  height: 100%;
  margin: 1.5em auto;
  box-sizing: border-box;
}

/* Header (top of card) */
.tdot-chart-widget .tdot-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.4em;
  margin-bottom: 0.75em;
  min-height: 52px;
}

.tdot-chart-widget .tdot-chart-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.2;
  color: var(--tdot-text-color, #000);
}

.tdot-chart-widget .tdot-chart-icon {
  font-size: 1.1rem;
  display: inline-block;
}

.tdot-chart-widget .tdot-chart-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0;
  color: var(--tdot-text-color, #000);
}

.tdot-chart-widget .tdot-chart-subtext {
  font-size: 0.85rem;
  color: #555;
  line-height: 1.45;
  min-height: 48px;
  margin: 0;
}

/* Body (chart + values row) */
.tdot-chart-body {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 0.75em;
  flex-wrap: wrap;
  text-align: center;
}

.tdot-chart-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--tdot-text-color, #000);
}

.tdot-chart-label {
  font-size: 0.9rem;
  color: #444;
}

/* Chart Canvas (unified sizing) */
.tdot-chart-canvas {
  flex: 0 0 auto;
  width: 160px;
  height: 160px;
  min-height: 160px;
  text-align: center;
  margin: 0.25em auto 0.75em;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tdot-chart-canvas canvas {
  width: 160px !important;
  height: 160px !important;
}

/* Compare Widget Variant */
.tdot-chart--compare .tdot-chart-body {
  justify-content: space-between;
  text-align: center;
}

.tdot-chart--compare .tdot-chart-canvas {
  width: 140px;
  height: 140px;
}

.tdot-chart--compare .tdot-chart-canvas canvas {
  width: 140px !important;
  height: 140px !important;
}

.tdot-chart--compare .tdot-left,
.tdot-chart--compare .tdot-right {
  flex: 1;
}

.tdot-chart--compare .tdot-left {
  text-align: right;
  padding-right: 0.5em;
}

.tdot-chart--compare .tdot-right {
  text-align: left;
  padding-left: 0.5em;
}

/* ==========================================================================
   Optional Chart Grid Layout (for multi-card rows)
   ========================================================================== */

.tdot-chart-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25em;
}

@media (max-width: 1200px) {
  .tdot-chart-widget {
    max-width: 320px;
    min-height: 200px;
  }
}

@media (max-width: 900px) {
  .tdot-chart-grid {
    justify-content: space-around;
  }
}

@media (max-width: 600px) {
  .tdot-chart-widget {
    width: 100%;
    max-width: 100%;
    min-height: auto;
    padding: 1em;
  }

  .tdot-chart-body {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .tdot-chart-canvas,
  .tdot-chart-canvas canvas {
    width: 140px !important;
    height: 140px !important;
  }

  .tdot-chart--compare .tdot-left,
  .tdot-chart--compare .tdot-right {
    text-align: center;
    padding: 0;
  }
}

/* ==========================================================================
   Engagement Breakdown Widget
   ========================================================================== */

.tdot-engagement {
  font-family: var(--tdot-font-family, system-ui, sans-serif);
  max-width: 500px;
  margin: 1.5em auto;
  background: var(--tdot-bg-color, #fff);
  border: 1px solid var(--tdot-border-color, #e5e8eb);
  border-radius: 8px;
  padding: 1.25em 1.5em;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.tdot-engagement .tdot-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75em;
  border-bottom: 3px solid var(--tdot-accent-color, #0096d6);
  padding-bottom: 0.25em;
  color: var(--tdot-text-color, #000);
  text-align: left;
}

.tdot-engagement-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.tdot-engagement .tdot-row {
  display: flex;
  align-items: center;
  gap: 0.75em;
}

.tdot-engagement .tdot-label {
  flex: 0 0 120px;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--tdot-text-color, #000);
}

.tdot-engagement .tdot-bar {
  flex: 1;
  height: 10px;
  background: var(--tdot-track-color, #e4e8ec);
  border-radius: 6px;
  overflow: hidden;
}

.tdot-engagement .tdot-fill {
  height: 100%;
  background: linear-gradient(
    to right,
    var(--tdot-accent-color, #0096d6),
    var(--tdot-accent-light, #00b0ff)
  );
  border-radius: 6px;
  transition: width 0.5s ease;
}

.tdot-engagement .tdot-val {
  flex: 0 0 40px;
  text-align: right;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--tdot-text-color, #000);
}

/* Small screens */
@media (max-width: 480px) {
  .tdot-engagement .tdot-label {
    flex: 0 0 100px;
    font-size: 0.9rem;
  }
  .tdot-engagement .tdot-val {
    flex: 0 0 32px;
    font-size: 0.9rem;
  }
}

/* ------------------------- Placeholder Messages -------------------------- */

.tdot-placeholder {
  text-align: center;
  color: var(--tdot-muted-color);
  font-style: italic;
}

/* ------------------------- Tool Tip -------------------------- */
.tdot-tooltip {
  position: relative;
  cursor: help;
}

.tdot-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #111;
  color: #fff;
  padding: 6px 10px;
  font-size: 0.75rem;
  line-height: 1.3;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 1000;
}

.tdot-tooltip::before {
  content: '';
  position: absolute;
  bottom: 115%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #111 transparent transparent transparent;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.tdot-tooltip:hover::after,
.tdot-tooltip:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
