:root {
  --color-primary: #00B894;
  --color-primary-glow: rgba(0, 184, 148, 0.4);
  --color-secondary: #55EFC4;
  --color-accent: #FDCB6E;
  --color-bg: #0A1F1C;
  --color-bg-panel: rgba(10, 31, 28, 0.6);
  --color-border: rgba(85, 239, 196, 0.2);
  --color-text: #FFFFFF;
  --color-text-muted: #A0B9B5;
  --color-danger: #FF7675;
  --color-warning: #FDCB6E;
  
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  
  --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  /* subtle radial background */
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(0, 184, 148, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(85, 239, 196, 0.05) 0%, transparent 40%);
  background-attachment: fixed;
  overflow: hidden;
}

.app-container {
  display: flex;
  height: 100vh;
  padding: 1rem;
  gap: 1.5rem;
}

/* Glassmorphism utility */
.glass-panel {
  background: var(--color-bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Sidebar */
.sidebar {
  width: 320px;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  gap: 2rem;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--color-primary);
}

.brand i {
  font-size: 2rem;
}

.brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.sidebar-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.preset-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.preset-item {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all var(--transition);
  border: 1px solid transparent;
  color: var(--color-text-muted);
}

.preset-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text);
}

.preset-item.active {
  background: rgba(0, 184, 148, 0.15);
  border-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: 500;
}

.preset-item i {
  font-size: 1.25rem;
}

.section-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}

#custom-spec {
  width: 100%;
  height: 100px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  padding: 0.75rem;
  font-family: monospace;
  font-size: 0.8rem;
  resize: vertical;
  margin-bottom: 0.75rem;
}

#custom-spec:focus {
  outline: none;
  border-color: var(--color-primary);
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--color-primary);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  padding-right: 0.5rem; /* For custom scrollbar space */
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.main-header {
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.main-header h2 {
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

.main-header p {
  color: var(--color-text-muted);
}

.header-actions {
  display: flex;
  gap: 1rem;
}

/* Buttons */
.btn {
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn.primary {
  background: var(--color-primary);
  color: #000;
  box-shadow: 0 4px 15px var(--color-primary-glow);
}

.btn.primary:hover {
  background: var(--color-secondary);
  box-shadow: 0 6px 20px var(--color-primary-glow);
  transform: translateY(-2px);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn.small {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn.icon-only {
  padding: 0.5rem;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(250px, auto);
  gap: 1.5rem;
  padding-bottom: 1.5rem;
}

.col-span-2 {
  grid-column: span 2;
}

.card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.card-header h3 {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.card-header h3 i {
  color: var(--color-primary);
}

/* Gauges Container */
.gauges-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.gauge-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gauge-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.gauge-name {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.method-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
  background: rgba(255,255,255,0.1);
}

.method-badge.get { color: #55EFC4; background: rgba(85,239,196,0.1); }
.method-badge.post { color: #FDCB6E; background: rgba(253,203,110,0.1); }
.method-badge.graphql { color: #e10098; background: rgba(225,0,152,0.1); }

.gauge-track {
  width: 100%;
  height: 12px;
  background: rgba(0,0,0,0.4);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.gauge-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 10px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s;
  position: relative;
  overflow: hidden;
}

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

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

.gauge-fill.warning {
  background: var(--color-warning);
}

.gauge-fill.danger {
  background: var(--color-danger);
}

/* Token Bucket Visual */
.bucket-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 1rem;
}

.bucket-stats, .bucket-refill {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

#current-tokens {
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.1rem;
}

.bucket-visual {
  width: 140px;
  height: 180px;
  border: 4px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 20px 20px;
  position: relative;
  overflow: hidden;
  background: rgba(0,0,0,0.2);
}

.bucket-water {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 80%; /* dynamically set */
  background: linear-gradient(180deg, var(--color-secondary) 0%, var(--color-primary) 100%);
  transition: height 0.3s ease-out;
  border-radius: 0 0 16px 16px;
}

/* Calculator & Code block */
.calculator {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.calc-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.calc-row label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.calc-row input {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  color: var(--color-text);
  font-family: 'Inter', sans-serif;
}

.calc-result {
  margin-top: 0.5rem;
  padding: 1rem;
  background: rgba(0, 184, 148, 0.1);
  border: 1px solid rgba(0, 184, 148, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.5;
  display: none;
}

.code-block-container {
  background: #050d0c;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  position: relative;
  overflow: hidden;
  flex: 1;
  margin-top: 1rem;
}

.code-block {
  padding: 1.5rem;
  font-family: monospace;
  font-size: 0.85rem;
  color: #a9dc76;
  white-space: pre-wrap;
  height: 100%;
  overflow-y: auto;
}

#btn-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

.cost-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.tier-selector {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.tier-selector label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.cost-estimate {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cost-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-accent);
}

/* Responsive */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .col-span-2 {
    grid-column: span 1;
  }
  .card[style*="grid-row"] {
    grid-row: auto !important;
  }
}
