/* v2.2.1 styles - Production ready with debug cleanup and hardening */
.spd-wrap{--card-bg:#0f172a;--card-fg:#e5e7eb;--muted:#9ca3af;--border:#1f2937;--panel:#0b1020;--ok:#22c55e;--bad:#f43f5e;--warn:#eab308;--accent:#6366f1;background:var(--panel);color:var(--card-fg);padding:16px 20px;min-height:100vh;box-sizing:border-box}

/* PRO Card Styles */
.spd-pro-card {
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.spd-pro-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  border-color: var(--accent);
}

.spd-pro-card::before {
  content: "PRO";
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 10;
}

.spd-pro-placeholder {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex: 1;
  min-height: 120px;
  position: relative;
}

.spd-pro-image {
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.spd-pro-card:hover .spd-pro-image {
  opacity: 1;
}

.spd-pro-placeholder::after {
  content: "PRO Version Preview - Click to Upgrade or Turn Off in Settings";
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: white;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.spd-pro-card:hover .spd-pro-placeholder::after {
  opacity: 1;
}

/* Mobile container fixes */
@media (max-width: 768px) {
  .spd-wrap {
    padding: 12px 16px !important;
  }
}

@media (max-width: 480px) {
  .spd-wrap {
    padding: 8px 12px !important;
  }
}
.spd-wrap.spd-light{--card-bg:#fff;--card-fg:#111827;--muted:#6b7280;--border:#e5e7eb;--panel:#f3f4f6;--accent:#4f46e5}

.spd-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px;gap:10px;flex-wrap:wrap}
.spd-title{color:var(--card-fg);margin:0;font-size:24px;font-weight:700;word-wrap:break-word;flex:1;min-width:200px}
.spd-select{background:var(--card-bg);color:var(--card-fg);border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-size:14px;font-weight:500;cursor:pointer;transition:all .2s;min-width:140px}
.spd-select:hover{border-color:var(--accent)}
.spd-select:focus{outline:0;border-color:var(--accent);box-shadow:0 0 0 3px rgba(99,102,241,.1)}

.spd-controls{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}

.spd-grid{display:grid;grid-template-columns:repeat(12,1fr);gap:14px;grid-auto-rows:minmax(150px,auto);grid-auto-flow:dense}
.spd-card{background:var(--card-bg);border:1px solid var(--border);border-radius:12px;padding:14px;min-height:150px;box-sizing:border-box}
.spd-card h3{color:var(--card-fg);margin:0 0 8px;font-size:16px;font-weight:600;word-wrap:break-word}
.spd-col-3{grid-column:span 3/span 3}.spd-col-6{grid-column:span 6/span 6}.spd-col-12{grid-column:span 12/span 12}

/* Enhanced Responsive Grid Breakpoints - Phase 1 */
@media (max-width:1400px){
  .spd-grid{gap:12px}
  .spd-card{padding:12px}
}

@media (max-width:1200px){
  .spd-col-3{grid-column:span 6/span 6}
  .spd-col-6{grid-column:span 12/span 12}
  .spd-grid{gap:10px}
  .spd-card{padding:10px}
}

@media (max-width:800px){
  .spd-col-3,.spd-col-6{grid-column:span 12/span 12}
  .spd-grid{gap:8px}
  .spd-card{padding:8px;min-height:120px}
  .spd-card h3{font-size:14px}
}

/* --- Responsive grid lock: 1 / 2 / 3 / desktop --- */
#spd-grid {
  display: grid !important;
  grid-auto-rows: minmax(150px, auto);
  gap: 14px !important;
}

/* 3-up (large tablets / small laptops) */
@media (min-width:1025px) and (max-width:1360px){
  #spd-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  #spd-grid > .spd-card { 
    grid-column: auto !important;
    grid-row: auto !important;     /* neutralize JS desktop row placement */
  }
}

/* 2-up (iPads / tablets) */
@media (min-width:769px) and (max-width:1024px){
  #spd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #spd-grid > .spd-card { 
    grid-column: auto !important;
    grid-row: auto !important;
  }
}

/* 1-up (mobile) */
@media (max-width:768px){
  #spd-grid { grid-template-columns: 1fr !important; }
  #spd-grid > .spd-card { 
    grid-column: 1 / -1 !important; /* span full width properly */
    grid-row: auto !important;      /* let the grid flow naturally */
  }
}

