/* ==========================================================================
   ISLAMI COMICS - ANALYTICS ROOM STYLESHEET
   Matching Mockup Image 8 Pixel-Perfect Design
   ========================================================================== */

.analytics-page-body {
  background-color: #f5f8f6;
}

.analytics-main-stage {
  padding-bottom: 40px;
}

/* Header Actions */
.analytics-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-analytics-date-range {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.2s;
}

.btn-analytics-date-range:hover {
  border-color: var(--emerald);
}

.btn-analytics-export {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}

.btn-analytics-export:hover {
  border-color: var(--emerald);
  color: var(--emerald-dark);
  background: #f8faf9;
}

/* ==========================================================================
   1. TOP 5 METRIC CARDS WITH MINI SPARKLINES
   ========================================================================== */
.analytics-metrics-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.analytics-metric-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.analytics-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
}

.card-head-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.card-title-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
  white-space: nowrap;
}

.icon-emerald-chart {
  background: #f0fdf4;
  color: #047857;
}

.metric-big-num {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.4px;
  margin-bottom: 8px;
}

.metric-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  gap: 6px;
}

.growth-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
}

.growth-badge.growth-up {
  color: #10b981;
}

.sparkline-wrap {
  width: 65px;
  height: 24px;
  flex-shrink: 0;
}

/* ==========================================================================
   2. MAIN 2-COLUMN LAYOUT
   ========================================================================== */
.analytics-layout-2col {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

.analytics-left-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.analytics-right-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* ==========================================================================
   3. REVENUE OVERVIEW SPLINE CHART CARD
   ========================================================================== */
.analytics-chart-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.chart-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.chart-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}

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

.chart-legend-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-sub);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-revenue { background: #10b981; }
.dot-fees { background: #8b5cf6; }
.dot-refunds { background: #ef4444; }

.select-chart-granularity {
  background: #f8faf9;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.chart-canvas-container {
  position: relative;
  width: 100%;
  height: 270px;
  margin-bottom: 18px;
}

/* 3-Column Bottom Stats */
.revenue-bottom-metrics-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid #f1f5f3;
}

.revenue-metric-item {
  min-width: 0;
}

.rev-metric-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 3px;
}

.rev-metric-val {
  font-size: 16px;
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 2px;
}

.rev-metric-growth {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
}

.growth-up { color: #10b981; }
.growth-down { color: #ef4444; }

/* ==========================================================================
   4. BOTTOM SPLIT: POPULAR COMICS (60%) + SALES BY DEVICE (40%)
   ========================================================================== */
.analytics-bottom-split-row {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}

.popular-comics-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.popular-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.popular-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}

.link-view-all {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--emerald-dark);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.popular-comics-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 520px;
}

.popular-comics-table thead tr {
  border-bottom: 1px solid var(--card-border);
}

.popular-comics-table th {
  padding: 8px 10px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #64748b;
  text-transform: uppercase;
  white-space: nowrap;
}

.popular-comics-table tbody tr {
  border-bottom: 1px solid #f1f5f3;
  transition: background 0.15s;
}

.popular-comics-table tbody tr:hover {
  background: #f9fbf9;
}

.popular-comics-table td {
  padding: 10px 10px;
  vertical-align: middle;
  font-size: 11.5px;
}

.td-rank {
  font-weight: 800;
  color: #64748b;
  width: 20px;
}

.popular-thumb {
  width: 28px;
  height: 38px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.popular-meta {
  min-width: 0;
}

.popular-name {
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
}

.popular-cat {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.td-views, .td-orders, .td-revenue {
  font-weight: 800;
  white-space: nowrap;
}

.td-readers-gain {
  font-weight: 800;
  color: var(--emerald-dark);
  white-space: nowrap;
}

/* Sales by Device Card */
.device-sales-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
}

.device-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 12px;
}

.device-donut-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 14px auto;
}

.donut-center-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.center-sub {
  font-size: 9.5px;
  color: var(--text-muted);
  line-height: 1.1;
}

.center-num {
  font-size: 15px;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.2;
}

.device-legend-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.device-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}

.leg-left {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-sub);
}

.device-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.dot-mobile { background: #10b981; }
.dot-desktop { background: #2563eb; }
.dot-tablet { background: #8b5cf6; }

.leg-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.leg-right strong {
  color: var(--text-main);
}

.pct-text {
  font-size: 10px;
  color: var(--text-muted);
}

.link-view-full-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--emerald-dark);
  text-decoration: none;
  padding-top: 8px;
  border-top: 1px solid #f1f5f3;
  transition: color 0.2s;
}

.link-view-full-center:hover {
  color: var(--emerald);
}

/* ==========================================================================
   5. RIGHT COLUMN: 3 CARDS
   ========================================================================= */

/* Traffic Sources Card */
.traffic-sources-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
}

.traffic-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 12px;
}

.traffic-donut-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 14px auto;
}

.traffic-legend-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.traffic-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}

.traffic-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot-direct { background: #10b981; }
.dot-search { background: #2563eb; }
.dot-social { background: #8b5cf6; }
.dot-app { background: #f59e0b; }
.dot-other { background: #94a3b8; }

/* Top Countries Card */
.top-countries-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
}

.countries-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.world-map-svg-wrap {
  width: 100%;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.world-map-svg {
  width: 100%;
  height: 100%;
}

.countries-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.country-row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}

.country-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.country-flag {
  font-size: 13px;
}

.country-name {
  color: var(--text-sub);
}

.country-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.country-right strong {
  color: var(--text-main);
}

/* Summary Insights Card */
.summary-insights-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--card-shadow);
}

.insights-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 12px;
}

.insights-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.insight-item-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.insight-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.insight-meta {
  min-width: 0;
}

.insight-heading {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 1px;
}

.insight-desc {
  font-size: 10.5px;
  color: var(--text-sub);
  line-height: 1.35;
}

/* Bottom Note */
.analytics-bottom-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 20px;
}

/* ==========================================================================
   6. RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1240px) {
  .analytics-metrics-grid-5 {
    grid-template-columns: repeat(3, 1fr);
  }

  .analytics-layout-2col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .analytics-bottom-split-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .analytics-metrics-grid-5 {
    grid-template-columns: repeat(2, 1fr);
  }

  .revenue-bottom-metrics-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .analytics-metrics-grid-5 {
    grid-template-columns: 1fr;
  }
}
