/**
 * AI Canvas Creator - Frontend Styles (Light Theme)
 */

:root {
  --acc-primary: #6366f1;
  --acc-primary-hover: #4f46e5;
  --acc-secondary: #10b981;
  --acc-background: #ffffff;
  --acc-surface: #f8fafc;
  --acc-surface-hover: #f1f5f9;
  --acc-text: #1e293b;
  --acc-text-secondary: #64748b;
  --acc-border: #e2e8f0;
  --acc-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --acc-shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --acc-radius: 12px;
  --acc-radius-sm: 8px;
}

/* Container */
.acc-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  color: var(--acc-text);
}

.acc-container * {
  box-sizing: border-box;
}

/* Steps */
.acc-step {
  background: var(--acc-background);
  border: 1px solid var(--acc-border);
  border-radius: var(--acc-radius);
  padding: 30px;
  margin-bottom: 20px;
  box-shadow: var(--acc-shadow);
}

/* Step Header */
.acc-step-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
}

.acc-step-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--acc-text);
}

.acc-step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  background: var(--acc-primary);
  color: white;
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: 700;
  flex-shrink: 0;
}

.acc-step h3 {
  margin: 0 0 20px 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--acc-text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.acc-step h3::before {
  content: attr(data-step-num);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--acc-primary);
  color: white;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 600;
}

/* Upload Zone */
.acc-upload-zone {
  border: 2px dashed var(--acc-border);
  border-radius: var(--acc-radius);
  padding: 50px 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--acc-surface);
}

.acc-upload-zone:hover,
.acc-upload-zone.dragover {
  border-color: var(--acc-primary);
  background: #f0f1ff;
}

.acc-upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.acc-upload-icon {
  font-size: 48px;
  margin-bottom: 5px;
  color: var(--acc-primary);
}

.acc-upload-zone h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--acc-text);
}

.acc-upload-zone h4 {
  margin: 0 0 8px 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--acc-text);
}

.acc-upload-zone p {
  margin: 0;
  color: var(--acc-text-secondary);
  font-size: 0.875rem;
}

.acc-upload-requirements {
  margin-top: 5px;
}

/* File Input - Hidden but accessible */
.acc-upload-zone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Upload Progress */
.acc-upload-progress {
  padding: 30px;
  text-align: center;
}

.acc-progress-bar {
  height: 8px;
  background: var(--acc-surface);
  border-radius: 4px;
  overflow: hidden;
  margin: 15px 0;
}

.acc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--acc-primary), var(--acc-secondary));
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Upload Preview */
.acc-upload-preview {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 20px;
  background: var(--acc-surface);
  border-radius: var(--acc-radius);
}

.acc-upload-preview img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--acc-radius-sm);
  border: 1px solid var(--acc-border);
}

.acc-preview-info {
  flex: 1;
}

.acc-preview-info h4 {
  margin: 0 0 5px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--acc-text);
}

.acc-preview-info p {
  margin: 0;
  color: var(--acc-text-secondary);
  font-size: 0.875rem;
}

/* Styles Grid */
.acc-styles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 15px;
}

/* Locked state during processing */
.acc-styles-grid.acc-styles-locked {
  pointer-events: none;
}

.acc-style-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(50%);
}

.acc-style-card.locked:hover {
  transform: none;
  border-color: var(--acc-border);
  box-shadow: none;
}

/* Hidden styles (non-selected when one is chosen) */
.acc-style-card.acc-hidden {
  display: none !important;
}

/* Selected mode - grid becomes single item display */
.acc-styles-grid.acc-style-selected-mode {
  display: flex;
  justify-content: center;
}

/* Chosen style - prominent row layout */
.acc-style-card.acc-style-chosen {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  padding: 20px 40px;
  min-width: 280px;
  max-width: 400px;
  opacity: 1;
  cursor: default;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border-color: var(--acc-primary);
  box-shadow:
    0 0 0 3px rgba(99, 102, 241, 0.2),
    var(--acc-shadow-lg);
}

.acc-style-card.acc-style-chosen .acc-style-icon {
  font-size: 48px;
  margin-bottom: 0;
}

.acc-style-card.acc-style-chosen h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

/* Small styles before upload */
.acc-styles-grid:not(.acc-styles-ready) {
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
}

.acc-styles-grid:not(.acc-styles-ready) .acc-style-card {
  padding: 10px 8px;
  opacity: 0.6;
}

.acc-styles-grid:not(.acc-styles-ready) .acc-style-icon {
  font-size: 20px;
  margin-bottom: 5px;
}

.acc-styles-grid:not(.acc-styles-ready) .acc-style-card h4 {
  font-size: 0.7rem;
}

/* Normal styles after upload */
.acc-style-card {
  background: var(--acc-surface);
  border: 2px solid var(--acc-border);
  border-radius: var(--acc-radius);
  padding: 20px 15px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.acc-style-card:hover {
  border-color: var(--acc-primary);
  background: var(--acc-surface-hover);
  transform: translateY(-2px);
  box-shadow: var(--acc-shadow);
}

.acc-style-card.selected {
  border-color: var(--acc-primary);
  background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.acc-style-icon {
  font-size: 32px;
  margin-bottom: 10px;
}

.acc-style-card h4 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--acc-text);
}