/* Phase 1: Enhanced Mobile Responsiveness */
/* Fluid Typography for KPI Values - HIGH PRIORITY */
.spd-kpi{
  font-size: clamp(16px, 4vw, 28px) !important;
  font-weight: 800 !important;
  margin-bottom: 6px !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  line-height: 1.2 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.spd-sub{
  font-size: clamp(10px, 2.5vw, 12px) !important;
  color: var(--muted) !important;
  margin-bottom: 8px !important;
  word-wrap: break-word !important;
  line-height: 1.3 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: normal !important;
  display: block !important;
}

/* Fix for text truncation in KPI cards */
.spd-card .spd-sub {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  word-break: break-word !important;
  hyphens: auto !important;
}

/* Enhanced Header Responsiveness - HIGH PRIORITY */
@media (max-width: 768px) {
  .spd-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
  }
  
  .spd-title {
    font-size: clamp(18px, 5vw, 24px) !important;
    text-align: center !important;
    min-width: auto !important;
    margin-bottom: 8px !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }
  
  .spd-controls {
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
  }
  
  .spd-select {
    min-width: 120px !important;
    font-size: 14px !important;
    padding: 10px 12px !important;
    height: 44px !important; /* Touch-friendly height */
    flex: 1 !important;
    max-width: 200px !important;
  }
  
  /* Touch-friendly buttons */
  .spd-controls .button {
    min-width: 44px !important;
    min-height: 44px !important;
    font-size: 16px !important;
    padding: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
  }
}

@media (max-width: 480px) {
  .spd-header {
    gap: 8px;
  }
  
  .spd-title {
    font-size: clamp(16px, 4.5vw, 20px);
  }
  
  .spd-controls {
    gap: 6px;
  }
  
  .spd-select {
    min-width: 100px;
    font-size: 13px;
    padding: 8px 10px;
    height: 40px;
  }
  
  .spd-controls .button {
    min-width: 40px;
    min-height: 40px;
    font-size: 14px;
    padding: 8px;
  }
}

/* Enhanced Gauge Responsiveness - FIXED HEIGHTS */
.spd-gauge-wrap {
  position: relative;
  height: 220px;
  overflow: visible;
  margin-bottom: 16px;
  max-width: 100%;
}

.spd-gauge-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  max-width: 100%;
}

.spd-gauge-value {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(14px, 3.5vw, 22px);
  font-weight: 800;
  word-wrap: break-word;
  text-align: center;
  line-height: 1.2;
}

/* Enhanced Chart Responsiveness - FIXED HEIGHTS */
.spd-chart {
  width: 100% !important;
  height: 220px !important;
  max-width: 100% !important;
  max-height: 220px !important;
  overflow: hidden !important;
  min-height: 150px !important;
}

/* Override any inline styles that might set extreme heights */
.spd-chart[style*="height"] {
  height: 220px !important;
  max-height: 220px !important;
}

@media (max-width: 768px) {
  .spd-chart[style*="height"] {
    height: 180px !important;
    max-height: 180px !important;
  }
}

@media (max-width: 480px) {
  .spd-chart[style*="height"] {
    height: 150px !important;
    max-height: 150px !important;
  }
}

.spd-chart.spd-pie {
  height: auto !important;
  aspect-ratio: 1 !important;
  max-width: 100% !important;
}

/* Chart.js specific mobile fixes */
@media (max-width: 768px) {
  .spd-chart {
    height: 180px !important;
    max-height: 180px !important;
  }
  
  /* Force Chart.js to use mobile-friendly options */
  .spd-chart canvas {
    max-width: 100% !important;
    height: 100% !important;
    max-height: 180px !important;
  }
}

@media (max-width: 480px) {
  .spd-chart {
    height: 150px !important;
    max-height: 150px !important;
  }
  
  /* Aggressive chart fixes for very small screens */
  .spd-chart canvas {
    max-width: 100% !important;
    height: 100% !important;
    max-height: 150px !important;
  }
}

/* Orders by Category - Responsive sizing */
.spd-card-orders-by-category .spd-chart.spd-pie {
  max-width: clamp(200px, 50vw, 66.67%) !important;
  margin: 0 auto;
}

