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

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #252525;
  --bg-input: #141414;
  --border-color: #333333;
  --border-hover: #444444;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #888888;
  --text-dim: #666666;
  --accent: #f97316;
  --accent-light: #fb923c;
  --glow: rgba(249, 115, 22, 0.15);
}

.light {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-tertiary: #e5e5e5;
  --bg-input: #ffffff;
  --border-color: #d4d4d4;
  --border-hover: #a3a3a3;
  --text-primary: #0a0a0a;
  --text-secondary: #404040;
  --text-muted: #737373;
  --text-dim: #a3a3a3;
  --accent: #ea580c;
  --accent-light: #f97316;
  --glow: rgba(249, 115, 22, 0.08);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background-color 0.4s ease, color 0.4s ease;
  background-image: 
    radial-gradient(ellipse at 20% 0%, rgba(249, 115, 22, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(251, 146, 60, 0.06) 0%, transparent 50%);
}

.light body {
  background-image: 
    radial-gradient(ellipse at 20% 0%, rgba(249, 115, 22, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(251, 146, 60, 0.04) 0%, transparent 50%);
}

/* Layout */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(8px);
}

.light .header {
  background: rgba(255, 255, 255, 0.85);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.logo-title {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, #f97316, #fb923c, #fdba74);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.last-update {
  font-size: 12px;
  color: var(--text-dim);
}

@media (max-width: 640px) {
  .last-update {
    display: none;
  }
}

/* Main */
.main {
  padding: 5px 0;
}

.mb-6 {
  margin-bottom: 10px;
}

.py-8 {
  padding: 32px 0;
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 5px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.card-hover:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  outline: none;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--accent-light);
  color: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px var(--glow);
}

.btn-sm {
  padding: 2px 8px;
  font-size: 12px;
}

/* Theme Toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle:hover {
  border-color: var(--accent-light);
  transform: rotate(15deg) scale(1.05);
  box-shadow: 0 4px 12px var(--glow);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  color: var(--accent-light);
}

/* Model Selector */
.model-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.model-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.select-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.select-input:focus {
  outline: none;
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px var(--glow);
}

.model-info {
  display: flex;
  gap: 8px;
  font-size: 12px;
}

.badge {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: monospace;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.05);
  border-color: rgba(245, 158, 11, 0.2);
  color: rgba(245, 158, 11, 0.8);
}

.model-details {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 5px;
}

.stat-highlight {
  box-shadow: 0 0 20px var(--glow);
  border-color: rgba(249, 115, 22, 0.15);
}

