/* Template Show Two-Column Layout */

/* Override existing container to use two-column layout */
.compact-template-container.two-column-layout {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #1e293b;
  overflow: hidden;
}

@media (max-width: 768px) {
  .compact-template-container.two-column-layout {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
}

/* Compact Header */
.two-column-header {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 2rem;
  flex-shrink: 0;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.two-column-header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.header-left-section {
  width: 100%;
}

.template-title-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.template-title-two-column {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.2;
}

.template-description-two-column {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0;
  font-weight: 500;
}



/* Two Column Main Content */
.two-column-main-content {
  flex: 1;
  display: flex;
  min-height: 0;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  gap: 2rem;
  padding: 2rem;
}

/* Left Column - Upload and Prompt */
.left-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
  overflow-y: auto;
  max-height: calc(100vh - 100px);
}

.upload-prompt-section {
  background: white;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.section-header {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #e2e8f0;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.5rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-subtitle {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0;
  font-weight: 500;
}

.section-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
}

/* Upload Section Styles */
.upload-section-two-column {
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.upload-input-group {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
}

/* Responsive behavior for different numbers of upload areas */
.upload-section-two-column:has(.upload-input-group:nth-child(1):nth-last-child(1)) .upload-input-group {
  /* 1 upload area - takes full width */
  min-width: 300px;
  max-width: 400px;
}

.upload-section-two-column:has(.upload-input-group:nth-child(2):nth-last-child(1)) .upload-input-group {
  /* 2 upload areas - 50% each */
  min-width: 250px;
}

.upload-section-two-column:has(.upload-input-group:nth-child(3):nth-last-child(1)) .upload-input-group {
  /* 3 upload areas - 33% each */
  min-width: 200px;
}

.upload-section-two-column:has(.upload-input-group:nth-child(4):nth-last-child(1)) .upload-input-group {
  /* 4 upload areas - 25% each */
  min-width: 180px;
}

/* Fallback for browsers without :has() support */
@supports not (selector(:has(*))) {
  .upload-input-group {
    min-width: 180px; /* Default to smallest size for 4 columns */
  }
}

.upload-label-two-column {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

.required {
  color: #ef4444;
}

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

.upload-area-two-column {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  background: #f8fafc;
  transition: all 0.3s ease;
  cursor: pointer;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.upload-area-two-column:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.upload-area-two-column.dragover {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: scale(1.02);
}

.upload-icon {
  width: 32px;
  height: 32px;
  color: #94a3b8;
}

.upload-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  margin: 0;
}

.upload-subtext {
  font-size: 0.75rem;
  color: #64748b;
  margin: 0;
}

.uploaded-files-grid {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  width: 100%;
  align-items: flex-start;
}

/* Dynamic flex layout based on number of items */
.uploaded-files-grid[data-count="1"] .uploaded-file-item {
  flex: 0 0 120px !important;
  width: 120px;
}

.uploaded-files-grid[data-count="2"] .uploaded-file-item {
  flex: 0 0 calc(50% - 0.25rem) !important;
  width: calc(50% - 0.25rem);
}

.uploaded-files-grid[data-count="3"] .uploaded-file-item {
  flex: 0 0 calc(33.333% - 0.34rem) !important;
  width: calc(33.333% - 0.34rem);
}

.uploaded-files-grid[data-count="4"] .uploaded-file-item {
  flex: 0 0 calc(25% - 0.375rem) !important;
  width: calc(25% - 0.375rem);
}

/* For 5+ items, show 4 per row */
.uploaded-files-grid[data-count="5"] .uploaded-file-item,
.uploaded-files-grid[data-count="6"] .uploaded-file-item,
.uploaded-files-grid[data-count="7"] .uploaded-file-item,
.uploaded-files-grid[data-count="8"] .uploaded-file-item {
  flex: 0 0 calc(25% - 0.375rem) !important;
  width: calc(25% - 0.375rem);
}

/* For more than 8 items */
.uploaded-files-grid:not([data-count]) .uploaded-file-item {
  flex: 0 0 calc(25% - 0.375rem) !important;
  width: calc(25% - 0.375rem);
}

.uploaded-file-item {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 1;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
  min-width: 60px;
  max-width: 120px;
}

.uploaded-file-item:hover {
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.uploaded-file-item img,
.uploaded-file-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
  opacity: 0;
}

.uploaded-file-item:hover .file-remove-btn {
  opacity: 1;
}

.file-remove-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}

/* Prompt Section Styles */
.prompt-section-two-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.prompt-textarea {
  width: 100%;
  min-height: 80px;
  max-height: 120px;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.4;
  resize: vertical;
  font-family: inherit;
  transition: all 0.2s ease;
  background: #fafafa;
}

.prompt-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  background: white;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.prompt-footer-two-column {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.prompt-tip {
  font-size: 0.75rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.char-counter {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}

.generate-button-two-column {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  margin-top: 0.75rem;
}

.generate-button-two-column:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px -1px rgba(0, 0, 0, 0.15);
}

.generate-button-two-column:active {
  transform: translateY(0);
}

.generate-button-two-column:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.generate-icon-two-column {
  width: 20px;
  height: 20px;
}

/* Right Column - Template Styles */
.right-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.styles-gallery-section {
  background: white;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.styles-gallery-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.styles-grid-two-column {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  padding: 0.5rem;
  align-items: start;
}

.style-item-two-column {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  background: #f8fafc;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.style-item-two-column:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.15);
}

.style-item-two-column.selected {
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.style-image-two-column,
.style-video-two-column {
  width: 100%;
  height: auto;
  display: block;
  background-color: #f8fafc;
  transition: transform 0.3s ease;
}

.style-overlay-two-column {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: white;
  padding: 0.75rem;
  /* transform: translateY(100%); */
  transition: transform 0.3s ease;
  justify-content: center;
  display: flex;
}

.style-item-two-column:hover .style-overlay-two-column {
  transform: translateY(0);
}

.style-name-two-column {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.style-placeholder-two-column {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.style-placeholder-two-column svg {
  width: 48px;
  height: 48px;
  color: #94a3b8;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .two-column-main-content {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .left-column,
  .right-column {
    flex: none;
  }
  
  .styles-gallery-section {
    height: 600px;
  }
}

@media (max-width: 768px) {
  .two-column-header {
    padding: 1rem;
  }
  
  .two-column-header-content {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  
  .header-left-section {
    width: 100%;
  }
  
  .template-title-two-column {
    font-size: 1.25rem;
  }
  
  .template-description-two-column {
    font-size: 0.8125rem;
  }
  
  .two-column-main-content {
    padding: 1rem;
  }
  
  .left-column {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
  }
  
  .two-column-main-content {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .right-column {
    flex: none;
    height: 400px;
  }
  
  .section-content {
    padding: 1rem;
  }
  
  .upload-section-two-column {
    flex-direction: column;
  }
  
  .upload-input-group {
    min-width: unset;
    max-width: unset;
  }
  
  .styles-grid-two-column {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
}

@media (max-width: 480px) {
  .two-column-header {
    padding: 0.75rem;
  }
  
  .template-title-two-column {
    font-size: 1.125rem;
  }
  
  .template-description-two-column {
    font-size: 0.75rem;
  }
  
  .styles-grid-two-column {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}
  
  .section-content {
    padding: 0.75rem;
  }
  
  .upload-area-two-column {
    min-height: 80px;
    padding: 0.75rem;
  }
  
  .prompt-textarea {
    min-height: 60px;
  }
  
  /* Mobile responsive flex adjustments */
  .uploaded-files-grid[data-count="3"] .uploaded-file-item,
  .uploaded-files-grid[data-count="4"] .uploaded-file-item {
    flex: 0 0 calc(50% - 0.25rem);
  }
  
  .uploaded-files-grid[data-count="5"] .uploaded-file-item,
  .uploaded-files-grid[data-count="6"] .uploaded-file-item,
  .uploaded-files-grid[data-count="7"] .uploaded-file-item,
  .uploaded-files-grid[data-count="8"] .uploaded-file-item {
    flex: 0 0 calc(50% - 0.25rem);
  }
  
  .uploaded-file-item {
    min-width: 50px;
    max-width: 100px;
  }
}

/* Template Settings Styles - Compact Inline */
.template-settings-generate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.template-settings-section {
  flex: 1;
}

.settings-cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.setting-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 8px 12px;
  border: 1px solid #e9ecef;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: auto;
  flex-shrink: 0;
}

.setting-card:hover {
  border-color: #6c757d;
  background: #e9ecef;
}

.setting-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
}

.setting-icon {
  width: 16px;
  height: 16px;
  color: #6c757d;
  flex-shrink: 0;
}

.setting-card-title {
  font-size: 13px;
  font-weight: 500;
  color: #495057;
  margin: 0;
  white-space: nowrap;
}

.setting-required {
  color: #dc3545;
  font-size: 12px;
  font-weight: 500;
}

.setting-card-content {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Select Input Styles */
.setting-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}

.setting-card-select {
  padding: 4px 8px;
  background: white;
  border: 1px solid #ced4da;
  border-radius: 4px;
  color: #495057;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  min-width: 80px;
}

.setting-card-select:focus {
  outline: none;
  border-color: #80bdff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.setting-card-select:hover {
  border-color: #adb5bd;
}

.setting-current-value {
  display: none;
}

.chevron-down {
  display: none;
}

/* Range Input Styles */
.setting-range-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.setting-card-range {
  width: 80px;
  height: 4px;
  background: #e9ecef;
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.setting-card-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: #007bff;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.setting-card-range::-webkit-slider-thumb:hover {
  background: #0056b3;
}

.setting-card-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #007bff;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.setting-range-value {
  text-align: center;
}

.setting-range-value span {
  background: #e9ecef;
  color: #495057;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
  font-size: 11px;
  display: inline-block;
  min-width: 30px;
}

/* Number Input Styles */
.setting-card-number {
  width: 60px;
  padding: 4px 8px;
  background: white;
  border: 1px solid #ced4da;
  border-radius: 4px;
  color: #495057;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.setting-card-number:focus {
  outline: none;
  border-color: #80bdff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.setting-card-number:hover {
  border-color: #adb5bd;
}

/* Checkbox Styles */
.setting-card-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.setting-card-checkbox:hover .setting-checkbox-checkmark {
  border-color: #adb5bd;
}

.setting-card-checkbox input[type="checkbox"] {
  display: none;
}

.setting-checkbox-checkmark {
  width: 16px;
  height: 16px;
  background: white;
  border: 1px solid #ced4da;
  border-radius: 3px;
  display: inline-block;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.setting-card-checkbox input[type="checkbox"]:checked + .setting-checkbox-checkmark {
  background: #007bff;
  border-color: #007bff;
}

.setting-card-checkbox input[type="checkbox"]:checked + .setting-checkbox-checkmark::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 3px;
  height: 6px;
  border: solid white;
  border-width: 0 1px 1px 0;
  transform: rotate(45deg);
}

.setting-checkbox-label {
  color: #495057;
  font-size: 12px;
  font-weight: 500;
}

/* Credit display update animation */
.generate-credits {
  transition: all 0.3s ease;
}

.generate-credits.updating {
  transform: scale(1.1);
  color: #fbbf24;
}

/* Settings responsiveness */
@media (max-width: 768px) {
  .template-settings-generate-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .settings-cards-grid {
    gap: 8px;
    justify-content: center;
  }
  
  .setting-card {
    padding: 6px 10px;
  }
  
  .setting-icon {
    width: 14px;
    height: 14px;
  }
  
  .setting-card-title {
    font-size: 12px;
  }
  
  .setting-card-select {
    min-width: 70px;
    font-size: 11px;
  }
  
  .setting-card-range {
    width: 60px;
  }
  
  .setting-card-number {
    width: 50px;
    font-size: 11px;
  }
}

