/* ============================================================
   dashboard.css
   THE AGRI WORLD - Shared Dashboard Component Styles
   Charts, widgets, data cards, activity feeds
   ============================================================ */

/* ════════════════════════════════════════════════════════════
   DASHBOARD WIDGETS
   ════════════════════════════════════════════════════════════ */

/* Glass morphism card variant */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  transition: var(--transition);
}

.glass-card:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  border-color: rgba(45,122,51,0.15);
}

/* Stat card with icon */
.stat-icon-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-bounce);
}

.stat-icon-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.stat-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.stat-icon-wrap.green { background: var(--green-50); }
.stat-icon-wrap.blue  { background: rgba(30,136,229,0.1); }
.stat-icon-wrap.gold  { background: rgba(249,168,37,0.1); }
.stat-icon-wrap.red   { background: rgba(229,57,53,0.1); }
.stat-icon-wrap.purple{ background: rgba(156,39,176,0.1); }

.stat-icon-details {
  flex: 1;
  min-width: 0;
}

.stat-icon-value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-icon-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-icon-change {
  font-size: var(--text-xs);
  font-weight: 600;
  margin-top: 4px;
}

.stat-icon-change.up { color: var(--success); }
.stat-icon-change.down { color: var(--danger); }

/* ════════════════════════════════════════════════════════════
   CHARTS & GRAPHS
   ════════════════════════════════════════════════════════════ */
.chart-container {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

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

.chart-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text);
}

.chart-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-actions {
  display: flex;
  gap: 6px;
}

.chart-body {
  position: relative;
  height: 280px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* Chart empty state */
.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.chart-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.chart-empty-text {
  font-size: var(--text-sm);
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════════
   DATA WIDGETS
   ════════════════════════════════════════════════════════════ */

/* Recent Activity Feed */
.activity-feed {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
}

.activity-feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.activity-feed-title {
  font-size: var(--text-md);
  font-weight: 600;
}

.activity-feed-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 10px;
  border-radius: 20px;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}

.activity-item:hover {
  background: rgba(45,122,51,0.02);
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  border-radius: var(--radius-xs);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.activity-icon.sale { background: var(--green-50); }
.activity-icon.user { background: rgba(30,136,229,0.1); }
.activity-icon.claim { background: var(--success-bg); }
.activity-icon.delete { background: var(--danger-bg); }

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-text {
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.5;
}

.activity-text strong {
  color: var(--green);
}

.activity-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* ════════════════════════════════════════════════════════════
   PROGRESS & MINI CHARTS
   ════════════════════════════════════════════════════════════ */

/* Circular progress */
.progress-ring {
  position: relative;
  width: 80px;
  height: 80px;
}

.progress-ring svg {
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: var(--border-light);
  stroke-width: 6;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--green);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease-out;
}

.progress-ring-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--green);
}

/* Mini bar chart */
.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 40px;
}

.mini-bar {
  flex: 1;
  background: var(--green-200);
  border-radius: 2px 2px 0 0;
  transition: var(--transition);
  min-height: 4px;
}

.mini-bar:hover {
  background: var(--green);
}

.mini-bar.highlight {
  background: var(--green);
}

/* ════════════════════════════════════════════════════════════
   DASHBOARD GRID LAYOUTS
   ════════════════════════════════════════════════════════════ */
.dashboard-grid {
  display: grid;
  gap: 20px;
}

.dashboard-grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 500px), 1fr));
}

.dashboard-grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
}

.dashboard-grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

/* ════════════════════════════════════════════════════════════
   WIDGET HEADER
   ════════════════════════════════════════════════════════════ */
.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.widget-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text);
}

.widget-actions {
  display: flex;
  gap: 6px;
}

.widget-action-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.widget-action-btn:hover {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-50);
}

/* ════════════════════════════════════════════════════════════
   FILTER BAR
   ════════════════════════════════════════════════════════════ */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group input,
.filter-group select {
  min-width: 140px;
}

.filter-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

/* ════════════════════════════════════════════════════════════
   SEARCH BAR
   ════════════════════════════════════════════════════════════ */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}

.search-bar input {
  padding-left: 38px;
  padding-right: 36px;
  width: 260px;
}

.search-bar .search-icon {
  position: absolute;
  left: 10px;
  font-size: 16px;
  color: var(--text-light);
  pointer-events: none;
}

.search-bar .search-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: 50%;
  transition: var(--transition);
}

.search-bar .search-clear:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ════════════════════════════════════════════════════════════
   DATE RANGE PICKER
   ════════════════════════════════════════════════════════════ */
.date-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-range-separator {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* ════════════════════════════════════════════════════════════
   OVERVIEW CARDS ROW
   ════════════════════════════════════════════════════════════ */
.overview-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.overview-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.overview-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle at top right, rgba(45,122,51,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.overview-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.overview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.overview-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.overview-trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.overview-trend.up {
  background: var(--success-bg);
  color: var(--success);
}

.overview-trend.down {
  background: var(--danger-bg);
  color: var(--danger);
}

.overview-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.overview-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ════════════════════════════════════════════════════════════
   LOADING STATES
   ════════════════════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--bg) 25%, var(--border-light) 50%, var(--bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-xs);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-text.short { width: 40%; }

.skeleton-text.medium { width: 70%; }

.skeleton-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ════════════════════════════════════════════════════════════
   BADGES
   ════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green { background: var(--success-bg); color: var(--success); }
.badge-red   { background: var(--danger-bg); color: var(--danger); }
.badge-blue  { background: var(--info-bg); color: var(--info); }
.badge-gold  { background: var(--warning-bg); color: var(--warning); }
.badge-gray  { background: var(--bg); color: var(--text-muted); }

/* ════════════════════════════════════════════════════════════
   TOOLTIP
   ════════════════════════════════════════════════════════════ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  background: var(--text);
  color: var(--bg-card);
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  z-index: 10;
}

[data-tooltip]:hover::after {
  opacity: 1;
}
