/**
 * AI Page Common Styles
 * Shared CSS for all AI service pages
 * Reduces duplicate inline <style> blocks in twig files
 */

/* ========== Upload Area ========== */
.upload-area {
  border: 2px dashed #dee2e6;
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #f8f9fa;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: #8e4af0;
  background: #f5f0ff;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6c757d;
}

.upload-placeholder p {
  font-size: 0.9rem;
}

.upload-icon svg {
  opacity: 0.7;
}

.upload-area .remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
}

/* Upload area color variants - use data-color attribute or classes */
.upload-area[data-color="purple"]:hover,
.upload-area[data-color="purple"].drag-over,
.upload-area.purple-hover:hover,
.upload-area.purple-hover.drag-over {
  border-color: #6c5ce7;
  background: #f0efff;
}

.upload-area[data-color="brown"]:hover,
.upload-area[data-color="brown"].drag-over,
.upload-area.brown-hover:hover,
.upload-area.brown-hover.drag-over {
  border-color: #8b4513;
  background: #faf0e6;
}

.upload-area[data-color="blue"]:hover,
.upload-area[data-color="blue"].drag-over,
.upload-area.blue-hover:hover,
.upload-area.blue-hover.drag-over {
  border-color: #3498db;
  background: #e8f4fc;
}

.upload-area[data-color="red"]:hover,
.upload-area[data-color="red"].drag-over,
.upload-area.red-hover:hover,
.upload-area.red-hover.drag-over,
.flash-sale-upload:hover,
.flash-sale-upload.drag-over {
  border-color: #dc3545;
  background: #fff5f5;
}

.upload-area[data-color="cyan"]:hover,
.upload-area[data-color="cyan"].drag-over,
.upload-area.cyan-hover:hover,
.upload-area.cyan-hover.drag-over,
.product-launch-upload:hover,
.product-launch-upload.drag-over {
  border-color: #17a2b8;
  background: #f0fafc;
}

.upload-area[data-color="green"]:hover,
.upload-area[data-color="green"].drag-over,
.upload-area.green-hover:hover,
.upload-area.green-hover.drag-over,
.speaker-upload:hover,
.speaker-upload.drag-over {
  border-color: #28a745;
  background: #f0fff4;
}

/* Upload preview - legacy */
.upload-preview {
  position: relative;
  width: 100%;
}

.upload-preview img {
  max-height: 200px;
  border-radius: 4px;
  object-fit: contain;
}

.remove-image {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 28px;
  height: 28px;
  padding: 0;
  line-height: 28px;
  font-size: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
}

/* ========== Upload Component (Reusable) ========== */
.upload-component {
  margin-bottom: 1rem;
}

.upload-component label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* Single image preview with remove button on top-right corner */
.upload-preview-single {
  position: relative;
  display: inline-block;
  max-width: 100%;
  text-align: center;
}

.upload-preview-single img {
  max-width: 100%;
  border-radius: 8px;
  object-fit: contain;
  display: block;
}

.upload-preview-single .remove-image-btn {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #dc3545;
  color: white;
  font-size: 16px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.upload-preview-single .remove-image-btn:hover {
  background: #c82333;
  transform: scale(1.15);
}

/* Multi-image preview grid */
.upload-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.upload-preview-grid .preview-item {
  position: relative;
  border-radius: 8px;
  overflow: visible;
}

.upload-preview-grid .preview-item img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
}

.upload-preview-grid .remove-image-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #dc3545;
  color: white;
  font-size: 14px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.upload-preview-grid .remove-image-btn:hover {
  background: #c82333;
  transform: scale(1.1);
}

/* Legacy multi-image preview grid */
.images-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.images-preview-grid .preview-item {
  position: relative;
  border-radius: 8px;
  overflow: visible;
}

.images-preview-grid .preview-item img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
}

.images-preview-grid .remove-single {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #dc3545;
  color: white;
  border: 2px solid #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.images-preview-grid .remove-single:hover {
  background: #c82333;
  transform: scale(1.1);
}

/* ========== Custom Aspect Ratio Inputs ========== */
#custom-ratio-inputs .input-group-text {
  background-color: #f8f9fa;
  border-top: 1px solid #ced4da;
  border-bottom: 1px solid #ced4da;
}

#custom-ratio-inputs .form-control,
#custom-ratio-inputs .input-group-text,
#custom-ratio-inputs .btn {
  height: calc(1.5em + 0.75rem + 2px);
  line-height: 1.5;
  padding-top: 0.375rem;
  padding-bottom: 0.375rem;
}

#apply-custom-ratio {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-color: #ced4da;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

/* ========== Poster Fields Animation ========== */
.poster-fields {
  animation: posterFadeIn 0.3s ease;
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
}

@keyframes posterFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.poster-fields .form-group:last-child {
  margin-bottom: 0;
}

#common-fields {
  border-top: 1px solid #dee2e6;
  padding-top: 15px;
  margin-top: 15px;
}

/* ========== Aspect Option Buttons ========== */
.aspect-option {
  border: 2px solid #dee2e6;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
}

.aspect-option:hover {
  border-color: #3498db;
}

.aspect-option input {
  display: none;
}

.aspect-option label {
  font-weight: bold;
  cursor: pointer;
  margin: 0;
}

/* ========== Result Container Layout ========== */
.result-container {
  border: 1px dashed #dee2e6;
  position: relative;
}

#result-image {
  width: 100%;
}

.result-image-container {
  text-align: center;
  position: relative;
}

/* ========== Example Card / Gallery Styles ========== */
.image-container {
  height: 300px;
  overflow: hidden;
  border-radius: 8px;
  position: relative;
}

.example-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
}

.example-card:hover .example-image {
  transform: scale(1.05);
}

.example-card {
  transition: all 0.3s ease;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.example-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.example-card:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.example-prompt {
  text-align: center;
  font-size: 0.9rem;
  color: #495057;
  padding: 10px 5px;
  height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.style-title {
  margin: 0 0 5px 0;
  font-weight: 600;
  color: #212529;
  font-size: 1.1rem;
}

.prompt-example {
  margin: 0;
  font-size: 0.85rem;
  color: #6c757d;
  font-style: italic;
  min-height: 2.6em;
  line-height: 1.3;
  padding-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.6em;
}

/* ========== How It Works Section ========== */
.how-it-works-section {
  margin-top: 10px !important;
}

/* ========== Section Margins ========== */
.commercial-poster-section {
  margin-bottom: 70px;
}

/* ========== Resolution Selection ========== */
.resolution-selection h5 {
  font-size: 1.1rem;
  margin-bottom: 15px;
  color: #333;
}

/* ========== Generate & Print Buttons ========== */
#generate-btn,
#print-btn {
  width: calc(50% - 0.5rem);
}

#print-btn {
  display: none;
}

/* ========== Mobile Responsive ========== */
@media (max-width: 991px) {
  .text-to-image-form-container,
  .product-model-display-form-container,
  .ai-form-container {
    margin-bottom: 30px;
  }
}

@media (max-width: 768px) {
  .section-description {
    display: none !important;
  }

  .upload-area {
    padding: 20px;
  }
}
