/* PromptPrice - Dark Theme Stylesheet */

:root {
  --bg-primary:    #0a0a0a;
  --bg-card:       #1a1a1a;
  --bg-hover:      #222222;
  --border:        #2a2a2a;
  --accent:        #6366f1;
  --accent-dim:    #4f51c4;
  --accent-faint:  rgba(99, 102, 241, 0.08);
  --text-primary:  #e8e8e8;
  --text-muted:    #888888;
  --text-mono:     'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
  --font-ui:       -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius:        6px;
  --transition:    150ms ease;
  --green:         #4ade80;
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-ui);
  line-height: 1.5;
  min-height: 100vh;
}

/* ---- Header ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.tagline {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* ---- Main Layout ---- */

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ---- Section headings ---- */

.section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ---- Input Section ---- */

.input-section {
  margin-bottom: 28px;
}

.prompt-textarea {
  width: 100%;
  min-height: 180px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--text-mono);
  font-size: 13px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
}

.prompt-textarea::placeholder {
  color: #444;
}

.prompt-textarea:focus {
  border-color: var(--accent);
}

.stats-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 2px;
  font-family: var(--text-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.stats-bar .stat-tokens {
  color: var(--accent);
  font-weight: 600;
}

/* ---- Model Selector ---- */

.model-selector-section {
  margin-bottom: 24px;
}

.model-selector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.model-selector-controls {
  display: flex;
  gap: 12px;
  font-size: 12px;
}

.model-selector-controls a {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.model-selector-controls a:hover {
  text-decoration: underline;
}

#model-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: flex-start;
}

.provider-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.provider-group-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  min-width: 56px;
  padding-top: 2px;
}

.model-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  user-select: none;
}

.model-pill:hover {
  background: var(--bg-hover);
  border-color: #444;
}

.model-pill input[type="checkbox"] {
  width: 13px;
  height: 13px;
  accent-color: var(--accent);
  cursor: pointer;
}

.model-pill:has(input:checked) {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
}

/* ---- Batch Multiplier ---- */

.batch-section {
  margin-bottom: 28px;
}

.batch-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.batch-controls label {
  font-size: 13px;
  color: var(--text-muted);
}

.batch-select,
.batch-custom {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

.batch-select {
  padding-right: 28px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.batch-select:focus,
.batch-custom:focus {
  border-color: var(--accent);
}

.batch-custom {
  width: 100px;
  display: none;
}

.batch-label {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* ---- Results Section ---- */

.results-section {
  margin-bottom: 20px;
}

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

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.copy-btn:hover {
  color: var(--text-primary);
  border-color: #555;
  background: var(--bg-hover);
}

.copy-btn.copied {
  color: var(--green);
  border-color: var(--green);
}

/* ---- Table ---- */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.results-table thead {
  background: #111;
}

.results-table th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}

.results-table th:hover {
  color: var(--text-primary);
}

.results-table th[data-col]::after {
  content: ' ↕';
  opacity: 0.3;
  font-size: 10px;
}

.results-table th.sort-asc[data-col]::after {
  content: ' ↑';
  opacity: 1;
  color: var(--accent);
}

.results-table th.sort-desc[data-col]::after {
  content: ' ↓';
  opacity: 1;
  color: var(--accent);
}

.results-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.results-table tbody tr:last-child td {
  border-bottom: none;
}

.results-table tbody tr {
  transition: background var(--transition);
}

.results-table tbody tr:hover {
  background: var(--bg-hover);
}

.results-table tbody tr.row-cheapest {
  background: rgba(99, 102, 241, 0.04);
}

.results-table tbody tr.row-cheapest:hover {
  background: rgba(99, 102, 241, 0.08);
}

.col-name {
  font-weight: 500;
  white-space: nowrap;
}

.model-name {
  margin-right: 6px;
}

.cheapest-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.15);
  padding: 2px 7px;
  border-radius: 10px;
  vertical-align: middle;
}

.provider-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.provider-anthropic  { background: rgba(204, 120, 50, 0.15); color: #e8945a; }
.provider-openai     { background: rgba(74, 222, 128, 0.12); color: #4ade80; }
.provider-google     { background: rgba(96, 165, 250, 0.12); color: #60a5fa; }
.provider-deepseek   { background: rgba(167, 139, 250, 0.12); color: #a78bfa; }
.provider-xai        { background: rgba(248, 113, 113, 0.12); color: #f87171; }

.mono {
  font-family: var(--text-mono);
  font-size: 12px;
  white-space: nowrap;
}

.total-cheapest {
  color: var(--accent);
  font-weight: 600;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
  font-style: italic;
}

/* ---- Footer ---- */

.site-footer {
  text-align: center;
  padding: 32px 24px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ---- Responsive: Mobile ---- */

@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    height: auto;
    padding: 14px 16px;
    gap: 2px;
    align-items: flex-start;
  }

  .tagline {
    font-size: 12px;
  }

  .main {
    padding: 20px 16px 60px;
  }

  /* On mobile, collapse table to cards */
  .table-wrap {
    border: none;
  }

  .results-table thead {
    display: none;
  }

  .results-table tbody tr {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 14px;
  }

  .results-table tbody tr.row-cheapest {
    border-color: var(--accent);
  }

  .results-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: none;
    font-size: 13px;
  }

  .results-table td::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    min-width: 80px;
  }

  .col-name {
    font-size: 14px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border) !important;
    margin-bottom: 4px;
  }

  .col-name::before {
    display: none;
  }

  .batch-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ---- Scrollbar ---- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}
