/* ============================================================================
   Quota System Styles
   Uses the app-shell CSS variable system for theme compatibility.
   ============================================================================ */

/* --- Inline Quota Gate (replaces content area) --- */

.quota-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 32px;
  min-height: 320px;
  max-width: 560px;
  margin: 60px auto;
  border-radius: var(--radius, 8px);
  background: var(--bg-elev, #1e1e2e);
  border: 1px solid var(--border, #2a2a3a);
}

.quota-gate__icon {
  font-size: 36px;
  color: var(--accent, #6c8cff);
  margin-bottom: 16px;
  opacity: 0.8;
}

.quota-gate--blocked .quota-gate__icon {
  color: var(--muted, #888);
}

.quota-gate__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text, #e4e4e8);
  margin: 0 0 8px;
}

.quota-gate__message {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted, #a0a0b0);
  margin: 0 0 20px;
  max-width: 440px;
}

.quota-gate__items {
  margin-bottom: 20px;
}

.quota-gate__items-label {
  font-size: 12px;
  color: var(--muted, #a0a0b0);
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quota-gate__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.quota-gate__chip {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  background: var(--bg, #161622);
  color: var(--text, #e4e4e8);
  border: 1px solid var(--border, #2a2a3a);
  font-family: var(--font-mono, 'SF Mono', Menlo, monospace);
}

.quota-gate__actions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.quota-gate__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: filter 0.15s, background 0.15s;
}

.quota-gate__btn--primary {
  background: var(--accent, #0964A0);
  color: #fff;
}
.quota-gate__btn--primary:hover {
  filter: brightness(1.15);
  color: #fff;
}

.quota-gate__footer {
  color: var(--muted, #a0a0b0);
  font-size: 13px;
}
.quota-gate__footer p {
  margin: 4px 0;
}
.quota-gate__reset {
  font-size: 12px;
}
.quota-gate__comeback {
  font-size: 13px;
  opacity: 0.7;
}

/* --- Modal Quota Gate (overlay) --- */

.quota-gate-modal {
  position: fixed;
  inset: 0;
  z-index: 15000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.quota-gate-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.quota-gate-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.quota-gate-modal__dialog {
  position: relative;
  background: var(--bg-elev, #1e1e2e);
  border: 1px solid var(--border, #2a2a3a);
  border-radius: var(--radius, 8px);
  padding: 36px 32px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.quota-gate-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted, #888);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.quota-gate-modal__close:hover {
  color: var(--text, #e4e4e8);
  background: var(--bg, #161622);
}

.quota-gate-modal__icon {
  font-size: 32px;
  color: var(--accent, #6c8cff);
  margin-bottom: 12px;
}

.quota-gate-modal__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text, #e4e4e8);
  margin: 0 0 8px;
}

.quota-gate-modal__message {
  font-size: 14px;
  color: var(--muted, #a0a0b0);
  line-height: 1.5;
  margin: 0 0 20px;
}

.quota-gate-modal__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* --- Sidebar Usage Indicator (pinned to top of sidebar-scroll) --- */

#v2-quota-indicator:empty { display: none; }
#v2-quota-indicator {
  padding: 10px 12px 4px;
}

.quota-indicator {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg, #f7f9fc);
  border: 1px solid var(--border, #e5e7eb);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.quota-indicator:hover {
  background: var(--hover-bg, #eef1f6);
  border-color: var(--accent, #0964A0);
}
.dark-theme .quota-indicator {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}
.dark-theme .quota-indicator:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent, #6c8cff);
}

/* Evaluations row */
.qi-eval-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.qi-eval-detail {
  flex: 1;
  min-width: 0;
}
.qi-eval-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text, #1f2937);
  letter-spacing: 0.2px;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 4px;
}
.qi-info-icon {
  font-size: 10px;
  color: var(--muted, #9ca3af);
  opacity: 0.7;
}
.quota-indicator:hover .qi-info-icon {
  color: var(--accent, #0964A0);
  opacity: 1;
}
.qi-eval-sub {
  font-size: 11px;
  color: var(--muted, #6b7280);
  margin-top: 3px;
  line-height: 1;
}

/* Ring counter */
.qi-ring {
  position: relative;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.qi-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.qi-ring-bg {
  fill: none;
  stroke: rgba(0, 0, 0, 0.06);
  stroke-width: 3;
}
.dark-theme .qi-ring-bg {
  stroke: rgba(255, 255, 255, 0.08);
}
.qi-ring-fill {
  fill: none;
  stroke: var(--accent, #3b82f6);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}
.qi-ring-fill--warn { stroke: #f59e0b; }
.qi-ring-fill--full { stroke: #ef4444; }
.qi-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text, #1f2937);
  font-variant-numeric: tabular-nums;
}

/* --- Quota Info Modal (marketing-styled) --- */

.qi-info-modal {
  position: fixed;
  inset: 0;
  z-index: 15000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.qi-info-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.qi-info-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.qi-info-modal__dialog {
  position: relative;
  background: #fff;
  color: #1a1a1a;
  border-radius: 14px;
  padding: 0;
  width: 400px;
  max-width: 92vw;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
.dark-theme .qi-info-modal__dialog {
  background: #1a1f2e;
  color: #e6e9f0;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.qi-info-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0.7;
  z-index: 1;
}
.qi-info-modal__close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

/* Header — accent gradient banner */
.qi-info-modal__header {
  background: linear-gradient(135deg, #0964A0 0%, #0b7dcc 100%);
  color: #fff;
  padding: 28px 28px 24px;
  text-align: center;
}
.qi-info-modal__icon {
  font-size: 28px;
  margin-bottom: 8px;
  opacity: 0.9;
}
.qi-info-modal__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 4px;
}
.qi-info-modal__subtitle {
  font-size: 13px;
  margin: 0;
  opacity: 0.8;
}

/* Status pill */
.qi-info-modal__status {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding: 12px 28px;
  background: #f0f5fa;
  border-bottom: 1px solid #e5e7eb;
}
.dark-theme .qi-info-modal__status {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
}
.qi-info-modal__count {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent, #0964A0);
  font-variant-numeric: tabular-nums;
}
.qi-info-modal__count-label {
  font-size: 13px;
  color: var(--muted, #6b7280);
}

/* Body content */
.qi-info-modal__body {
  padding: 20px 28px 8px;
}
.qi-info-modal__body p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary, #4b5563);
  margin: 0 0 16px;
}
.dark-theme .qi-info-modal__body p {
  color: #a0a8ba;
}
.qi-info-modal__body strong {
  color: var(--text, #1f2937);
}
.dark-theme .qi-info-modal__body strong {
  color: #e6e9f0;
}

/* Feature checklist */
.qi-info-modal__features {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}
.qi-info-modal__features li {
  font-size: 12px;
  color: var(--text-secondary, #4b5563);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dark-theme .qi-info-modal__features li {
  color: #a0a8ba;
}
.qi-info-modal__features li i {
  color: #059669;
  font-size: 10px;
  flex-shrink: 0;
}

.qi-info-modal__divider {
  height: 1px;
  background: var(--border, #e5e7eb);
  margin: 4px 0 16px;
}
.dark-theme .qi-info-modal__divider {
  background: rgba(255, 255, 255, 0.06);
}

/* Pricing pitch */
.qi-info-modal__pitch {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 4px;
}
.qi-info-modal__price {
  flex-shrink: 0;
  text-align: center;
  line-height: 1;
}
.qi-info-modal__price-amount {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent, #0964A0);
}
.qi-info-modal__price-period {
  font-size: 13px;
  color: var(--muted, #6b7280);
  font-weight: 500;
}
.qi-info-modal__pitch p {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

/* CTA button */
.qi-info-modal__actions {
  padding: 16px 28px 24px;
}
.qi-info-modal__cta {
  display: block;
  width: 100%;
  text-align: center;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--accent, #0964A0);
  border: none;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s;
  box-sizing: border-box;
}
.qi-info-modal__cta:hover {
  filter: brightness(1.12);
  color: #fff;
}

/* --- Approaching-Limit Nudge --- */

.quota-nudge {
  background: rgba(230, 168, 23, 0.08);
  border: 1px solid rgba(230, 168, 23, 0.2);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s, transform 0.2s;
}
.quota-nudge.visible {
  opacity: 1;
  transform: translateY(0);
}

.quota-nudge__content {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.quota-nudge__icon {
  color: #e6a817;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

.quota-nudge__text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text, #e4e4e8);
  flex: 1;
}

.quota-nudge__link {
  color: var(--accent, #6c8cff);
  text-decoration: none;
  font-weight: 500;
}
.quota-nudge__link:hover {
  text-decoration: underline;
}

.quota-nudge__dismiss {
  background: none;
  border: none;
  color: var(--muted, #888);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 12px;
  flex-shrink: 0;
}
.quota-nudge__dismiss:hover {
  color: var(--text, #e4e4e8);
}

/* --- Over-quota banner (grandfathered users) --- */

.quota-over-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff8ea;
  border: 1px solid #f4cf8a;
  border-left: 4px solid #e6a817;
  border-radius: 6px;
  padding: 10px 14px;
  margin: 0 0 10px 0;
  color: #5b4b1e;
  font-size: 13px;
  line-height: 1.45;
}
.dark-theme .quota-over-banner {
  background: rgba(230, 168, 23, 0.08);
  border-color: rgba(230, 168, 23, 0.35);
  border-left-color: #e6a817;
  color: var(--text, #e4e4e8);
}

.quota-over-banner__icon {
  flex-shrink: 0;
  font-size: 16px;
  color: #e6a817;
}

.quota-over-banner__text {
  flex: 1;
  min-width: 0;
}

.quota-over-banner__cta {
  flex-shrink: 0;
  background: var(--accent, #0964A0);
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.15s;
}
.quota-over-banner__cta:hover {
  filter: brightness(1.12);
  color: #fff;
  text-decoration: none;
}

.quota-over-banner__dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #8a7a3a;
  opacity: 0.7;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 12px;
}
.quota-over-banner__dismiss:hover {
  opacity: 1;
}
.dark-theme .quota-over-banner__dismiss {
  color: var(--muted, #a0a0b0);
}

/* Hide evaluation detail when sidebar is collapsed */
.is-collapsed .qi-eval-detail {
  display: none;
}
