/* shared-styles.css - Common styles for all design pages */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #e3e3e3 0%, #030105 100%);
  min-height: 100vh;
}

/* Navigation */
.navbar {
  background: white;
  padding: 16px 40px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: #667eea;
  text-decoration: none;
  transition: transform 0.3s ease;
}

.nav-brand:hover {
  transform: scale(1.05);
}

.nav-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.nav-links a {
  color: #666;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.nav-links a:hover {
  background: #f8f9ff;
  color: #667eea;
}

.nav-links a.active {
  background: #667eea;
  color: white;
}

/* Main Container */
.container {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 20px;
  max-width: 1600px;
  margin: 20px auto;
  padding: 0 20px;
  min-height: calc(100vh - 100px);
}

.left-panel,
.center-panel,
.right-panel {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  max-height: calc(100vh - 140px);
}

h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.4rem;
}

h3 {
  color: #333;
  margin-bottom: 15px;
  font-size: 1.1rem;
}

/* Upload Section */
.upload-area {
  border: 2px dashed #667eea;
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #f8f9ff;
  margin-bottom: 20px;
}

.upload-area:hover {
  border-color: #764ba2;
  background: #f0f2ff;
  transform: translateY(-2px);
}

.upload-placeholder svg {
  color: #667eea;
  margin-bottom: 16px;
}

.upload-placeholder p {
  color: #333;
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.upload-placeholder small {
  color: #666;
  font-size: 0.9rem;
}

#uploadedPreview {
  max-width: 100%;
  border-radius: 8px;
  display: block;
}

/* History Section - IMPORTANT */
.history-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 2px solid #f0f0f0;
}

.history-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-height: 500px;
  overflow-y: auto;
  padding: 4px;
}

.history-item {
  position: relative;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  background: white;
}

.history-item:hover {
  border-color: #667eea;
  transform: translateX(-3px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.history-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: #f0f0f0;
}

.history-img {
  width: 100%;
  height: 80px;
  object-fit: cover;
}

.history-label {
  padding: 8px;
  font-size: 0.8rem;
  color: #666;
  background: white;
  text-align: center;
  font-weight: 500;
}

.history-meta {
  padding: 6px 8px;
  font-size: 0.75rem;
  color: #999;
  background: #f8f9ff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-download {
  background: #667eea;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.history-download:hover {
  background: #5568d3;
  transform: scale(1.05);
}

/* Center Panel */
.center-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.view-controls {
  display: flex;
  gap: 8px;
}

.view-btn {
  padding: 8px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.view-btn:hover {
  border-color: #667eea;
  background: #f8f9ff;
}

.view-btn.active {
  border-color: #667eea;
  background: #667eea;
}

.view-btn.active svg {
  stroke: white;
}

/* Image Comparison */
.image-comparison-container {
  width: 100%;
  height: calc(100% - 80px);
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-message {
  text-align: center;
  color: #999;
  padding: 60px 40px;
}

.placeholder-message svg {
  margin-bottom: 20px;
  opacity: 0.5;
}

.image-comparison {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.image-wrapper {
  position: relative;
  width: 100%;
  flex: 1;
  overflow: hidden;
  border-radius: 8px;
  background: #f5f5f5;
}

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

#beforeImage {
  z-index: 1;
}

#afterImage {
  z-index: 2;
  clip-path: inset(0 50% 0 0);
}

/* Download Buttons */
.image-actions {
  position: absolute;
  z-index: 15;
  display: flex;
  gap: 8px;
}

.before-actions {
  top: 12px;
  left: 12px;
}

.after-actions {
  top: 12px;
  right: 12px;
}

.action-btn {
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.action-btn:hover {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.action-btn svg {
  stroke: #667eea;
}

/* Slider */
.slider-overlay {
  position: absolute;
  top: 0;
  left: 50%;
  width: 4px;
  height: 100%;
  background: white;
  transform: translateX(-50%);
  cursor: ew-resize;
  z-index: 10;
}

.slider-line {
  width: 100%;
  height: 100%;
  background: white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.slider-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: #667eea;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.slider {
  width: 100%;
  margin: 16px 0;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, #667eea 0%, #764ba2 100%);
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  border: 3px solid #667eea;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  border: 3px solid #667eea;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #666;
  margin-top: 8px;
  font-weight: 500;
}

/* Preview Grid */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-height: 500px;
  overflow-y: auto;
  padding: 4px;
}

.preview-item {
  cursor: pointer;
  border: 3px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  background: white;
}

.preview-item:hover {
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.preview-item.selected {
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

.preview-item img {
  width: 100%;
  height: 100px;
  object-fit: cover;
}

.preview-label {
  padding: 8px;
  background: white;
  text-align: center;
  font-size: 0.85rem;
  color: #333;
  font-weight: 500;
}

.preview-item.selected .preview-label {
  background: #667eea;
  color: white;
}

/* Buttons */
.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 12px;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Loading */
.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.error-text {
  color: #e74c3c;
  background: #ffe6e6;
  padding: 12px;
  border-radius: 6px;
  font-size: 0.9rem;
}

/* Generation Info */
.generation-info {
  margin-top: 20px;
  padding: 16px;
  background: #f8f9ff;
  border-radius: 8px;
  border: 1px solid #e0e8ff;
}

.info-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e0e8ff;
}

.info-item:last-child {
  border-bottom: none;
}

.info-label {
  font-weight: 600;
  color: #666;
  font-size: 0.9rem;
}

.info-value {
  color: #667eea;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 10px;
}

/* Responsive */
@media (max-width: 1200px) {
  .container {
    grid-template-columns: 1fr;
    height: auto;
  }

  .left-panel,
  .center-panel,
  .right-panel {
    max-height: none;
  }

  .history-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 12px 20px;
  }

  .nav-links {
    gap: 8px;
  }

  .nav-links a {
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .history-grid {
    grid-template-columns: 1fr;
  }
}

