/* storyboard.css */
/* Storyboard section - shot cards with frames */

/* ===============================
   PAGE LAYOUT
   Uses shared .screenplay-page / .screenplay-header / .screenplay-canvas
   =============================== */

.storyboard-page {
  /* Inherits flex column + height:100% from .screenplay-page */
  border-width: 0px !important;
}

.storyboard-header {
  border-bottom: 0px !important;
}

/* ===============================
   SECTION HEADER (inside .screenplay-header)
   =============================== */

.storyboard-header .storyboard-header-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-muted) 100%);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.storyboard-header .storyboard-header-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  width: 100px;
  flex-shrink: 0;
}

/* ===============================
   CANVAS AREA
   =============================== */

.storyboard-canvas {
  background: transparent !important;
  border-width: 0px;
}

/* ===============================
   LAYOUT CONTROLS
   =============================== */

.layout-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.layout-controls .control-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-right: 4px;
}

.layout-btn {
  padding: 4px 6px;
  min-width: 28px;
  width: 36px;
  height: 32px !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layout-btn.active {
  background: var(--accent);
  color: #fff;
}

.layout-btn svg {
  opacity: 0.8;
}

.layout-btn.active svg {
  opacity: 1;
}

/* ===============================
   GRID LAYOUTS
   =============================== */

#storyboardContainer {
  display: grid;
  gap: 16px;
  max-width: 1600px;
  margin: 0 auto;
}

.storyboard-grid-1 {
  grid-template-columns: 1fr;
  max-width: 700px;
}

