/* ============================================
   GitHub Copilot Billing Calculator — Styles
   ============================================ */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-card: #1c2128;
  --border: #30363d;
  --border-light: #3d444d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent-blue: #58a6ff;
  --accent-green: #3fb950;
  --accent-orange: #d29922;
  --accent-red: #f85149;
  --accent-purple: #bc8cff;
  --accent-pink: #f778ba;
  --gradient-pro: linear-gradient(135deg, #1f6feb, #388bfd);
  --gradient-proplus: linear-gradient(135deg, #8b5cf6, #bc8cff);
  --gradient-business: linear-gradient(135deg, #238636, #3fb950);
  --gradient-enterprise: linear-gradient(135deg, #d29922, #e3b341);
  --panel-width: 380px;
  --header-height: 120px;
  --radius: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Header */
header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 20px 32px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1600px;
  margin: 0 auto;
}

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

.logo svg {
  color: var(--text-primary);
}

.logo h1 {
  font-size: 1.4rem;
  font-weight: 600;
  background: linear-gradient(90deg, var(--text-primary), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  max-width: 1600px;
  margin: 8px auto 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Toggle Switch */
.billing-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.3s;
}

.toggle-label.active {
  color: var(--accent-green);
  font-weight: 600;
}

.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 28px;
  transition: 0.3s;
}

.slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .slider {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

input:checked + .slider::before {
  transform: translateX(24px);
  background: white;
}

/* Dashboard Layout */
.dashboard-layout {
  display: flex;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-height));
}

.main-content {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
}

/* Transition Banner */
.transition-banner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.1), rgba(188, 140, 255, 0.05));
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 32px;
}

.banner-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.banner-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.banner-text strong {
  color: var(--text-primary);
}

/* Plan Cards */
.plan-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}

.plan-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
}

.plan-card.featured {
  border-color: var(--accent-green);
  box-shadow: 0 0 20px rgba(63, 185, 80, 0.1);
}

.plan-header {
  padding: 20px;
  position: relative;
}

.plan-header.pro { background: var(--gradient-pro); }
.plan-header.proplus { background: var(--gradient-proplus); }
.plan-header.business { background: var(--gradient-business); }
.plan-header.enterprise { background: var(--gradient-enterprise); }

.featured-badge {
  position: absolute;
  top: 8px;
  right: 12px;
  background: rgba(255,255,255,0.2);
  color: white;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.plan-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: white;
  margin-bottom: 4px;
}

.plan-price {
  font-size: 1.8rem;
  font-weight: 700;
  color: white;
}

.plan-price span {
  font-size: 0.8rem;
  font-weight: 400;
  opacity: 0.8;
}

.plan-body {
  padding: 16px 20px;
}

.plan-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.seat-detail {
  display: none;
}

body.seat-mode .seat-detail { display: flex; }
body.seat-mode .token-detail { display: none; }

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.detail-row span {
  color: var(--text-secondary);
}

.detail-row strong {
  color: var(--text-primary);
  font-weight: 600;
}

.detail-row.highlight {
  background: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.2);
  border-radius: 6px;
  padding: 6px 8px;
  margin: -2px -8px;
}

.pool-yes {
  color: var(--accent-green) !important;
}

/* Comparison Section */
.comparison-section {
  margin-bottom: 32px;
}

.comparison-section h2 {
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.comparison-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
}

.comparison-card.old-model { border-top: 3px solid var(--text-muted); }
.comparison-card.new-model { border-top: 3px solid var(--accent-green); }

