/* AI Integration Styles */

/* AI Settings Button */
.ai-settings-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  padding: 8px 16px;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  background: transparent;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.ai-settings-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
}

/* Panel Header with Actions */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-title-section h2 {
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
}

.panel-title-section p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.panel-actions {
  display: flex;
  gap: 8px;
}

/* Section Header with Action */
.section-header-with-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-header-with-action p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* AI Generation Buttons */
.btn-ai {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-ai:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-ai:active {
  transform: translateY(0);
}

.btn-ai:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-ai.generating {
  pointer-events: none;
}

.btn-ai.generating::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* AI Settings Modal */
.ai-settings-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.ai-settings-content {
  background: var(--bg-primary);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: 0 0 12px 12px;
}

/* Input Group */
.input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.input-group input {
  flex: 1;
  border-radius: 6px 0 0 6px;
  border-right: none;
  min-width: 0;
}

.input-group .btn {
  border-radius: 0 6px 6px 0;
  border-left: none;
  padding: 0 12px;
}

/* Range Group */
.range-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-group input[type="range"] {
  flex: 1;
}

.range-group span {
  min-width: 40px;
  text-align: center;
  font-weight: 500;
  color: var(--primary-color);
}

/* Connection Status */
.connection-status {
  margin-top: 0.5rem;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  min-height: 20px;
}

.connection-status.success {
  background: rgba(34, 197, 94, 0.1);
  color: #059669;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.connection-status.error {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.connection-status.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Additional Context Styles */
.additional-context-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  width: 100%;
}

.additional-context-section .form-group {
  width: 100%;
  margin-bottom: 1.5rem;
}

.additional-context-section .form-control {
  width: 100%;
  box-sizing: border-box;
}

.section-header {
  margin-bottom: 1.5rem;
}

.section-header h3 {
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.section-description {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.4;
}

.context-textarea {
  min-height: 100px;
  resize: vertical;
  width: 100%;
  max-width: none;
  padding: 12px 16px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.char-counter {
  text-align: right;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Upload Section */
.upload-section {
  margin-top: 0.5rem;
}

.upload-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  background: var(--bg-primary);
  transition: all 0.3s ease;
  cursor: pointer;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--primary-color);
  background: rgba(79, 172, 254, 0.05);
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.upload-icon {
  font-size: 2rem;
  color: var(--text-secondary);
}

.upload-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
}

.upload-btn:hover {
  color: var(--primary-dark);
}

/* Uploaded Files */
.uploaded-files {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.uploaded-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-icon {
  font-size: 1.2rem;
}

.file-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.file-size {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.remove-file {
  background: none;
  border: none;
  color: var(--error-color);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.remove-file:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* URL Section */
.url-input-section {
  margin-bottom: 1rem;
}

.url-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 1rem;
}

.url-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.url-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.url-icon {
  font-size: 1rem;
  color: var(--text-secondary);
}

.url-text {
  flex: 1;
  overflow: hidden;
}

.url-text a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.9rem;
  word-break: break-all;
}

.url-text a:hover {
  text-decoration: underline;
}

.remove-url {
  background: none;
  border: none;
  color: var(--error-color);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  margin-left: 8px;
}

.remove-url:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Context Summary */
.context-summary {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(79, 172, 254, 0.05);
  border: 1px solid rgba(79, 172, 254, 0.2);
  border-radius: 6px;
}

.context-summary h4 {
  margin: 0 0 0.75rem 0;
  color: var(--primary-color);
  font-size: 0.95rem;
}

.summary-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summary-item {
  font-size: 0.85rem;
  line-height: 1.4;
}

.summary-item strong {
  color: var(--text-primary);
  margin-right: 8px;
}

.summary-item span {
  color: var(--text-secondary);
}

/* Context Messages */
.context-message {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 1001;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideInRight 0.3s ease;
}

.context-message-success {
  background: rgba(34, 197, 94, 0.9);
  color: white;
}

.context-message-error {
  background: rgba(239, 68, 68, 0.9);
  color: white;
}

.context-message-warning {
  background: rgba(245, 158, 11, 0.9);
  color: white;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Help Text */
.help-text {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* Responsive Design */
@media (max-width: 768px) {
  .panel-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .section-header-with-action {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .ai-settings-content {
    width: 95%;
    margin: 10px;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .upload-dropzone {
    padding: 1.5rem 1rem;
  }
}