/* AI Assistance and Enhanced Editor Styles */

/* AI Assist Button */
.ai-assist-btn {
  background: transparent;
  color: var(--dds-red-100);
  border: 1px solid var(--dds-red-100);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: var(--weight-medium);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ai-assist-btn:hover {
  background: var(--dds-red-100);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(255, 81, 81, 0.3);
}

.ai-assist-btn:hover .ai-sparkles-icon {
  stroke: white;
}

.ai-assist-btn:hover span {
  color: white;
}

.ai-assist-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(255, 81, 81, 0.3);
}

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

/* AI Sparkles Icon */
.ai-sparkles-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
}

.ai-assist-btn span {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-1);
  width: 100%;
}

/* Ensure field containers expand to full width */
.field-group {
  width: 100%;
  margin-bottom: var(--space-3);
}

.field-input-container {
  width: 100%;
  display: block;
}

/* Override any conflicting form styles and ensure full width */
.field-input,
.field-textarea {
  width: 100% !important;
  box-sizing: border-box;
  display: block;
  min-width: 0; /* Prevent flex shrinking */
}

/* Ensure selects also expand properly */
.page-select,
.status-dropdown {
  width: 100% !important;
  box-sizing: border-box;
  min-width: 0;
}

/* Section title inputs */
.section-title-input {
  width: 100% !important;
  box-sizing: border-box;
  min-width: 0;
}

/* Enhanced File Upload */
.file-upload-enhanced {
  width: 100%;
}

.file-upload-area {
  border: 2px dashed var(--border-default, #e5e7eb);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  text-align: center;
  background: var(--surface-subtle, #f9fafb);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.file-upload-area:hover {
  border-color: var(--dds-red-100);
  background: var(--surface-default, #fff);
}

.file-upload-area.drag-over {
  border-color: var(--dds-red-100);
  background: rgba(239, 68, 68, 0.05);
  transform: scale(1.02);
}

.file-upload-area.uploading {
  border-color: var(--dds-red-100);
  background: var(--surface-default, #fff);
}

.upload-icon {
  font-size: 2rem;
  color: var(--text-secondary, #6b7280);
  margin-bottom: var(--space-2);
}

.upload-text .upload-main {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin: 0 0 var(--space-1) 0;
  font-weight: 500;
}

.upload-text .upload-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
}

.upload-text .upload-rec {
  font-size: 0.75rem;
  color: var(--text-tertiary, #9ca3af);
  margin: var(--space-1) 0 0 0;
  font-style: italic;
}

.upload-progress {
  width: 100%;
  height: 4px;
  background: var(--bg-quaternary, #f3f4f6);
  border-radius: 2px;
  margin-top: var(--space-2);
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  background: var(--dds-red-100);
  transition: width 0.3s ease;
}

.file-input-hidden {
  display: none;
}

.current-file {
  margin-top: var(--space-2);
  padding: var(--space-2);
  background: var(--surface-default, #fff);
  border: 1px solid var(--border-default, #e5e7eb);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Section Status and Timestamps */
.section-status-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  margin-right: var(--space-2);
}

.section-status {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.section-status.status-draft {
  background: var(--bg-quaternary, #f3f4f6);
  color: var(--text-secondary, #6b7280);
}

.section-status.status-in-progress {
  background: #dbeafe;
  color: #1d4ed8;
}

.section-status.status-completed {
  background: #d1fae5;
  color: #065f46;
}

.section-edited-time {
  font-size: 0.7rem;
  color: var(--text-tertiary, #9ca3af);
}

/* Collapsible Sections */
.section-collapse-btn {
  background: none;
  border: none;
  padding: var(--space-1);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  margin-right: var(--space-2);
}

.section-collapse-btn:hover {
  background: var(--bg-quaternary, #f3f4f6);
  color: var(--text-primary);
}

.section-title-group {
  flex: 1;
}

.section-description {
  font-size: 0.8rem;
  color: var(--text-secondary, #6b7280);
  margin: var(--space-1) 0 0 0;
  font-style: italic;
}

.section-card.collapsed .section-card-content {
  display: none;
}

.section-card.collapsed {
  background: var(--surface-subtle, #f9fafb);
}

/* Section Footer with Save Button */
.section-footer {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-default, #e5e7eb);
  display: flex;
  justify-content: flex-end;
}

.save-section-btn {
  font-size: 0.875rem;
  padding: 6px 12px;
}

/* Field Guidance Text */
.field-guidance {
  display: block;
  margin-top: var(--space-1);
  font-size: 0.8rem;
  color: var(--text-tertiary, #9ca3af);
  line-height: 1.4;
}

/* Section Actions Grouping */
.section-actions {
  display: flex;
  gap: var(--space-1);
}

.section-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Dark Mode Support */
body.dark-mode .ai-assist-btn {
  background: transparent;
  color: var(--dds-red-100);
  border-color: var(--dds-red-100);
}

body.dark-mode .ai-assist-btn:hover {
  background: var(--dds-red-100);
  color: white;
}

body.dark-mode .ai-assist-btn:hover .ai-sparkles-icon {
  stroke: white;
}

body.dark-mode .ai-assist-btn:hover span {
  color: white;
}

body.dark-mode .file-upload-area {
  border-color: var(--border-primary-dark);
  background: var(--bg-tertiary-dark);
}

body.dark-mode .file-upload-area:hover,
body.dark-mode .file-upload-area.drag-over {
  border-color: var(--dds-red-75);
  background: var(--bg-secondary-dark);
}

body.dark-mode .upload-icon {
  color: var(--text-secondary-dark);
}

body.dark-mode .upload-text .upload-main {
  color: var(--text-primary-dark);
}

body.dark-mode .upload-text .upload-sub,
body.dark-mode .upload-text .upload-rec {
  color: var(--text-secondary-dark);
}

body.dark-mode .current-file {
  background: var(--bg-secondary-dark);
  border-color: var(--border-primary-dark);
  color: var(--text-secondary-dark);
}

body.dark-mode .section-status.status-draft {
  background: var(--bg-quaternary-dark);
  color: var(--text-secondary-dark);
}

body.dark-mode .section-edited-time {
  color: var(--text-tertiary-dark);
}

body.dark-mode .section-collapse-btn {
  color: var(--text-secondary-dark);
}

body.dark-mode .section-collapse-btn:hover {
  background: var(--bg-quaternary-dark);
  color: var(--text-primary-dark);
}

body.dark-mode .section-description {
  color: var(--text-secondary-dark);
}

body.dark-mode .section-card.collapsed {
  background: var(--bg-tertiary-dark);
}

body.dark-mode .section-footer {
  border-color: var(--border-secondary-dark);
}

body.dark-mode .field-guidance {
  color: var(--text-tertiary-dark);
}