/* Generating State */
.acc-generating {
  text-align: center;
  padding: 60px 30px;
}

.acc-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid var(--acc-border);
  border-top-color: var(--acc-primary);
  border-radius: 50%;
  animation: acc-spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes acc-spin {
  to {
    transform: rotate(360deg);
  }
}

.acc-generating h4 {
  margin: 0 0 10px 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--acc-text);
}

.acc-generating p {
  margin: 0;
  color: var(--acc-text-secondary);
}

/* Result Preview - Comparison */
.acc-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.acc-comparison-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.acc-comparison-item img {
  width: 100%;
  max-width: 350px;
  height: 280px;
  object-fit: contain;
  border-radius: var(--acc-radius);
  border: 1px solid var(--acc-border);
  box-shadow: var(--acc-shadow);
  background: var(--acc-surface);
}

.acc-comparison-label {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--acc-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.acc-result-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
}

/* Sizes Grid */
.acc-sizes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.acc-size-card {
  background: var(--acc-surface);
  border: 2px solid var(--acc-border);
  border-radius: var(--acc-radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.acc-size-card:hover {
  border-color: var(--acc-primary);
  background: var(--acc-surface-hover);
}

.acc-size-card.selected {
  border-color: var(--acc-primary);
  background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.acc-size-card h5 {
  margin: 0 0 8px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--acc-text);
}

.acc-size-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--acc-primary);
}

/* Order Summary */
.acc-order-summary {
  display: flex;
  gap: 25px;
  background: var(--acc-surface);
  border-radius: var(--acc-radius);
  padding: 25px;
  align-items: center;
}

.acc-summary-image {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--acc-radius-sm);
  border: 1px solid var(--acc-border);
}

.acc-summary-details {
  flex: 1;
}

.acc-summary-details p {
  margin: 0 0 8px 0;
  color: var(--acc-text);
  font-size: 0.95rem;
}

.acc-summary-details p strong {
  color: var(--acc-text);
}

.acc-summary-price {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--acc-primary);
  text-align: right;
}

/* Buttons */
.acc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--acc-radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.acc-btn-primary {
  background: var(--acc-primary);
  color: white;
}

.acc-btn-primary:hover:not(:disabled) {
  background: var(--acc-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--acc-shadow);
}

.acc-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.acc-btn-secondary {
  background: var(--acc-surface);
  color: var(--acc-text);
  border: 1px solid var(--acc-border);
}

.acc-btn-secondary:hover {
  background: var(--acc-surface-hover);
  border-color: var(--acc-primary);
}

.acc-btn-loading {
  display: none;
}

.acc-btn .acc-btn-loading {
  display: none;
}

/* Success State */
.acc-success {
  text-align: center;
  padding: 50px 30px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--acc-radius);
}

.acc-success-icon {
  font-size: 60px;
  margin-bottom: 20px;
}

.acc-success h3 {
  margin: 0 0 10px 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #166534;
}

.acc-success p {
  margin: 0 0 25px 0;
  color: #15803d;
}

.acc-success-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
}

/* Error State */
.acc-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--acc-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.acc-error-icon {
  font-size: 24px;
}

.acc-error-content {
  flex: 1;
}

.acc-error-content p {
  margin: 0;
  color: #991b1b;
  font-weight: 500;
}

.acc-error button {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #991b1b;
}

/* History Section */
.acc-history {
  background: var(--acc-background);
  border: 1px solid var(--acc-border);
  border-radius: var(--acc-radius);
  padding: 25px;
  margin-top: 20px;
  box-shadow: var(--acc-shadow);
}

.acc-history-header {
  margin-bottom: 20px;
  text-align: center;
}

.acc-history-header h3 {
  margin: 0 0 5px 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--acc-text);
}

.acc-history-header p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--acc-text-secondary);
}

.acc-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 15px;
}

.acc-history-item {
  position: relative;
  cursor: pointer;
  border-radius: var(--acc-radius-sm);
  overflow: hidden;
  border: 2px solid var(--acc-border);
  transition: all 0.3s ease;
}

.acc-history-item:hover {
  border-color: var(--acc-primary);
  transform: translateY(-2px);
  box-shadow: var(--acc-shadow);
}

.acc-history-item img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

.acc-history-label {
  display: block;
  padding: 8px;
  background: var(--acc-surface);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--acc-text);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hidden elements */
[style*="display: none"],
.acc-hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
  .acc-container {
    padding: 15px;
  }

  .acc-step {
    padding: 20px;
  }

  .acc-step-header {
    gap: 12px;
  }

  .acc-step-header h2 {
    font-size: 1.1rem;
  }

  .acc-step-number {
    min-width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  .acc-upload-zone {
    padding: 30px 20px;
  }

  .acc-upload-content {
    gap: 8px;
  }

  .acc-upload-icon svg {
    width: 48px;
    height: 48px;
  }

  .acc-upload-zone h3 {
    font-size: 1rem;
  }

  .acc-comparison {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .acc-comparison-item img {
    max-width: 100%;
    height: 220px;
  }

  .acc-order-summary {
    flex-direction: column;
    text-align: center;
  }

  .acc-summary-price {
    text-align: center;
  }

  .acc-styles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