.stat-icon {
  font-size: 12px;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.gradient-text {
  background: linear-gradient(135deg, #f97316, #fb923c, #fdba74);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Cost Estimation */
.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.section-header h3 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.cost-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .cost-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.cost-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
}

.cost-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.cost-value {
  font-size: 16px;
  font-weight: 600;
}

.cost-value.green {
  color: rgba(52, 211, 153, 0.9);
}

.cost-value.red {
  color: rgba(251, 113, 133, 0.9);
}

.cost-detail {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Usage Bar */
.usage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.usage-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.progress-bar {
  height: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: all 0.3s ease-out;
  background: #6366f1;
}

/* Samples */
.samples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 1024px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 768px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Textarea */
.textarea {
  width: 100%;
  height: 256px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px;
  color: var(--text-primary);
  font-family: monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  transition: all 0.2s;
}

.textarea:focus {
  outline: none;
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px var(--glow);
}

.textarea::placeholder {
  color: var(--text-dim);
}

/* Token Container */
.token-container {
  height: 266px;
  overflow: auto;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  font-size: 14px;
}

.empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.token-chip {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid;
  font-size: 12px;
  font-family: monospace;
  cursor: default;
  transition: all 0.15s;
  animation: tokenAppear 0.2s ease-out forwards;
}

@keyframes tokenAppear {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.token-chip:hover {
  filter: brightness(1.2);
  transform: scale(1.05);
}

/* Tooltip for tokens */
.token-tooltip {
  position: fixed;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-family: monospace;
  color: var(--text-primary);
  pointer-events: none;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  max-width: 300px;
  word-wrap: break-word;
}

.token-tooltip-row {
  display: flex;
  gap: 8px;
  margin: 2px 0;
}

.token-tooltip-label {
  color: var(--text-muted);
  min-width: 50px;
}

.token-tooltip-value {
  color: var(--accent-light);
}

/* Token Colors - непрозрачные для лучшей читаемости */
.token-0 { background: rgba(249, 115, 22, 0.85); border-color: rgba(249, 115, 22, 1); color: #ffffff; }
.token-1 { background: rgba(234, 88, 12, 0.85); border-color: rgba(234, 88, 12, 1); color: #ffffff; }
.token-2 { background: rgba(34, 197, 94, 0.85); border-color: rgba(34, 197, 94, 1); color: #ffffff; }
.token-3 { background: rgba(59, 130, 246, 0.85); border-color: rgba(59, 130, 246, 1); color: #ffffff; }
.token-4 { background: rgba(14, 165, 233, 0.85); border-color: rgba(14, 165, 233, 1); color: #ffffff; }
.token-5 { background: rgba(6, 182, 212, 0.85); border-color: rgba(6, 182, 212, 1); color: #ffffff; }
.token-6 { background: rgba(20, 184, 166, 0.85); border-color: rgba(20, 184, 166, 1); color: #ffffff; }
.token-7 { background: rgba(16, 185, 129, 0.85); border-color: rgba(16, 185, 129, 1); color: #ffffff; }
.token-8 { background: rgba(245, 158, 11, 0.85); border-color: rgba(245, 158, 11, 1); color: #ffffff; }
.token-9 { background: rgba(244, 63, 94, 0.85); border-color: rgba(244, 63, 94, 1); color: #ffffff; }
.token-10 { background: rgba(236, 72, 153, 0.85); border-color: rgba(236, 72, 153, 1); color: #ffffff; }
.token-11 { background: rgba(168, 85, 247, 0.85); border-color: rgba(168, 85, 247, 1); color: #ffffff; }

/* Token Detail */
.token-detail-content {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 14px;
}

.token-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.token-detail-label {
  font-size: 12px;
  color: var(--text-muted);
}

.token-detail-value {
  font-family: monospace;
}

/* Comparison */
.section-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.comparison-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comparison-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  animation: fadeInRow 0.2s ease-out forwards;
}

@keyframes fadeInRow {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 1; transform: translateX(0); }
}

.comparison-row:hover {
  background: var(--bg-input);
}

.comparison-row.selected {
  background: rgba(249, 115, 22, 0.08);
  border: 1px solid rgba(249, 115, 22, 0.15);
}

.comparison-icon {
  font-size: 12px;
  width: 20px;
}

.comparison-name {
  font-size: 12px;
  font-weight: 500;
  width: 144px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.comparison-row.selected .comparison-name {
  color: var(--accent-light);
}

.comparison-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  overflow: hidden;
}

.comparison-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: all 0.3s;
  background: #374151;
}

.comparison-row.selected .comparison-bar-fill {
  background: #6366f1;
}

.comparison-cost {
  font-size: 12px;
  font-family: monospace;
  width: 96px;
  text-align: right;
  color: var(--text-muted);
}

.comparison-row.selected .comparison-cost {
  color: var(--accent-light);
}

/* Info Cards */
.info-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.info-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.info-card p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
}

/* SEO Intro Section */
.seo-intro {
  display: none;
  margin-bottom: 20px;
  padding: 15px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.seo-intro h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.seo-intro p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* FAQ Section */
.faq-section {
  margin-bottom: 20px;
  padding: 15px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.faq-section h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 15px;
  color: var(--text-primary);
}

.faq-item {
  margin-bottom: 15px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.faq-item:last-child {
  margin-bottom: 0;
}

.faq-item h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.faq-item p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Footer */
.footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  padding: 24px 0;
}

.footer p {
  margin-top: 4px;
}

/* Utilities */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 12px; }
.text-center { text-align: center; }
