/* ----- Layout ----- */
.sio-oio-ca-wrapper {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
  width: 100%;
}

/* ----- Percentage cards row (same design as dashboard stat cards) ----- */
.sio-oio-ca-percentage-cards {
  flex: 1 1 52%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  width: 100%;
}

@media (max-width: 900px) {
  .sio-oio-ca-percentage-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sio-oio-ca-percentage-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .sio-oio-ca-percentage-cards {
    grid-template-columns: 1fr;
    gap: 0.625rem;
  }
}

/* SIO PA % card: span full width of the percentage-cards area */
.sio-oio-ca-percentage-cards .sio-oio-ca-pct-card--full-width {
  grid-column: 1 / -1;
}

/* ----- Card base (premium style) ----- */
.sio-oio-ca-card {
  min-height: 340px;
  display: flex;
  flex-direction: column;
  position: relative;
  border-radius: 16px;
  padding: 1.5rem 1.5rem 1.25rem;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.04),
    0 6px 16px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.25s ease, transform 0.2s ease, border-color 0.2s ease;
}

/* Observation types pie chart: take more width in the row */
.sio-oio-ca-wrapper .sio-oio-ca-pie-container {
  flex: 1 1 58%;
  min-width: 0;
}

.sio-oio-ca-card:hover {
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.08);
  border-color: rgba(203, 213, 225, 0.9);
  transform: translateY(-3px);
}

.sio-oio-ca-card:focus-visible {
  outline: 2px solid var(--primary-color, #2563eb);
  outline-offset: 2px;
}

.sio-oio-ca-clickable {
  cursor: pointer;
}

/* ----- Card header (icon + title + subtitle) ----- */
.sio-oio-ca-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

.sio-oio-ca-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
}

.sio-oio-ca-card-icon--pie {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.sio-oio-ca-card-icon--bar {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
}

.sio-oio-ca-card-heading {
  flex: 1;
  min-width: 0;
}

.sio-oio-ca-pie-title,
.sio-oio-ca-pa-title {
  margin: 0 0 0.35rem 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary, #0f172a);
  line-height: 1.3;
}

.sio-oio-ca-pie-subtitle,
.sio-oio-ca-pa-subtitle {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary, #64748b);
}

.sio-oio-ca-pie-subtitle strong,
.sio-oio-ca-pa-subtitle strong {
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}

/* ----- Pie chart area ----- */
.sio-oio-ca-pie-chart-wrap {
  flex: 1;
  min-height: 260px;
  width: 100%;
}

.sio-oio-ca-pie-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.sio-oio-ca-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: 1.25rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary, #475569);
}

.sio-oio-ca-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* ----- Bar chart area ----- */
.sio-oio-ca-pa-bar-wrap {
  flex: 1;
  min-height: 260px;
  width: 100%;
}

/* ----- Bar tooltip ----- */
.sio-pa-bar-tooltip {
  padding: 0.6rem 1rem;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.08),
    0 10px 20px -4px rgba(0, 0, 0, 0.1);
  font-size: 0.8125rem;
  min-width: 140px;
}

.sio-pa-bar-tooltip-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.sio-pa-bar-tooltip-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}

.sio-pa-bar-tooltip-pct {
  font-weight: 600;
  color: #64748b;
  font-size: 0.9em;
}

.sio-pa-bar-tooltip-hint {
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: #94a3b8;
}

/* ----- Night mode ----- */
.night-mode .sio-oio-ca-card {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.night-mode .sio-oio-ca-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.18);
}

.night-mode .sio-oio-ca-card-header {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

.night-mode .sio-oio-ca-card-icon--pie {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.9) 0%, rgba(37, 99, 235, 0.9) 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.night-mode .sio-oio-ca-card-icon--bar {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.9) 0%, rgba(5, 150, 105, 0.9) 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.night-mode .sio-oio-ca-pie-title,
.night-mode .sio-oio-ca-pa-title {
  color: rgba(255, 255, 255, 0.98);
}

.night-mode .sio-oio-ca-pie-subtitle,
.night-mode .sio-oio-ca-pa-subtitle {
  color: rgba(255, 255, 255, 0.75);
}

.night-mode .sio-oio-ca-pie-subtitle strong,
.night-mode .sio-oio-ca-pa-subtitle strong {
  color: rgba(255, 255, 255, 0.95);
}

.night-mode .sio-oio-ca-legend-item {
  color: rgba(255, 255, 255, 0.85);
}

.night-mode .sio-pa-bar-tooltip {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.night-mode .sio-pa-bar-tooltip-label {
  color: rgba(255, 255, 255, 0.7);
}

.night-mode .sio-pa-bar-tooltip-value {
  color: rgba(255, 255, 255, 0.98);
}

.night-mode .sio-pa-bar-tooltip-pct {
  color: rgba(255, 255, 255, 0.7);
}

.night-mode .sio-pa-bar-tooltip-hint {
  color: rgba(255, 255, 255, 0.5);
}

/* Recharts in night mode */
.night-mode .sio-oio-ca-card .recharts-text,
.night-mode .sio-oio-ca-card .recharts-cartesian-axis-tick-value {
  fill: rgba(255, 255, 255, 0.9) !important;
}

.night-mode .sio-oio-ca-card .recharts-xAxis .recharts-line,
.night-mode .sio-oio-ca-card .recharts-yAxis .recharts-line {
  stroke: rgba(255, 255, 255, 0.35) !important;
}

.night-mode .sio-oio-ca-card .recharts-cartesian-grid line {
  stroke: rgba(255, 255, 255, 0.15) !important;
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
  .sio-oio-ca-card {
    min-height: 300px;
    padding: 1.25rem 1rem 1rem;
  }

  .sio-oio-ca-card-header {
    margin-bottom: 0.875rem;
    padding-bottom: 0.875rem;
  }

  .sio-oio-ca-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .sio-oio-ca-card-icon svg {
    width: 20px;
    height: 20px;
  }

  .sio-oio-ca-pie-title,
  .sio-oio-ca-pa-title {
    font-size: 1.05rem;
  }

  .sio-oio-ca-pie-chart-wrap,
  .sio-oio-ca-pa-bar-wrap {
    min-height: 220px;
  }

  .sio-oio-ca-legend-item {
    font-size: 0.75rem;
    margin-right: 0.75rem;
  }
}