/* Enhanced Card Responsiveness - HIGH PRIORITY */
@media (max-width: 768px) {
  .spd-card {
    padding: clamp(8px, 2vw, 14px) !important;
    min-height: clamp(100px, 20vw, 150px) !important;
    margin-bottom: 8px !important;
    overflow: hidden !important;
  }
  
  .spd-card h3 {
    font-size: clamp(13px, 3vw, 16px) !important;
    margin-bottom: clamp(4px, 1vw, 8px) !important;
    line-height: 1.3 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
  }
  
  /* Fix chart container overflow */
  .spd-card canvas {
    max-width: 100% !important;
    height: auto !important;
  }
}

@media (max-width: 480px) {
  .spd-card {
    padding: clamp(6px, 1.5vw, 8px) !important;
    min-height: clamp(80px, 15vw, 100px) !important;
    margin-bottom: 6px !important;
  }
  
  .spd-card h3 {
    font-size: clamp(11px, 2.5vw, 12px) !important;
    margin-bottom: clamp(3px, 0.8vw, 4px) !important;
  }
  
  /* Aggressive chart fixes for small screens */
  .spd-chart {
    max-width: 100% !important;
    height: clamp(100px, 20vw, 150px) !important;
  }
}

/* Enhanced World Map Responsiveness */
.spd-world {
  width: 100%;
  height: clamp(200px, 40vw, 420px);
  min-height: clamp(200px, 40vw, 420px);
  max-width: 100%;
}

/* Enhanced Settings Panel for Mobile */
@media (max-width: 768px) {
  .spd-settings-panel {
    width: 100%;
    right: -100%;
    top: 0;
    height: 100vh;
  }
  
  .spd-settings-panel.active {
    right: 0;
  }
  
  .spd-settings-header {
    padding: 16px;
  }
  
  .spd-settings-content {
    padding: 16px;
  }
  
  .spd-card-item {
    padding: 12px;
  }
  
  .spd-card-toggle {
    width: 44px;
    height: 24px;
  }
  
  .spd-card-toggle::after {
    width: 18px;
    height: 18px;
  }
  
  .spd-card-toggle.active::after {
    left: 24px;
  }
  
  .spd-control-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .spd-settings-header {
    padding: 12px;
  }
  
  .spd-settings-content {
    padding: 12px;
  }
  
  .spd-card-item {
    padding: 10px;
  }
  
  .spd-control-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}

/* Enhanced About Panel for Mobile */
@media (max-width: 768px) {
  .spd-about-panel {
    width: 95%;
    max-width: none;
    max-height: 90vh;
  }
  
  .spd-about-header {
    padding: 16px 20px;
  }
  
  .spd-about-content {
    padding: 20px;
    max-height: calc(90vh - 80px);
  }
}

@media (max-width: 480px) {
  .spd-about-panel {
    width: 98%;
    max-height: 95vh;
  }
  
  .spd-about-header {
    padding: 12px 16px;
  }
  
  .spd-about-content {
    padding: 16px;
    max-height: calc(95vh - 80px);
  }
}

/* Enhanced Tooltip Responsiveness */
@media (max-width: 768px) {
  .spd-tooltip {
    max-width: 280px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.3;
  }
  
  .chartjs-tooltip {
    max-width: 280px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.3;
  }
}

@media (max-width: 480px) {
  .spd-tooltip {
    max-width: 250px;
    padding: 8px 10px;
    font-size: 11px;
  }
  
  .chartjs-tooltip {
    max-width: 250px;
    padding: 8px 10px;
    font-size: 11px;
  }
}

/* Enhanced Heatmap Responsiveness */
@media (max-width: 768px) {
  .spd-heatmap {
    font-size: 10px;
    min-width: 350px;
  }
  
  .spd-heatmap th,
  .spd-heatmap td {
    padding: 2px 4px;
    min-width: 20px;
    height: 18px;
  }
}

@media (max-width: 480px) {
  .spd-heatmap {
    font-size: 9px;
    min-width: 300px;
  }
  
  .spd-heatmap th,
  .spd-heatmap td {
    padding: 1px 3px;
    min-width: 18px;
    height: 16px;
  }
}

/* Enhanced List Responsiveness */
@media (max-width: 768px) {
  .spd-list li {
    padding: clamp(6px, 1.5vw, 8px) 0;
    gap: clamp(3px, 0.8vw, 4px);
    font-size: clamp(11px, 2.5vw, 14px);
  }
}

@media (max-width: 480px) {
  .spd-list li {
    padding: clamp(4px, 1vw, 6px) 0;
    gap: clamp(2px, 0.5vw, 3px);
    font-size: clamp(10px, 2vw, 11px);
  }
}

