/* Cost Display Button - לחצן הצגת עלויות */

/* הלחצן עצמו - מעוצב כמו שאר הלחצנים בכותרת */
.cost-display-button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  width: 2.5rem;
  flex-shrink: 0;
  border-radius: 0.5rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background-color: #ffffff;
  padding: 0;
  color: #6b7280;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  position: relative;
}

.cost-display-button:hover {
  background-color: var(--surface-tertiary, #f3f4f6);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  color: #10b981;
}

.cost-display-button:active {
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
}

/* אנימציית טעינה */
.cost-display-button.cost-display-loading {
  animation: cost-pulse 1s ease-in-out infinite;
}

@keyframes cost-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ========== Popup Overlay (רקע מטושטש) ========== */
.cost-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.cost-popup-overlay.cost-popup-visible {
  opacity: 1;
}

.cost-popup-overlay.cost-popup-hidden {
  opacity: 0;
}

/* ========== החלונית עצמה - סגנון נקי ומודרני ========== */
.cost-popup {
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  max-width: 400px;
  width: 90%;
  direction: rtl;
  text-align: right;
  transform: scale(0.95);
  transition: transform 0.2s ease-in-out;
  overflow: hidden;
}

.cost-popup-visible .cost-popup {
  transform: scale(1);
}

/* ========== כותרת החלונית - נקייה ומינימליסטית ========== */
.cost-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
}

.cost-popup-header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

.cost-popup-close {
  background: transparent;
  border: none;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.5rem;
  color: #6b7280;
  transition: all 0.15s;
  padding: 0;
  line-height: 1;
}

.cost-popup-close:hover {
  background: #f3f4f6;
  color: #111827;
}

/* ========== תוכן החלונית - נקי ומסודר ========== */
.cost-popup-content {
  padding: 1.5rem;
  background: #fafafa;
}

/* רשימת פריטי עלות */
.cost-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* פריט עלות בודד */
.cost-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s;
}

.cost-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* כל השדות באותו עיצוב - אחיד ונקי */

/* תווית הפריט */
.cost-item-label {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

/* ערך העלות */
.cost-item-value {
  font-size: 1.25rem;
  color: #111827;
  font-weight: 600;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}

/* ערך הטוקנים */
.cost-item-tokens-value {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-direction: row-reverse;
}

.token-percentage {
  font-size: 0.875rem;
  color: #78716c;
  font-weight: 500;
}

/* הודעת שגיאה - סגנון נקי */
.cost-error {
  text-align: center;
  padding: 2rem 1rem;
  color: #dc2626;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* ========== טבלת השוואת מודלים ========== */
.cost-comparison-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid #e5e7eb;
}

.cost-comparison-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #6b7280;
  margin: 0 0 1rem 0;
  text-align: center;
}

.cost-comparison-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.cost-comparison-table thead {
  background: var(--surface-secondary, #f9fafb);
}

.comparison-header {
  padding: 0.875rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.comparison-header:not(:last-child) {
  border-left: 1px solid #e5e7eb;
}

.cost-comparison-table tbody tr {
  background: white;
  border-top: 1px solid #e5e7eb;
}

.comparison-cost {
  padding: 1rem;
  text-align: center;
  font-size: 1.125rem;
  color: #111827;
  font-weight: 700;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}

.comparison-cost:not(:last-child) {
  border-left: 1px solid #e5e7eb;
}

/* ========== תצוגה inline בחלונית ההקלדה ========== */
.inline-cost-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: transparent;
  border-radius: 6px;
  font-size: 0.875rem; /* text-sm - כמו שאר הכפתורים */
  font-weight: 500; /* font-medium - כמו שאר הכפתורים */
  color: var(--text-primary, #374151); /* צבע טקסט רגיל */
  direction: rtl;
  font-variant-numeric: tabular-nums;
}

.inline-cost-value {
  font-weight: 500; /* אותו משקל כמו הטקסט הרגיל */
  color: var(--text-primary, #374151); /* אותו צבע כמו שאר הטקסט */
  direction: ltr;
}

.inline-cost-value.has-data {
  color: var(--text-primary, #374151);
}

.inline-cost-separator {
  color: var(--text-secondary, #6b7280);
  font-size: 0.875rem;
}

.inline-token-value {
  font-weight: 500;
  color: var(--text-primary, #374151);
}

.inline-token-value.has-data {
  color: var(--text-primary, #374151);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .inline-cost-value,
  .inline-token-value {
    color: var(--text-primary, #e5e7eb);
  }
  
  .inline-cost-display {
    color: var(--text-primary, #e5e7eb);
  }
  
  .inline-cost-separator {
    color: var(--text-secondary, #9ca3af);
  }
}

/* במסכים קטנים - הסתר את התצוגה inline */
@media (max-width: 768px) {
  .inline-cost-display {
    display: none;
  }
}

/* ========== רספונסיבי למובייל ========== */
@media (max-width: 640px) {
  .cost-popup {
    max-width: 95%;
    margin: 1rem;
  }

  .cost-popup-content {
    padding: 1rem;
  }

  .cost-item {
    padding: 0.875rem 1rem;
  }

  .cost-item-value {
    font-size: 1.125rem;
  }

  .cost-popup-header {
    padding: 1rem 1.25rem;
  }

  .cost-popup-header h2 {
    font-size: 1rem;
  }
}
