/* Cost Confirmation Modal Styles */
.cost-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(3px);
}

.cost-modal-content {
  background: white;
  border-radius: 12px;
  padding: 0;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
  overflow: hidden;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.cost-modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.cost-modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cost-modal-title i {
  font-size: 1.1rem;
}

.cost-modal-body {
  padding: 24px;
}

.cost-breakdown {
  background: #f8fafc;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  border: 1px solid #e5e7eb;
}

.cost-breakdown h4 {
  margin: 0 0 12px 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e5e7eb;
}

.cost-row:last-child {
  border-bottom: none;
  font-weight: 600;
  font-size: 1.1rem;
  color: #1f2937;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 2px solid #d1d5db;
}

.cost-label {
  color: #6b7280;
  font-size: 0.9rem;
}

.cost-value {
  font-family: 'Monaco', 'Consolas', monospace;
  font-weight: 500;
}

.cost-warning {
  padding: 12px 16px;
  border-radius: 8px;
  margin: 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.cost-warning.low {
  background: #ecfdf5;
  border: 1px solid #86efac;
  color: #166534;
}

.cost-warning.medium {
  background: #fffbeb;
  border: 1px solid #fbbf24;
  color: #92400e;
}

.cost-warning.high {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #dc2626;
}

.cost-warning i {
  font-size: 1.1rem;
}

.query-preview {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 12px;
  margin: 12px 0;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.85rem;
  color: #374151;
  max-height: 80px;
  overflow-y: auto;
}

.cost-modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.cost-modal-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cost-modal-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cost-modal-btn.cancel {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.cost-modal-btn.cancel:hover {
  background: #e5e7eb;
}

.cost-modal-btn.proceed {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.cost-modal-btn.proceed:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.cost-modal-btn.proceed.high-cost {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.cost-modal-btn.proceed.high-cost:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
}

.data-info {
  display: flex;
  justify-content: space-between;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 12px;
  margin: 12px 0;
  font-size: 0.85rem;
  color: #0c4a6e;
}

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f4f6;
  border-radius: 50%;
  border-top-color: #3b82f6;
  animation: spin 0.8s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===============================
   MOBILE RESPONSIVENESS
   =============================== */

@media (max-width: 768px) {
  .cost-modal-content {
    width: 95%;
    max-width: none;
    margin: 10px;
  }
  
  .cost-modal-header {
    padding: 16px 20px 12px;
  }
  
  .cost-modal-title {
    font-size: 1.1rem;
  }
  
  .cost-modal-body {
    padding: 20px;
  }
  
  .cost-breakdown {
    padding: 14px;
    margin: 14px 0;
  }
  
  .cost-breakdown h4 {
    font-size: 0.85rem;
    margin-bottom: 10px;
  }
  
  .cost-row {
    padding: 6px 0;
    flex-wrap: wrap;
    gap: 5px;
  }
  
  .cost-label, .cost-value {
    font-size: 0.85rem;
  }
  
  .cost-warning {
    padding: 10px 14px;
    margin: 14px 0;
    font-size: 0.85rem;
  }
  
  .query-preview {
    padding: 10px;
    font-size: 0.8rem;
    max-height: 60px;
  }
  
  .cost-modal-footer {
    padding: 14px 20px 20px;
    flex-direction: column;
    gap: 10px;
  }
  
  .cost-modal-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    font-size: 0.9rem;
    min-height: 44px; /* Touch-friendly */
  }
  
  .data-info {
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .cost-modal {
    padding: 0;
    align-items: flex-start;
  }
  
  .cost-modal-content {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    max-width: none;
    margin: 0;
    display: flex;
    flex-direction: column;
  }
  
  .cost-modal-header {
    padding: 12px 16px 10px;
    flex-shrink: 0;
  }
  
  .cost-modal-title {
    font-size: 1rem;
  }
  
  .cost-modal-body {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .cost-breakdown {
    padding: 12px;
    margin: 12px 0;
  }
  
  .cost-breakdown h4 {
    font-size: 0.8rem;
    margin-bottom: 8px;
  }
  
  .cost-row {
    padding: 5px 0;
  }
  
  .cost-row:last-child {
    padding-top: 10px;
    margin-top: 6px;
  }
  
  .cost-label, .cost-value {
    font-size: 0.8rem;
  }
  
  .cost-warning {
    padding: 8px 12px;
    margin: 12px 0;
    font-size: 0.8rem;
  }
  
  .query-preview {
    padding: 8px;
    font-size: 0.75rem;
    max-height: 50px;
    margin: 10px 0;
  }
  
  .cost-modal-footer {
    padding: 12px 16px 16px;
    flex-shrink: 0;
    border-radius: 0;
  }
  
  .cost-modal-btn {
    padding: 14px 16px;
    font-size: 0.85rem;
    min-height: 48px;
  }
  
  .data-info {
    padding: 8px;
    margin: 10px 0;
    font-size: 0.75rem;
  }
}

/* Improved touch targets for mobile */
@media (max-width: 768px) {
  .cost-modal-btn:active {
    transform: translateY(0);
    opacity: 0.8;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .cost-modal-content {
    background: #1f2937;
    color: #f9fafb;
  }
  
  .cost-modal-header {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    border-bottom-color: #374151;
  }
  
  .cost-modal-title {
    color: #f9fafb;
  }
  
  .cost-breakdown {
    background: #374151;
    border-color: #4b5563;
  }
  
  .cost-modal-footer {
    background: #374151;
    border-top-color: #4b5563;
  }
}