/* Enhanced Progress Bar Responsiveness */
@media (max-width: 768px) {
  .spd-progress {
    height: clamp(4px, 1vw, 6px);
  }
}

@media (max-width: 480px) {
  .spd-progress {
    height: clamp(3px, 0.8vw, 4px);
  }
}

/* Enhanced AOV Trend Responsiveness */
@media (max-width: 768px) {
  .spd-aov-trend {
    font-size: clamp(10px, 2.5vw, 12px);
    gap: clamp(4px, 1vw, 6px);
    margin-top: clamp(6px, 1.5vw, 8px);
  }
  
  .spd-aov-trend-icon {
    font-size: clamp(12px, 3vw, 14px);
  }
}

@media (max-width: 480px) {
  .spd-aov-trend {
    font-size: clamp(9px, 2vw, 11px);
    gap: clamp(3px, 0.8vw, 4px);
    margin-top: clamp(4px, 1vw, 6px);
  }
  
  .spd-aov-trend-icon {
    font-size: clamp(10px, 2.5vw, 12px);
  }
}

/* Enhanced Map Legend Responsiveness */
@media (max-width: 768px) {
  .spd-map-legend .ticks {
    font-size: clamp(10px, 2.5vw, 12px);
  }
}

@media (max-width: 480px) {
  .spd-map-legend .ticks {
    font-size: clamp(9px, 2vw, 10px);
  }
}

/* Enhanced Country Legend Responsiveness */
@media (max-width: 768px) {
  .spd-legend-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  
  .spd-legend-item {
    padding: 4px 6px;
  }
  
  .spd-legend-title {
    font-size: clamp(12px, 3vw, 14px);
  }
  
  .spd-legend-code,
  .spd-legend-value {
    font-size: clamp(10px, 2.5vw, 12px);
  }
}

@media (max-width: 480px) {
  .spd-legend-item {
    padding: 3px 5px;
  }
  
  .spd-legend-title {
    font-size: clamp(11px, 2.5vw, 12px);
  }
  
  .spd-legend-code,
  .spd-legend-value {
    font-size: clamp(9px, 2vw, 10px);
  }
}

/* Enhanced Refund Details Responsiveness */
@media (max-width: 768px) {
  .spd-refund-details {
    margin-top: 16px;
    padding: 6px 10px;
  }
  
  .spd-refund-amount,
  .spd-refund-orders {
    font-size: clamp(10px, 2.5vw, 12px);
  }
}

@media (max-width: 480px) {
  .spd-refund-details {
    margin-top: 12px;
    padding: 4px 8px;
  }
  
  .spd-refund-amount,
  .spd-refund-orders {
    font-size: clamp(9px, 2vw, 10px);
  }
}

/* Old KPI styles removed - replaced with fluid typography above */
.spd-up{color:var(--ok);font-weight:600}
.spd-down{color:var(--bad);font-weight:600}

/* Unified Modern Tooltips */
.spd-tooltip{
  position: absolute;
  background: #0f172a !important;
  background-color: #0f172a !important;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: #e5e7eb;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  z-index: 999999;
  max-width: 280px;
  line-height: 1.4;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  transform: translateY(-4px);
  pointer-events: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  word-wrap: break-word;
}

@media (max-width:600px){
  .spd-tooltip{
    max-width: 250px;
    padding: 10px 12px;
    font-size: 12px;
  }
}

.spd-tooltip::before{
  content: '';
  position: absolute;
  top: -6px;
  left: 20px;
  width: 12px;
  height: 12px;
  background: #0f172a !important;
  background-color: #0f172a !important;
  border-left: 1px solid #1f2937;
  border-top: 1px solid #1f2937;
  transform: rotate(45deg);
  z-index: 1000000;
}

.spd-tooltip.show{
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0);
  background: #0f172a !important;
  background-color: #0f172a !important;
  display: block !important;
}

.spd-tooltip.spd-tooltip-bottom::before{
  top: auto;
  bottom: -6px;
  border-left: none;
  border-top: none;
  border-right: 1px solid #1f2937;
  border-bottom: 1px solid #1f2937;
}

.spd-tooltip-title{
  font-weight: 600;
  margin-bottom: 4px;
  color: #e5e7eb !important;
  background: #0f172a !important;
  background-color: #0f172a !important;
}

