/* screenplayEditor.css */
/* Styles for the Lína Screenplay Editor */
/* Additive styles - does not override existing screenplay viewer styles */

/* =====================================================
   EDITOR CONTAINER
   ===================================================== */

.screenplay-editor-container {
  min-height: 100%;
}

.screenplay-editor-pages {
  /* Inherits from .screenplay-pages */
}

.screenplay-editor-content {
  /* Inherits from .screenplay-paper-content */
}

/* =====================================================
   EDITABLE BLOCKS
   ===================================================== */

.sp-block-editable {
  position: relative;
  transition: background-color 0.15s ease;
  border-radius: 2px;
  margin-left: -4px;
  margin-right: -4px;
  padding-left: 4px;
  padding-right: 4px;
}

.sp-block-editable:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.sp-block-editable.sp-block-active {
  background-color: rgba(209, 139, 60, 0.08);
}

/* Editable elements */
.sp-editable {
  outline: none;
  border-radius: 2px;
  transition: box-shadow 0.15s ease;
  min-height: 1em;
}

.sp-editable:focus {
  box-shadow: 0 0 0 2px rgba(209, 139, 60, 0.3);
}

.sp-editable:empty::before {
  content: attr(data-placeholder);
  color: #999;
  font-style: italic;
}

/* Placeholder text for empty elements */
.sp-block-editable[data-block-type="slug"] .sp-editable:empty::before {
  content: "INT./EXT. LOCATION - TIME";
}

.sp-block-editable[data-block-type="action"] .sp-editable:empty::before {
  content: "Action description...";
}

.sp-block-editable[data-block-type="transition"] .sp-editable:empty::before {
  content: "CUT TO:";
}

.sp-block-editable[data-block-type="dialogue"] .sp-character.sp-editable:empty::before {
  content: "CHARACTER NAME";
}

.sp-block-editable[data-block-type="dialogue"] .sp-dialogue-line.sp-editable:empty::before {
  content: "Dialogue...";
}

/* =====================================================
   TYPE BADGE
   ===================================================== */

.sp-type-badge {
  position: absolute;
  right: -60px;
  top: 50%;
  transform: translateY(-50%);
  
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  
  color: #888;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 2px 6px;
  
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  
  white-space: nowrap;
}

.sp-block-editable:hover .sp-type-badge,
.sp-block-editable.sp-block-active .sp-type-badge {
  opacity: 1;
}

/* Type-specific badge colors */
.sp-block-editable[data-block-type="slug"] .sp-type-badge {
  background: #e3f2fd;
  border-color: #90caf9;
  color: #1976d2;
}

.sp-block-editable[data-block-type="action"] .sp-type-badge {
  background: #f5f5f5;
  border-color: #bdbdbd;
  color: #616161;
}

.sp-block-editable[data-block-type="dialogue"] .sp-type-badge {
  background: #fff3e0;
  border-color: #ffcc80;
  color: #e65100;
}

.sp-block-editable[data-block-type="transition"] .sp-type-badge {
  background: #f3e5f5;
  border-color: #ce93d8;
  color: #7b1fa2;
}

/* =====================================================
   BLOCK CONTROLS
   ===================================================== */

