/**
 * Floating AI Cost Badge - Shows cumulative session costs
 * Positioned to the left of editor tabs for visibility
 */

.floating-cost-badge {
  position: fixed;
  top: 70px; /* Below navbar */
  left: 20px;
  z-index: 1040; /* Above most content, below modals */
  min-width: 180px;
  animation: slideInLeft 0.3s ease-out;
}

.cost-badge-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.cost-badge-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.cost-badge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cost-badge-title {
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

.cost-badge-icon {
  color: #ffd700;
  font-size: 16px;
  animation: pulse 2s infinite;
}

.cost-badge-amount {
  color: #ffffff;
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  line-height: 1;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cost-badge-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.cost-badge-stat {
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cost-badge-stat i {
  font-size: 12px;
}

.cost-badge-requests {
  color: #ffd700;
  font-weight: 600;
}

.cost-badge-model {
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  text-align: center;
  margin-top: 4px;
}

/* Color variations based on cost */
.cost-badge-card.cost-low {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  box-shadow: 0 4px 12px rgba(56, 239, 125, 0.3);
}

.cost-badge-card.cost-medium {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  box-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
}

.cost-badge-card.cost-high {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  box-shadow: 0 4px 12px rgba(250, 112, 154, 0.3);
}

.cost-badge-card.cost-very-high {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
  animation: urgentPulse 1.5s infinite;
}

@keyframes urgentPulse {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
  }
  50% {
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
  }
}

/* Minimized state */
.cost-badge-card.minimized {
  padding: 8px 12px;
  min-width: 120px;
}

.cost-badge-card.minimized .cost-badge-amount {
  font-size: 18px;
}

.cost-badge-card.minimized .cost-badge-details {
  display: none;
}

.cost-badge-card.minimized .cost-badge-model {
  display: none;
}

/* Tooltip on hover */
.cost-badge-card::after {
  content: 'Click for details';
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cost-badge-card:hover::after {
  opacity: 1;
}

/* Hide on mobile */
@media (max-width: 768px) {
  .floating-cost-badge {
    display: none;
  }
}

/* Expanded details panel */
.cost-badge-expanded {
  position: fixed;
  top: 70px;
  left: 20px;
  width: 320px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 1050;
  animation: slideInLeft 0.3s ease-out;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.cost-badge-expanded-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 16px;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cost-badge-expanded-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.cost-badge-expanded-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.cost-badge-expanded-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.cost-badge-expanded-body {
  padding: 16px;
}

.cost-breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #e9ecef;
}

.cost-breakdown-item:last-child {
  border-bottom: none;
}

.cost-breakdown-label {
  font-size: 13px;
  color: #495057;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cost-breakdown-value {
  font-size: 14px;
  font-weight: 600;
  color: #212529;
}

.cost-breakdown-total {
  background: #f8f9fa;
  border-radius: 8px;
  margin-top: 12px;
}

.cost-breakdown-total .cost-breakdown-label {
  font-weight: 600;
  color: #212529;
}

.cost-breakdown-total .cost-breakdown-value {
  font-size: 18px;
  color: #667eea;
}

/* ============================================
   Dark Theme Support
   ============================================ */
body[data-theme="dark"] .cost-badge-expanded {
  background: var(--bg-secondary);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

body[data-theme="dark"] .cost-badge-expanded-body {
  background: var(--bg-secondary);
}

body[data-theme="dark"] .cost-breakdown-item {
  border-bottom-color: var(--border);
}

body[data-theme="dark"] .cost-breakdown-label {
  color: var(--text-secondary);
}

body[data-theme="dark"] .cost-breakdown-value {
  color: var(--text-primary);
}

body[data-theme="dark"] .cost-breakdown-total {
  background: var(--bg-tertiary);
}

body[data-theme="dark"] .cost-breakdown-total .cost-breakdown-label {
  color: var(--text-primary);
}

body[data-theme="dark"] .cost-badge-card::after {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