.spd-tooltip-content{
  color: #e5e7eb !important;
  font-size: 13px;
  background: #0f172a !important;
  background-color: #0f172a !important;
}

.spd-tooltip-value{
  font-weight: 600;
  color: #6366f1 !important;
  margin-top: 4px;
  background: #0f172a !important;
  background-color: #0f172a !important;
}

/* Ensure tooltip background is completely opaque */
.spd-tooltip,
.spd-tooltip.show,
.spd-tooltip * {
  background: #0f172a !important;
  background-color: #0f172a !important;
}

/* WordPress admin specific overrides */
.wp-admin .spd-tooltip,
.wp-admin .spd-tooltip.show,
.wp-admin .spd-tooltip * {
  background: #0f172a !important;
  background-color: #0f172a !important;
  color: #e5e7eb !important;
}

/* Force tooltip visibility in admin context */
.wp-admin .spd-tooltip.show {
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
}

/* Additional WordPress admin overrides to prevent transparency */
#wpcontent .spd-tooltip,
#wpcontent .spd-tooltip.show,
#wpcontent .spd-tooltip * {
  background: #0f172a !important;
  background-color: #0f172a !important;
  color: #e5e7eb !important;
}

/* Force opacity and visibility */
#wpcontent .spd-tooltip.show {
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
}

/* Additional specificity to override any WordPress admin styles */
body .spd-tooltip,
body .spd-tooltip.show,
body .spd-tooltip *,
body .spd-tooltip.show * {
  background: #0f172a !important;
  background-color: #0f172a !important;
  color: #e5e7eb !important;
}

/* Ensure tooltip is always on top */
body .spd-tooltip {
  z-index: 999999 !important;
}

body .spd-tooltip.show {
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
  z-index: 999999 !important;
}

