@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: transparent;
  user-select: none;
  overflow: hidden;
}

.dashboard-container {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 280px;
  background: rgba(15, 23, 35, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  color: #ffffff;
  z-index: 9999;
  overflow: visible;
  will-change: transform;
  transition: width 0.3s ease, height 0.3s ease;
}
/* ... existing styles ... */

/* Mute Button Styles */
.btn-mute {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 11px;
}

.btn-mute:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.btn-mute.muted {
  color: #f87171;
  background: rgba(248, 113, 113, 0.15);
}

/* Updated Inventory Header */
.inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

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

/* Threshold Container & Dropdown */
.threshold-container {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.threshold-container i {
  font-size: 9px;
  color: #94a3b8;
}

.threshold-dropdown {
  background: transparent;
  color: #ffffff;
  border: none;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  padding: 0;
}

.threshold-dropdown option {
  background: #0f1723; /* Dark dashboard background */
  color: #ffffff;
}
.dashboard-container.horizontal {
  width: 560px;
  height: auto;
}

.dashboard-container.horizontal .dashboard-content {
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
}

.dashboard-container.horizontal .inventory-overview,
.dashboard-container.horizontal .bxp-section {
  margin: 0;
  padding: 0;
}

.dashboard-container.horizontal .left-column {
  display: flex;
  flex-direction: column;
  flex: 0 0 140px;
  gap: 0;
}

.dashboard-container.horizontal .ore-grid {
  flex: 1;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dashboard-container.horizontal .performance-section {
  display: none;
}


.bxp-section {
  margin-top: 0;
}

.bxp-card {
  background: rgba(147, 51, 234, 0.1);
  border: 1px solid rgba(147, 51, 234, 0.2);
  border-radius: 6px;
  padding: 6px;
  position: relative;
  overflow: hidden;
}

.bxp-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #9333ea;
}

.bxp-simple {
  text-align: center;
}

.bxp-simple .bxp-value {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
}

.bxp-simple .bxp-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dashboard-container.minimized {
  width: 370px;
  height: 64px;
  overflow: visible;
}

.dashboard-container.horizontal.minimized {
  height: 64px;
  width: 560px;
}

.dashboard-container.minimized .dashboard-content {
  display: none;
}

.dashboard-header {
  background: rgba(30, 40, 55, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  cursor: move;
  user-select: none;
  overflow: visible;
}

.header-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.header-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 2px;
  padding-bottom: 2px;
}

.data-status {
  min-width: 46px;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 5px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: #dbeafe;
  background: rgba(59, 130, 246, 0.2);
  flex-shrink: 0;
}

.data-status.live {
  color: #bbf7d0;
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.35);
}

.data-status.delayed {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.35);
}

.data-status.stale {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.35);
}

.header-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  font-size: 15px;
  color: #e2e8f0;
  min-width: 0;
  text-align: center;
}

.header-title span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-title i {
  color: #f59e0b;
  font-size: 14px;
}

.header-actions {
  display: flex;
  gap: 4px;
  position: relative;
  flex-shrink: 0;
}

.header-actions > button {
  width: 22px;
  height: 22px;
  font-size: 11px;
}

.btn-minimize,
.btn-layout,
.btn-reset,
.btn-copy {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 11px;
}

.btn-minimize:hover,
.btn-layout:hover,
.btn-reset:hover,
.btn-copy:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.header-actions button {
  position: relative;
}

.header-actions button[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: auto;
  bottom: calc(100% + 8px);
  left: 0;
  right: auto;
  transform: translateX(0);
  width: max-content;
  max-width: min(220px, calc(100vw - 32px));
  min-width: 140px;
  padding: 9px 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(11, 20, 36, 0.98), rgba(15, 28, 48, 0.98));
  border: 1px solid rgba(125, 167, 219, 0.45);
  color: #e6f0ff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(23, 42, 73, 0.55) inset;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 10001;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

/* Only far-right buttons open tooltip inward to the left. */
.header-actions button:nth-last-child(-n + 3)[data-tooltip]::after {
  left: auto;
  right: 0;
}

.header-actions button[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(-1px);
}

.btn-reset {
  color: #fca5a5;
}

.btn-copy {
  color: #a7f3d0;
}

.dashboard-content {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dashboard-container:not(.horizontal) .left-column {
  display: contents;
}

.dashboard-container.horizontal .left-column {
  display: flex;
  flex-direction: column;
  flex: 0 0 140px;
  gap: 2px; 
}

.inventory-card {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 6px;
  padding: 8px;
}

.inventory-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-weight: 600;
  color: #93c5fd;
  font-size: 12px;
}

.inventory-header i {
  font-size: 12px;
}

.inventory-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  border-radius: 3px;
  position: relative;
  transition: background 0.5s ease;
}

.progress-fill.warn {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.progress-fill.danger {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.inventory-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inventory-warning {
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.18);
  color: #fecaca;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  animation: flash 1s infinite;
}

@keyframes flash {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

.inventory-card.alerting {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.15);
}

.inventory-text {
  font-weight: 600;
  font-size: 14px;
  color: #ffffff;
}

.inventory-capacity {
  font-size: 12px;
  color: #cbd5e1;
}

.ore-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ore-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 8px;
  position: relative;
  overflow: hidden;
}