.storyboard-grid-2 {
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.storyboard-grid-3 {
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* Responsive adjustments */
@media (max-width: 1100px) {
  .storyboard-grid-3 {
	grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .storyboard-grid-2,
  .storyboard-grid-3 {
	grid-template-columns: 1fr;
  }
  
  .storyboard-canvas {
	padding: 12px;
  }
}

/* ===============================
   SHOT CARD
   =============================== */

.storyboard-card {
  background: var(--bg-panel, #242428);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border, #4b4b50);
  transition: box-shadow 0.2s ease;
}

.storyboard-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Compact cards in 3-column layout */
.storyboard-grid-3 .storyboard-card {
  border-radius: 4px;
}

.storyboard-grid-3 .storyboard-info {
  padding: 8px;
}

.storyboard-grid-3 .storyboard-shot-header {
  margin-bottom: 8px;
  padding-bottom: 6px;
}

.storyboard-grid-3 .storyboard-field label {
  font-size: 9px;
}

.storyboard-grid-3 .storyboard-input {
  padding: 4px 6px;
  font-size: 11px;
}

.storyboard-grid-3 .storyboard-textarea {
  min-height: 36px;
}

/* ===============================
   FRAME (16:9 aspect ratio)
   =============================== */

.storyboard-frame {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  background: #1a1a1e;
  overflow: hidden;
}

.storyboard-frame.has-image {
  background: #000;
}

.storyboard-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ===============================
   DROPZONE
   =============================== */

.storyboard-dropzone {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px dashed var(--border, #4b4b50);
  margin: 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.storyboard-dropzone:hover {
  border-color: var(--accent, #d18b3c);
  background: rgba(209, 139, 60, 0.05);
}

.storyboard-frame.drag-over .storyboard-dropzone {
  border-color: var(--accent, #d18b3c);
  background: rgba(209, 139, 60, 0.1);
  border-style: solid;
}

.dropzone-icon {
  color: var(--text-secondary, #888);
  margin-bottom: 8px;
  opacity: 0.6;
}

.dropzone-text {
  font-size: 12px;
  color: var(--text-secondary, #888);
  text-align: center;
}

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

/* Remove image button */
.storyboard-remove-image {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.storyboard-frame:hover .storyboard-remove-image {
  opacity: 1;
}

.storyboard-remove-image:hover {
  background: rgba(231, 76, 60, 0.9);
}

/* ===============================
   UPLOADING STATE
   =============================== */

.storyboard-frame.uploading {
  pointer-events: none;
}

.storyboard-uploading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 14px;
}

.upload-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent, #d18b3c);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

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

/* ===============================
   SHOT INFO
   =============================== */

.storyboard-info {
  padding: 12px;
}

.storyboard-shot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border, #4b4b50);
}

.storyboard-shot-number {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent, #d18b3c);
}

.storyboard-scene-ref {
  font-size: 11px;
  color: var(--text-secondary, #888);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===============================
   FIELDS
   =============================== */

.storyboard-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.storyboard-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.storyboard-field label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary, #888);
}

.storyboard-field-full {
  grid-column: 1 / -1;
}

.storyboard-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  background: var(--bg-input, #1a1a1e);
  border: 1px solid var(--border, #4b4b50);
  border-radius: 4px;
  color: var(--text-primary, #e6e6e6);
  transition: border-color 0.2s ease;
}

.storyboard-input:focus {
  outline: none;
  border-color: var(--accent, #d18b3c);
}

.storyboard-input::placeholder {
  color: var(--text-tertiary, #666);
}

.storyboard-textarea {
  min-height: 48px;
  resize: vertical;
  font-family: inherit;
}

/* ===============================
   EMPTY STATE
   =============================== */

.storyboard-empty,
.storyboard-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-secondary, #888);
  text-align: center;
  gap: 8px;
}

.storyboard-empty p {
  margin: 0;
}

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

@media print {
  body.printing-storyboard * {
	visibility: hidden;
  }
  
  body.printing-storyboard .storyboard-canvas,
  body.printing-storyboard .storyboard-canvas *,
  body.printing-storyboard #storyboardContainer,
  body.printing-storyboard #storyboardContainer * {
	visibility: visible;
  }
  
  body.printing-storyboard .storyboard-header,
  body.printing-storyboard .lina-header,
  body.printing-storyboard header,
  body.printing-storyboard nav,
  body.printing-storyboard aside,
  body.printing-storyboard .storyboard-remove-image,
  body.printing-storyboard .storyboard-file-input {
	display: none !important;
  }
  
  body.printing-storyboard {
	background: white !important;
  }
  
  body.printing-storyboard .storyboard-canvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	padding: 0.25in;
	background: white !important;
	overflow: visible !important;
  }
  
  /* Respect user's layout choice */
  body.printing-storyboard .storyboard-grid-1 {
	grid-template-columns: 1fr;
	gap: 12px;
	max-width: 6in;
	margin: 0 auto;
  }
  
  body.printing-storyboard .storyboard-grid-2 {
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
  }
  
  body.printing-storyboard .storyboard-grid-3 {
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
  }
  
  body.printing-storyboard .storyboard-card {
	break-inside: avoid;
	page-break-inside: avoid;
	border: 1px solid #ccc;
	background: white;
	border-radius: 2px;
  }
  
  body.printing-storyboard .storyboard-frame {
	background: #f0f0f0;
  }
  
  body.printing-storyboard .storyboard-frame.has-image {
	background: #fff;
  }
  
  body.printing-storyboard .storyboard-dropzone {
	border-color: #ccc;
	border-width: 1px;
  }
  
  body.printing-storyboard .dropzone-icon,
  body.printing-storyboard .dropzone-text {
	color: #aaa;
  }
  
  body.printing-storyboard .storyboard-info {
	padding: 6px 8px;
  }
  
  body.printing-storyboard .storyboard-shot-header {
	margin-bottom: 6px;
	padding-bottom: 4px;
  }
  
  body.printing-storyboard .storyboard-input {
	border: none;
	background: transparent;
	padding: 1px 0;
	color: #000;
	font-size: 9pt;
  }
  
  body.printing-storyboard .storyboard-textarea {
	min-height: 20px;
  }
  
  body.printing-storyboard .storyboard-shot-number {
	color: #333;
	font-size: 11pt;
  }
  
  body.printing-storyboard .storyboard-scene-ref {
	color: #666;
	font-size: 8pt;
  }
  
  body.printing-storyboard .storyboard-field label {
	color: #666;
	font-size: 7pt;
  }
  
  body.printing-storyboard .storyboard-fields {
	gap: 4px;
  }
  
  /* Compact for 3-column print */
  body.printing-storyboard .storyboard-grid-3 .storyboard-info {
	padding: 4px 6px;
  }
  
  body.printing-storyboard .storyboard-grid-3 .storyboard-input {
	font-size: 8pt;
  }
  
  body.printing-storyboard .storyboard-grid-3 .storyboard-field label {
	font-size: 6pt;
  }
  
  @page {
	size: Letter;
	margin: 0.25in;
  }
}