.sp-block-controls {
  position: absolute;
  left: -90px;
  top: 50%;
  transform: translateY(-50%);
  
  display: flex;
  gap: 2px;
  
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.sp-block-editable:hover .sp-block-controls,
.sp-block-editable.sp-block-active .sp-block-controls {
  opacity: 1;
  pointer-events: auto;
}

.sp-block-control-btn {
  width: 20px;
  height: 20px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 12px;
  font-weight: 500;
  
  color: #666;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 3px;
  
  cursor: pointer;
  transition: all 0.15s ease;
}

.sp-block-control-btn:hover {
  background: #e0e0e0;
  border-color: #bbb;
  color: #333;
}

.sp-block-control-delete:hover {
  background: #ffebee;
  border-color: #ef9a9a;
  color: #c62828;
}

/* =====================================================
   NEW BLOCK ZONE
   ===================================================== */

.sp-new-block-zone {
  margin-top: 24px;
  padding: 16px;
  
  border: 2px dashed #ddd;
  border-radius: 4px;
  
  text-align: center;
  color: #999;
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 12px;
  
  cursor: pointer;
  transition: all 0.15s ease;
}

.sp-new-block-zone:hover {
  border-color: #bbb;
  background: rgba(0, 0, 0, 0.02);
  color: #666;
}

/* =====================================================
   EDITOR HEADER ELEMENTS
   ===================================================== */

.editor-mode-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-badge {
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  
  padding: 4px 10px;
  border-radius: 4px;
}

.mode-badge.mode-edit {
  background: rgba(209, 139, 60, 0.15);
  color: var(--accent, #d18b3c);
  border: 1px solid rgba(209, 139, 60, 0.3);
}

.mode-badge.mode-view {
  background: rgba(100, 100, 100, 0.1);
  color: var(--text-secondary, #b5b5b5);
  border: 1px solid rgba(100, 100, 100, 0.2);
}

.save-indicator {
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 11px;
  color: #27ae60;
  
  display: flex;
  align-items: center;
  gap: 4px;
}

.save-indicator::before {
  content: "✓";
  font-weight: bold;
}

.save-indicator.unsaved {
  color: var(--accent, #d18b3c);
}

.save-indicator.unsaved::before {
  content: "●";
}

/* Edit button active state */
.screenplay-page .btn.btn-active {
  background: var(--accent, #d18b3c);
  color: #fff;
  border-color: var(--accent, #d18b3c);
}

/* =====================================================
   TOOLBAR (FUTURE ENHANCEMENT)
   ===================================================== */

.screenplay-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  
  background: var(--bg-elevated, #2a2a32);
  border-bottom: 1px solid var(--border, #4b4b50);
}

.editor-toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
  
  padding: 0 8px;
  border-right: 1px solid var(--border, #4b4b50);
}

.editor-toolbar-group:last-child {
  border-right: none;
}

.editor-toolbar-btn {
  padding: 6px 10px;
  
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 12px;
  
  color: var(--text-secondary, #b5b5b5);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  
  cursor: pointer;
  transition: all 0.15s ease;
}

.editor-toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border, #4b4b50);
  color: var(--text-primary, #e6e6e6);
}

.editor-toolbar-btn.active {
  background: var(--accent, #d18b3c);
  color: #fff;
}

/* =====================================================
   KEYBOARD SHORTCUTS HINT
   ===================================================== */

.editor-shortcuts-hint {
  position: fixed;
  bottom: 20px;
  right: 20px;
  
  padding: 12px 16px;
  
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 11px;
  line-height: 1.6;
  
  color: var(--text-secondary, #b5b5b5);
  background: var(--bg-panel, #24242b);
  border: 1px solid var(--border, #4b4b50);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s ease;
  pointer-events: none;
  
  z-index: 100;
}

.screenplay-editor-container:focus-within .editor-shortcuts-hint {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.editor-shortcuts-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  
  background: var(--bg-elevated, #2a2a32);
  border: 1px solid var(--border, #4b4b50);
  border-radius: 3px;
}

/* =====================================================
   RESPONSIVE ADJUSTMENTS
   ===================================================== */

@media (max-width: 1200px) {
  .sp-type-badge {
	right: -50px;
	font-size: 8px;
	padding: 1px 4px;
  }
  
  .sp-block-controls {
	left: -70px;
  }
  
  .sp-block-control-btn {
	width: 18px;
	height: 18px;
	font-size: 10px;
  }
}

@media (max-width: 900px) {
  .sp-type-badge,
  .sp-block-controls {
	display: none;
  }
}

/* =====================================================
   PRINT STYLES
   ===================================================== */

@media print {
  /* Hide all editor UI when printing */
  .sp-type-badge,
  .sp-block-controls,
  .sp-new-block-zone,
  .editor-mode-indicator,
  .editor-shortcuts-hint,
  .screenplay-editor-toolbar {
	display: none !important;
  }
  
  .sp-block-editable {
	background: transparent !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
  }
  
  .sp-editable {
	box-shadow: none !important;
  }
}