/* Final override for any remaining transparency issues */
.spd-tooltip,
.spd-tooltip.show,
.spd-tooltip *,
.spd-tooltip.show * {
  background: #0f172a !important;
  background-color: #0f172a !important;
  color: #e5e7eb !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Force tooltip to be completely opaque */
.spd-tooltip.show {
  background: #0f172a !important;
  background-color: #0f172a !important;
  color: #e5e7eb !important;
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
  z-index: 999999 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Light mode tooltip styles */
.spd-wrap.spd-light .spd-tooltip,
.spd-wrap.spd-light .spd-tooltip.show,
.spd-wrap.spd-light .spd-tooltip *,
.spd-wrap.spd-light .spd-tooltip.show * {
  background: #ffffff !important;
  background-color: #ffffff !important;
  color: #111827 !important;
  border-color: #e5e7eb !important;
}

.spd-wrap.spd-light .spd-tooltip::before {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border-color: #e5e7eb !important;
}

.spd-wrap.spd-light .spd-tooltip-value {
  color: #4f46e5 !important;
}

/* Chart.js tooltips - unified styling */
.chartjs-tooltip{
  background: #0f172a !important;
  background-color: #0f172a !important;
  border: 1px solid #1f2937 !important;
  border-radius: 8px !important;
  color: #e5e7eb !important;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
  padding: 12px 16px !important;
  font-size: 13px !important;
  line-height: 1.4 !important;
  font-family: inherit !important;
  z-index: 999999 !important;
  opacity: 1 !important;
  visibility: visible !important;
  position: absolute !important;
  pointer-events: none !important;
}

.chartjs-tooltip-header{
  background: #0f172a !important;
  background-color: #0f172a !important;
  color: #e5e7eb !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  padding: 0 0 4px 0 !important;
  border-bottom: none !important;
}

.chartjs-tooltip-body{
  background: #0f172a !important;
  background-color: #0f172a !important;
  color: #e5e7eb !important;
  font-size: 13px !important;
  padding: 4px 0 0 0 !important;
}

/* Light mode Chart.js tooltips */
.spd-wrap.spd-light .chartjs-tooltip,
.spd-wrap.spd-light .chartjs-tooltip-header,
.spd-wrap.spd-light .chartjs-tooltip-body {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border-color: #e5e7eb !important;
  color: #111827 !important;
}

/* Specific tooltip fixes for Orders chart */
#ordersChart + .chartjs-tooltip,
.spd-card-orders .chartjs-tooltip {
  background: #0f172a !important;
  background-color: #0f172a !important;
  border: 1px solid #1f2937 !important;
  color: #e5e7eb !important;
  z-index: 999999 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Light mode tooltip fixes for Orders chart */
.spd-wrap.spd-light #ordersChart + .chartjs-tooltip,
.spd-wrap.spd-light .spd-card-orders .chartjs-tooltip {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  color: #111827 !important;
}

/* Specific tooltip fixes for Total Sales chart */
#salesChart + .chartjs-tooltip,
.spd-card-total-sales .chartjs-tooltip {
  background: #0f172a !important;
  background-color: #0f172a !important;
  border: 1px solid #1f2937 !important;
  color: #e5e7eb !important;
  z-index: 999999 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Light mode tooltip fixes for Total Sales chart */
.spd-wrap.spd-light #salesChart + .chartjs-tooltip,
.spd-wrap.spd-light .spd-card-total-sales .chartjs-tooltip {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  color: #111827 !important;
}

/* Specific tooltip fixes for Net Profit chart */
#profitChart + .chartjs-tooltip,
.spd-card-net-profit .chartjs-tooltip {
  background: #0f172a !important;
  background-color: #0f172a !important;
  border: 1px solid #1f2937 !important;
  color: #e5e7eb !important;
  z-index: 999999 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Light mode tooltip fixes for Net Profit chart */
.spd-wrap.spd-light #profitChart + .chartjs-tooltip,
.spd-wrap.spd-light .spd-card-net-profit .chartjs-tooltip {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  color: #111827 !important;
}

/* jsVectorMap world map styling */
.spd-world{min-height:360px;height:100%;width:100%}

/* ensure series colors show on the map - now handled by JavaScript */

/* jsVectorMap tooltip styling */
.jvectormap-tooltip{
  background: var(--card-bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  color: var(--card-fg) !important;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
  padding: 12px 16px !important;
  font-size: 13px !important;
  line-height: 1.4 !important;
  font-family: inherit !important;
  z-index: 999999 !important;
}

/* Light mode jsVectorMap tooltip */
.spd-wrap.spd-light .jvectormap-tooltip {
  background: #ffffff !important;
  border-color: #e5e7eb !important;
  color: #111827 !important;
}

/* Heatmap tooltips - using modern tooltip system */
.spd-heatmap-cell{position:relative}

.spd-chart{width:100%!important;height:220px!important;max-width:100%}
.spd-chart.spd-pie{height:auto!important;aspect-ratio:1!important;max-width:100%}

/* Orders by Category - Reduced size by 1/3 */
.spd-card-orders-by-category .spd-chart.spd-pie{
  max-width: 66.67% !important;
  margin: 0 auto;
}

@media (max-width:800px){
  .spd-chart{height:180px!important}
}

@media (max-width:600px){
  .spd-chart{height:150px!important}
}

/* Gauge */
.spd-gauge-wrap{position:relative;height:220px;overflow:visible;margin-bottom:16px;max-width:100%}
.spd-gauge-canvas{width:100%!important;height:100%!important;display:block;max-width:100%}
.spd-gauge-value{position:absolute;bottom:-4px;left:50%;transform:translateX(-50%);font-size:22px;font-weight:800;word-wrap:break-word;text-align:center}

@media (max-width:800px){
  .spd-gauge-wrap{height:180px;margin-bottom:12px}
  .spd-gauge-value{font-size:18px}
}

@media (max-width:600px){
  .spd-gauge-wrap{height:150px;margin-bottom:8px}
  .spd-gauge-value{font-size:16px}
}
.spd-aov-trend{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:8px;font-size:12px;font-weight:500;flex-wrap:wrap}
.spd-aov-trend-icon{font-size:14px}
.spd-aov-trend-text{color:var(--muted)}

@media (max-width:600px){
  .spd-aov-trend{font-size:11px;gap:4px;margin-top:6px}
  .spd-aov-trend-icon{font-size:12px}
}

/* World map (Highcharts needs a fixed pixel height container) */
.spd-world-wrap{display:flex;flex-direction:column;height:auto;max-width:100%}
.spd-world{width:100%;height:420px;min-height:420px;max-width:100%}

@media (max-width:800px){
  .spd-world{height:350px;min-height:350px}
}

@media (max-width:600px){
  .spd-world{height:280px;min-height:280px}
}
.spd-map-legend{position:static;margin-top:8px}
.spd-map-legend .bar{height:10px;width:100%;border-radius:999px;border:1px solid var(--border);background:linear-gradient(90deg,#93c5fd,#1d4ed8)}
.spd-wrap.spd-light .spd-map-legend .bar{background:linear-gradient(90deg,#c7d2fe,#4f46e5)}
.spd-map-legend .ticks{display:flex;justify-content:space-between;font-size:12px;color:var(--muted);margin-top:4px}

/* (optional) Country legend block if you use it */
.spd-country-legend{margin-top:12px;padding-top:12px;border-top:1px solid var(--border)}
.spd-legend-title{font-size:14px;font-weight:600;color:var(--card-fg);margin-bottom:8px}
.spd-legend-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.spd-legend-item{display:flex;align-items:center;gap:8px;padding:6px 8px;background:rgba(255,255,255,.02);border-radius:6px;border:1px solid var(--border)}
.spd-wrap.spd-light .spd-legend-item{background:rgba(0,0,0,.02)}
.spd-legend-color{width:12px;height:12px;border-radius:3px;flex-shrink:0}
.spd-legend-code{font-size:12px;font-weight:600;color:var(--card-fg);font-family:monospace;flex-shrink:0}
.spd-legend-value{font-size:12px;color:var(--card-fg);font-weight:500;flex:1;text-align:right}

/* Lists */
.spd-list li{display:flex;flex-direction:column;gap:4px;padding:8px 0;border-bottom:1px dashed var(--border);word-wrap:break-word}
.spd-list li:last-child{border-bottom:none}

@media (max-width:600px){
  .spd-list li{padding:6px 0;gap:3px}
}
.spd-progress{width:100%;height:6px;background:rgba(255,255,255,.08);border-radius:999px;overflow:hidden;max-width:100%}
.spd-wrap.spd-light .spd-progress{background:rgba(0,0,0,.06)}

@media (max-width:600px){
  .spd-progress{height:4px}
}
.spd-progress>span{display:block;height:100%;background:linear-gradient(90deg,var(--accent),#22c55e)}
.spd-dot{width:10px;height:10px;border-radius:50%;display:inline-block;margin-right:6px;border:1px solid rgba(0,0,0,.08)}

/* PRO-only KPI styles removed - these are now placeholder images */

/* About Panel */
.spd-about-panel{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:var(--card-bg);border:1px solid var(--border);border-radius:12px;box-shadow:0 20px 40px rgba(0,0,0,0.3);z-index:100002;width:90%;max-width:500px;max-height:80vh;overflow:hidden;opacity:0;visibility:hidden;transition:all .3s ease}
.spd-about-panel.active{opacity:1;visibility:visible}
.spd-about-overlay{position:fixed;top:0;left:0;width:100vw;height:100vh;background:rgba(0,0,0,.5);z-index:100001;opacity:0;visibility:hidden;transition:all .3s ease}
.spd-about-overlay.active{opacity:1;visibility:visible}

.spd-about-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--border);background:var(--card-bg)}
.spd-about-header h3{margin:0;color:var(--card-fg);font-size:18px;font-weight:600}
.spd-about-close{background:none;border:none;color:var(--muted);font-size:24px;cursor:pointer;padding:0;width:32px;height:32px;display:flex;align-items:center;justify-content:center;border-radius:6px;transition:all .2s}
.spd-about-close:hover{color:var(--card-fg);background:rgba(255,255,255,.05)}

.spd-about-content{padding:24px;max-height:calc(80vh - 80px);overflow-y:auto}
.spd-about-section{margin-bottom:20px}
.spd-about-section:last-child{margin-bottom:0}
.spd-about-section h4{margin:0 0 8px;color:var(--card-fg);font-size:14px;font-weight:600}
.spd-about-section p{margin:0;font-size:14px;line-height:1.5;color:var(--muted)}
.spd-about-section a{color:var(--accent);text-decoration:none;transition:color .2s}
.spd-about-section a:hover{color:var(--accent-hover)}

/* Settings Panel */
.spd-settings-panel{position:fixed;top:0;right:-400px;width:400px;height:100vh;background:var(--card-bg);border-left:1px solid var(--border);z-index:10001;transition:right .3s ease;overflow-y:auto;box-sizing:border-box}

@media (max-width:600px){
  .spd-settings-panel{width:100%;right:-100%}
}
.spd-settings-panel.active{right:0}
.spd-settings-overlay{position:fixed;top:0;left:0;width:100vw;height:100vh;background:rgba(0,0,0,.5);z-index:10000;opacity:0;visibility:hidden;transition:all .3s ease}
.spd-settings-overlay.active{opacity:1;visibility:visible}

.spd-settings-header{display:flex;align-items:center;justify-content:space-between;padding:20px;border-bottom:1px solid var(--border)}
.spd-settings-header h3{margin:0;color:var(--card-fg);font-size:18px;font-weight:600}
.spd-settings-close{background:none;border:none;color:var(--muted);font-size:24px;cursor:pointer;padding:0;width:30px;height:30px;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:all .2s}
.spd-settings-close:hover{color:var(--card-fg);background:rgba(255,255,255,.05)}

.spd-settings-content{padding:20px}
.spd-settings-section{margin-bottom:30px}
.spd-settings-section h4{color:var(--card-fg);margin:0 0 15px;font-size:16px;font-weight:600}

.spd-card-settings{display:flex;flex-direction:column;gap:15px}
.spd-card-item{background:rgba(255,255,255,.02);border:1px solid var(--border);border-radius:8px;padding:15px}
.spd-card-item.disabled{opacity:.5}
.spd-card-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.spd-card-header .spd-card-title{flex:1;margin:0 8px}
.spd-card-title{color:var(--card-fg);font-weight:600;font-size:14px}
.spd-card-toggle{position:relative;width:40px;height:20px;background:var(--border);border-radius:10px;cursor:pointer;transition:all .2s}
.spd-card-toggle.active{background:var(--ok)}
.spd-card-toggle::after{content:'';position:absolute;top:2px;left:2px;width:16px;height:16px;background:white;border-radius:50%;transition:all .2s}
.spd-card-toggle.active::after{left:22px}

.spd-card-controls{display:flex;gap:10px;align-items:center}
.spd-control-group{display:flex;flex-direction:column;gap:5px}
.spd-control-label{font-size:12px;color:var(--muted)}
.spd-control-inputs{display:flex;align-items:center;gap:5px}
.spd-control-btn{width:24px;height:24px;background:var(--border);border:1px solid var(--border);color:var(--card-fg);border-radius:4px;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:12px;transition:all .2s}
.spd-control-btn:hover{background:var(--accent);border-color:var(--accent)}
.spd-control-btn:disabled{opacity:.3;cursor:not-allowed}
.spd-control-value{min-width:30px;text-align:center;font-size:12px;color:var(--card-fg);font-weight:600}

.spd-settings-actions{display:flex;gap:10px;padding-top:20px;border-top:1px solid var(--border)}
.spd-settings-actions .button{flex:1;padding:10px;font-size:14px;font-weight:500}

/* Drag and Drop Styles */
.spd-card-item{cursor:default}
.spd-card-item.dragging{cursor:grabbing;opacity:0.5;transform:rotate(2deg);z-index:1000}
.spd-card-item.drop-above{border-top:3px solid var(--accent)}
.spd-card-item.drop-below{border-bottom:3px solid var(--accent)}
.spd-card-drag{color:var(--muted);font-size:16px;margin-right:8px;user-select:none;cursor:grab}
.spd-card-drag:hover{color:var(--card-fg)}
.spd-card-drag:active{cursor:grabbing}

/* Refund Rate Card */
.spd-refund-details{display:flex;justify-content:space-between;margin-top:20px;padding:8px 12px;background:rgba(239,68,68,0.1);border-radius:6px;border:1px solid rgba(239,68,68,0.2)}
.spd-refund-amount{font-size:12px;color:var(--card-fg);font-weight:500}
.spd-refund-orders{font-size:12px;color:var(--muted)}

/* Heatmap styles removed - now PRO-only placeholder image */

/* PRO-only KPI styles removed - these are now placeholder images */

/* Comprehensive Responsive Styles for KPI Cards */
@media (max-width:1400px){
  /* PRO-only KPI responsive styles removed - these are now placeholder images */
  
  /* PRO-only KPI responsive styles removed - these are now placeholder images */
}

@media (max-width:1200px){
  /* PRO-only KPI responsive styles removed - these are now placeholder images */
}

@media (max-width:800px){
  /* PRO-only KPI responsive styles removed - these are now placeholder images */
}

@media (max-width:600px){
  /* PRO-only KPI responsive styles removed - these are now placeholder images */
}

/* PRO-only KPI overflow styles removed - these are now placeholder images */
