/* ==========================================================================
   llm_model_limits_widget.css
   Google AI Studio 50 Live Models Catalog & Free Tier Quota Counter Widget
   Standard: DSN-0001 / A2UI Glassmorphism / PRT-0160
   ========================================================================== */

:root {
  --llm-bg-card: rgba(15, 23, 42, 0.85);
  --llm-border: rgba(56, 189, 248, 0.2);
  --llm-accent: #38bdf8;
  --llm-accent-glow: rgba(56, 189, 248, 0.35);
  --llm-green: #10b981;
  --llm-amber: #f59e0b;
  --llm-purple: #a855f7;
  --llm-pink: #ec4899;
  --llm-gray-bg: rgba(30, 41, 59, 0.7);
  --llm-text-primary: #f8fafc;
  --llm-text-secondary: #94a3b8;
  --llm-text-muted: #64748b;
}

/* Header Trigger Button */
.model-limits-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.35), rgba(14, 165, 233, 0.2));
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
  user-select: none;
}

.model-limits-badge-btn:hover {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.55), rgba(14, 165, 233, 0.35));
  border-color: #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.model-limits-badge-btn .badge-pill {
  background: #0284c7;
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

/* Modal Overlay & Drawer Container */
.llm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.llm-modal-overlay.active {
  display: flex;
  opacity: 1;
}

.llm-modal-container {
  width: 95vw;
  max-width: 1280px;
  height: 90vh;
  max-height: 880px;
  background: #0b1120;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9), 0 0 40px rgba(56, 189, 248, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: llmModalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes llmModalSlideIn {
  from {
    transform: scale(0.96) translateY(12px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Modal Header */
.llm-modal-header {
  padding: 16px 24px;
  background: #090e1a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.llm-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.llm-modal-title h2 {
  font-size: 17px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.llm-modal-title .rid-pill {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
}

.llm-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.llm-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Top Telemetry Summary Banner */
.llm-telemetry-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  padding: 12px 24px;
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.llm-stat-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
}

.llm-stat-label {
  font-size: 10px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.llm-stat-value {
  font-size: 15px;
  font-weight: 800;
  color: #f8fafc;
  margin-top: 2px;
  font-family: monospace;
}

.llm-stat-sub {
  font-size: 9.5px;
  color: #10b981;
  margin-top: 2px;
}

/* Controls Bar: Search & Category Filter Pills */
.llm-controls-bar {
  padding: 12px 24px;
  background: #090e1a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.llm-search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 420px;
}

.llm-search-input {
  width: 100%;
  background: #131b2e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 7px 12px 7px 32px;
  color: #f8fafc;
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.llm-search-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.llm-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #64748b;
  pointer-events: none;
}

.llm-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.llm-cat-tab {
  background: #141d33;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.llm-cat-tab:hover {
  background: #1e293b;
  color: #f8fafc;
}

.llm-cat-tab.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 700;
}

/* Scrollable Models Grid */
.llm-models-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  background: #080c16;
}

/* Individual Model Card */
.llm-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.llm-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 15px rgba(56, 189, 248, 0.1);
}

.llm-card.active-selected {
  border-color: #10b981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08), #0f172a);
}

/* Card Header: LLM RID, Name, Badges */
.llm-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.llm-card-name-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.llm-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.llm-rid-badge {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.llm-tier-pill {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.llm-tier-pro {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.llm-tier-flash {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.4);
}

.llm-tier-lite {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.llm-tier-media {
  background: rgba(236, 72, 153, 0.2);
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.4);
}

.llm-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.25;
}

.llm-card-api-id {
  font-size: 10.5px;
  font-family: monospace;
  color: #64748b;
  word-break: break-all;
}

/* Free Tier Specs Matrix */
.llm-specs-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: #090e1a;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  padding: 8px 10px;
}

.llm-spec-item {
  display: flex;
  flex-direction: column;
}

.llm-spec-title {
  font-size: 9px;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 700;
}

.llm-spec-data {
  font-size: 11.5px;
  font-weight: 800;
  color: #e2e8f0;
  font-family: monospace;
  margin-top: 1px;
}

/* Quota Counter Live Box */
.llm-quota-counter-box {
  background: #111a2e;
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.llm-quota-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.llm-quota-title {
  font-size: 10.5px;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.llm-quota-reset {
  font-size: 9.5px;
  color: #94a3b8;
  font-family: monospace;
}

.llm-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.llm-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #38bdf8);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.llm-progress-fill.warn {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.llm-counter-metrics {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #cbd5e1;
  font-family: monospace;
}

.llm-counter-metric span.metric-val {
  font-weight: 800;
  color: #f8fafc;
}

/* Action Buttons */
.llm-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.llm-btn-select {
  flex: 2;
  background: #0284c7;
  border: 1px solid #38bdf8;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
}

.llm-btn-select:hover {
  background: #0369a1;
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.4);
}

.llm-btn-select.selected {
  background: #059669;
  border-color: #10b981;
}

.llm-btn-ping {
  flex: 1;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s;
}

.llm-btn-ping:hover {
  background: #334155;
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Modal Footer */
.llm-modal-footer {
  padding: 14px 24px;
  background: #090e1a;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #94a3b8;
}

.llm-footer-badge {
  font-family: monospace;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  padding: 3px 8px;
  border-radius: 4px;
}

/* Inline Floating HUD near Chat Input */
.llm-active-hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 10.5px;
  font-family: monospace;
  color: #94a3b8;
}

.llm-active-hud-bar strong {
  color: #38bdf8;
}

.llm-active-hud-counter {
  color: #10b981;
  font-weight: 700;
}
