/* ═══ Cost FAB & Modal ═══ */

/* Topbar cost button */
.cost-topbar-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--border-tertiary);
  background: transparent;
  color: var(--teal);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s ease;
  display: none; /* shown only when authenticated */
}

.cost-topbar-btn:hover {
  background: var(--teal-light);
  border-color: var(--teal);
}

/* Overlay */
.cost-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.cost-overlay.open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cost-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Modal */
.cost-modal {
  position: relative;
  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-tertiary);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  overflow: hidden;
  animation: costSlideIn 0.2s ease-out;
}

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

/* Header */
.cost-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-tertiary);
}

.cost-header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.cost-provider {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  margin-left: auto;
}

.cost-close-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cost-close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Body */
.cost-body {
  padding: 20px;
}

/* Big total */
.cost-total-row {
  text-align: center;
  padding: 16px 0 24px;
}

.cost-total-amount {
  font-size: 36px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--teal);
  letter-spacing: -1px;
  line-height: 1;
}

.cost-total-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* Grid of cards */
.cost-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.cost-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-tertiary);
  border-radius: var(--radius-md);
  padding: 12px;
}

.cost-card-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.cost-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 3px 0;
}

.cost-card-row strong {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
}

.cost-card-row.total {
  border-top: 1px solid var(--border-tertiary);
  margin-top: 4px;
  padding-top: 6px;
}

.cost-card-row.total strong {
  color: var(--teal);
}

.cost-card-row.cost {
  margin-top: 2px;
}

.cost-card-row.cost strong {
  color: var(--amber);
  font-weight: 700;
}

.cost-note {
  text-align: center;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 16px;
}

/* Footer */
.cost-footer {
  display: flex;
  justify-content: center;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border-tertiary);
}

.cost-reset-btn {
  font-size: 12px;
  font-family: var(--font-sans);
  color: var(--text-tertiary);
  background: none;
  border: 1px solid var(--border-tertiary);
  border-radius: 6px;
  padding: 6px 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.cost-reset-btn:hover {
  color: var(--coral);
  border-color: var(--coral);
  background: var(--coral-light);
}

/* Pulse animation when tokens update */
@keyframes tf-pulse {
  0% { color: var(--teal); }
  50% { color: #34d399; }
  100% { color: var(--teal); }
}

.tf-updated {
  animation: tf-pulse 0.4s ease;
}

/* Responsive */
@media (max-width: 520px) {
  .cost-grid {
    grid-template-columns: 1fr;
  }
  .cost-modal {
    width: 100%;
    max-width: none;
    margin: 16px;
  }
}
