/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: ghostwhite;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
}

/* Title */
.title {
  text-align: center;
  margin-bottom: 32px;
  font-size: 3rem;
  font-weight: bold;
  color: rgba(107, 107, 107, 1);
}

.coffee-icon {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.11);
  transition: box-shadow .18s, transform .18s;
  vertical-align: middle;
  margin-right: 2px;
  margin-bottom: 10px;
}

/* Controls */
.controls {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.label {
  font-weight: 600;
  color: rgba(107, 107, 107, 1);
}

.select {
  padding: 8px 16px;
  border: 2px solid #6B6B6B;
  border-radius: 6px;
  background: white;
  color: rgba(107, 107, 107, 1);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.select:focus {
  outline: none;
}

.btn {
  border: 1px solid #6B6B6B;
  padding: 8px 16px;
  font-weight: 600;
  border-radius: 6px;
  background: #6B6B6B;
  color: white;
  /* border: none; */
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  border: 1px solid #6B6B6B;
  background: white;
  color: #6B6B6B;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: rgba(107, 107, 107, 1);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.connected {
  background: #10b981;
}

.status-dot.disconnected {
  background: #ef4444;
}

.auto-refresh {
  margin-left: auto;
  color: rgba(107, 107, 107, 1);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-size: 2.25rem;
  font-weight: bold;
  color: #6B6B6B;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (min-width: 1024px) {
  .content-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(1, 1fr);
    align-items: start;
  }
}

.card {
  background: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  height: 600px;
  max-height: 600px;
  overflow: hidden;
}

.card-title {
  color: #1f2937;
  margin-bottom: 20px;
  font-size: 1.5rem;
  font-weight: 600;
  border-bottom: 2px solid #6B6B6B;
  padding-bottom: 12px;
  flex-shrink: 0;
}

/* Terminal List */
.terminals-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.terminals-list::-webkit-scrollbar {
  width: 8px;
}

.terminals-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.terminals-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.terminals-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.terminal-item {
  display: flex;
  padding: 16px;
  border-radius: 8px;
  border: 2px solid;
  transition: all 0.2s;
  min-width: 0;
  flex-shrink: 0;
  /* min-height: 100px; */
}

.terminal-item.available {
  background: #f0fdf4;
  border-color: #10b981;
}

.terminal-item.in-use {
  background: #fef2f2;
  border-color: #ef4444;
}

.terminal-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

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

.terminal-id {
  font-weight: bold;
  font-size: 1.25rem;
  color: #1f2937;
  word-break: break-word;
  overflow-wrap: break-word;
}

.terminal-status-section {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  margin-left: 16px;
}

.terminal-details {
  font-size: 0.875rem;
  color: #6b7280;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  line-height: 1.5;
}

.terminal-request-id {
  font-size: 0.75rem;
  color: #9ca3af;
  font-family: monospace;
  display: block;
  margin-top: 4px;
}

.terminal-duration {
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
}

.terminal-status-badge {
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
}

.terminal-status-badge.available {
  background: #10b981;
}

.terminal-status-badge.in-use {
  background: #ef4444;
}

/* Queue List */
.queue-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.queue-list::-webkit-scrollbar {
  width: 8px;
}

.queue-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.queue-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.queue-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.empty-message {
  text-align: center;
  padding: 20px;
  color: #6b7280;
}

.queue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: box-shadow 0.2s;
  min-width: 0;
  flex-shrink: 0;
}

.queue-item:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.queue-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.queue-request-id {
  font-weight: 600;
  color: #1f2937;
  font-family: monospace;
  font-size: 0.875rem;
  word-break: break-word;
  overflow-wrap: break-word;
}

.queue-details {
  font-size: 0.75rem;
  color: #6b7280;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.queue-wait-time {
  color: #9ca3af;
}

.queue-status-badge {
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.queue-status-badge.waiting {
  background: #fef3c7;
  color: #92400e;
}

.queue-status-badge.acquiring {
  background: #dbeafe;
  color: #1e40af;
}

.queue-status-badge.acquired {
  background: #d1fae5;
  color: #065f46;
}

.queue-status-badge.completed {
  background: #e5e7eb;
  color: #374151;
}

.queue-status-badge.failed {
  background: #fee2e2;
  color: #991b1b;
}

/* Chart */
.chart-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#usageChart {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* Responsive */
@media (max-width: 640px) {
  .title {
    font-size: 2rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .auto-refresh {
    margin-left: 0;
    width: 100%;
  }

  .card {
    height: 500px;
    max-height: 500px;
  }
}