.ore-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--ore-color);
}

.copper-card {
  --ore-color: #f59e0b;
  --ore-color-light: #fbbf24;
  border-color: rgba(245, 158, 11, 0.2);
}

.iron-card {
  --ore-color: #6b7280;
  --ore-color-light: #9ca3af;
  border-color: rgba(107, 114, 128, 0.2);
}

.ore-card:hover {
  border-color: var(--ore-color);
}

.ore-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.ore-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--ore-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
}

.ore-title h3 {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 1px;
}

.ore-subtitle {
  font-size: 10px;
  color: #94a3b8;
}

.ore-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.main-stat {
  text-align: center;
  padding: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.main-stat .stat-value {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 1px;
}

.stat-label {
  font-size: 9px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.performance-section {
  margin-top: 4px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-weight: 600;
  color: #e2e8f0;
  font-size: 11px;
}

.section-header i {
  color: #10b981;
  font-size: 11px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.metric-card {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 6px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.metric-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
}

.metric-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
  margin-bottom: 4px;
}

.metric-content {
  width: 100%;
}

.metric-value {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 1px;
}

.metric-label {
  font-size: 9px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-indicator {
  position: absolute;
  bottom: 8px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  color: #94a3b8;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.ore-zero {
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.2) !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  border-radius: 3px;
  padding: 2px 4px;
  font-weight: 700 !important;
}

@media (max-width: 480px) {
  .dashboard-container {
    width: 260px;
    left: 10px;
    top: 10px;
  }
  
  .dashboard-container.horizontal {
    width: 500px;
  }
  
  .ore-grid {
    grid-template-columns: 1fr;
  }
  
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Minimized stats bar ── */
.minimized-stats {
  display: none;
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-container.minimized .minimized-stats {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: #d1def0;
  text-align: right;
  max-width: none;
  flex: 0 0 82px;
  margin-left: 8px;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.dashboard-container.minimized .header-title span {
  display: inline;
}

.dashboard-container.minimized .header-content {
  gap: 4px;
}

.dashboard-container.minimized .header-top {
  justify-content: space-between;
  align-items: center;
}

.dashboard-container.minimized .header-title {
  font-size: 15px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
}

.dashboard-container.minimized .header-bottom {
  padding-top: 0;
  padding-bottom: 0;
  gap: 4px;
}

.dashboard-container.minimized .header-actions {
  gap: 3px;
}

.dashboard-container.minimized .header-actions > button,
.dashboard-container.minimized .btn-minimize,
.dashboard-container.minimized .btn-layout,
.dashboard-container.minimized .btn-reset,
.dashboard-container.minimized .btn-copy,
.dashboard-container.minimized .btn-autoexchange,
.dashboard-container.minimized .btn-opacity,
.dashboard-container.minimized .btn-mute {
  width: 20px;
  height: 20px;
  font-size: 10px;
}

.dashboard-container.minimized .data-status {
  display: none;
}

.dashboard-container.minimized #opacityBtn,
.dashboard-container.minimized #layoutBtn,
.dashboard-container.minimized #resetSessionBtn,
.dashboard-container.minimized #copySummaryBtn {
  display: none;
}

.dashboard-container.minimized .header-actions button[data-tooltip]::after {
  top: calc(100% + 6px);
  bottom: auto;
  left: 0;
  right: auto;
  transform: translateX(0);
  font-size: 11px;
  min-width: 0;
  max-width: min(150px, calc(100vw - 24px));
  padding: 6px 8px;
  white-space: nowrap;
}

.dashboard-container.minimized .header-actions button:nth-last-child(-n + 3)[data-tooltip]::after {
  left: 0;
  right: auto;
}

.dashboard-container.minimized .header-actions button:last-child[data-tooltip]::after {
  left: 0;
  right: auto;
}

/* ── Inventory ETA ── */
.inv-eta {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
  flex: 1;
  text-align: center;
}

/* ── Rate trend indicators ── */
.rate-trend {
  font-size: 9px;
  font-weight: 700;
  margin-left: 2px;
}

.trend-up   { color: #10b981; }
.trend-down { color: #ef4444; }
.trend-neutral { color: #6b7280; }

/* ── Waiting for data state ── */
.waiting-state {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #94a3b8;
  padding: 4px 2px;
}

.waiting-state i {
  color: #3b82f6;
  font-size: 10px;
}

/* ── Session summary toast ── */
.session-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(15, 23, 35, 0.97);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 8px;
  padding: 12px 14px;
  color: #ffffff;
  z-index: 10000;
  min-width: 180px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.3s ease;
}

.toast-title {
  font-size: 11px;
  font-weight: 700;
  color: #10b981;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.toast-body div {
  font-size: 11px;
  color: #cbd5e1;
  padding: 1px 0;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Auto-exchange toggle button ── */
.btn-autoexchange {
  background: rgba(241, 6, 6, 0.1);
  border: none;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff0000;
  cursor: pointer;
  font-size: 11px;
}

.btn-autoexchange:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.btn-autoexchange.active {
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
}

/* ── Opacity cycle button ── */
.btn-opacity {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 11px;
}

.btn-opacity:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}