.comparison-card h3 {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.total-cost {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.cost-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.cost-breakdown {
  text-align: left;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.cost-breakdown div {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--bg-tertiary);
}

.savings-indicator {
  margin-top: 16px;
  padding: 16px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  display: none;
}

.savings-indicator.savings {
  display: block;
  background: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.3);
  color: var(--accent-green);
}

.savings-indicator.overspend {
  display: block;
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: var(--accent-red);
}

.savings-indicator.neutral {
  display: block;
  background: rgba(210, 153, 34, 0.1);
  border: 1px solid rgba(210, 153, 34, 0.3);
  color: var(--accent-orange);
}

/* Pricing Table */
.pricing-table-section {
  margin-bottom: 32px;
}

.pricing-table-section h2 {
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.section-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

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

.pricing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.pricing-table thead {
  background: var(--bg-tertiary);
}

.pricing-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pricing-table td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  color: var(--text-primary);
}

.pricing-table tbody tr {
  background: var(--bg-card);
  transition: background 0.15s;
}

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

.cost-tier {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.cost-tier.low { background: rgba(63, 185, 80, 0.15); color: var(--accent-green); }
.cost-tier.mid { background: rgba(210, 153, 34, 0.15); color: var(--accent-orange); }
.cost-tier.high { background: rgba(248, 81, 73, 0.15); color: var(--accent-red); }
.cost-tier.premium { background: rgba(188, 140, 255, 0.15); color: var(--accent-purple); }

/* Model Comparison */
.model-comparison-section {
  margin-bottom: 32px;
}

.model-comparison-section h2 {
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.comparison-selectors {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.compare-select {
  flex: 1;
}

.compare-select label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.compare-select select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
}

.compare-select select:focus {
  border-color: var(--accent-blue);
}

.compare-vs {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-muted);
  padding-top: 20px;
}

.compare-scenario {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.compare-scenario label {
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.compare-scenario input[type="range"] {
  flex: 1;
  height: 4px;
  background: var(--bg-primary);
  border-radius: 2px;
  -webkit-appearance: none;
  outline: none;
}

.compare-scenario input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent-blue);
  border-radius: 50%;
  cursor: pointer;
}

.compare-scenario span {
  color: var(--accent-blue);
  font-weight: 600;
  min-width: 50px;
  text-align: right;
}

.compare-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 16px;
}

.compare-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.compare-col h4 {
  font-size: 1rem;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.compare-col .compare-provider {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.compare-col .compare-tier {
  margin-bottom: 16px;
}

.compare-col .compare-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--bg-tertiary);
}

.compare-col .compare-row span:first-child {
  color: var(--text-secondary);
}

.compare-col .compare-row strong {
  color: var(--text-primary);
}

.compare-col .compare-row.highlight strong {
  color: var(--accent-green);
  font-size: 1rem;
}

.compare-col .compare-row.cost-high strong {
  color: var(--accent-red);
}

.compare-col.winner {
  border-color: var(--accent-green);
  box-shadow: 0 0 16px rgba(63, 185, 80, 0.1);
}

.compare-verdict {
  padding: 16px 24px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  background: rgba(63, 185, 80, 0.08);
  border: 1px solid rgba(63, 185, 80, 0.2);
  color: var(--accent-green);
}

/* Best Practices */
.best-practices {
  margin-bottom: 32px;
}

.best-practices h2 {
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.practices-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.practice-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s;
}

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

.practice-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.practice-card h4 {
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.practice-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.6;
}

.ref-link {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.ref-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* References */
.references h2 {
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.ref-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.ref-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}

.ref-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
}

.ref-source {
  font-size: 0.72rem;
  color: var(--accent-blue);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.ref-title {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.4;
}

.ref-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Side Panel */
.side-panel {
  width: var(--panel-width);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  padding: 24px;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.panel-header p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.panel-section {
  margin-bottom: 18px;
}

.panel-section label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.panel-section select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
}

.panel-section select:focus {
  border-color: var(--accent-blue);
}

.panel-section input[type="range"] {
  width: 100%;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  margin-top: 4px;
}

.panel-section input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent-blue);
  border-radius: 50%;
  cursor: pointer;
}

.range-value {
  text-align: right;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-blue);
  margin-top: 4px;
}

.range-value input[type="number"] {
  width: 80px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent-blue);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 8px;
  text-align: right;
  outline: none;
}

.range-value input[type="number"]:focus {
  border-color: var(--accent-blue);
}

.panel-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* Panel Results */
.panel-results {
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.panel-results h3 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.82rem;
}

.result-row span {
  color: var(--text-secondary);
}

.result-row strong {
  color: var(--text-primary);
}

.overage-row strong {
  color: var(--accent-red);
}

.result-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 6px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

.result-total span {
  font-weight: 600;
  color: var(--text-primary);
}

.result-total strong {
  color: var(--accent-green);
  font-size: 1.2rem;
}

.result-per-user {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0 0;
  font-size: 0.82rem;
}

.result-per-user span {
  color: var(--text-muted);
}

.result-per-user strong {
  color: var(--accent-purple);
}

/* Panel Insight */
.panel-insight {
  background: rgba(88, 166, 255, 0.08);
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.panel-insight h3 {
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.panel-insight p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Reset Button */
.reset-btn {
  width: 100%;
  margin-top: 16px;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.reset-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* Footer */
footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 24px 32px;
  text-align: center;
}

.footer-content p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.footer-content a {
  color: var(--accent-blue);
  text-decoration: none;
}

.footer-content a:hover {
  text-decoration: underline;
}

.disclaimer {
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* Responsive */
@media (max-width: 1400px) {
  .plan-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1100px) {
  .dashboard-layout {
    flex-direction: column;
  }
  .side-panel {
    width: 100%;
    position: static;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .ref-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  header {
    padding: 16px;
  }
  .header-content {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  .main-content {
    padding: 16px;
  }
  .plan-cards {
    grid-template-columns: 1fr;
  }
  .comparison-grid {
    grid-template-columns: 1fr;
  }
  .practices-grid {
    grid-template-columns: 1fr;
  }
  .ref-grid {
    grid-template-columns: 1fr;
  }
  .logo h1 {
    font-size: 1.1rem;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}
