/**
 * NuTrend Analysis Styles
 */

/* Reset and Base */
.nutrend-analysis * {
  box-sizing: border-box;
}

.nutrend-analysis {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: #1a1a1a;
  line-height: 1.6;
  background-color: #f8f9fa;
  min-height: 100vh;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.nutrend-header {
  background: #fff;
  padding: 20px 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 24px;
  font-weight: 700;
  color: #000;
  letter-spacing: -0.5px;
}

.nav-actions {
  display: flex;
  gap: 20px;
  align-items: center;
}

.btn-export {
  background: #000;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-export:hover {
  opacity: 0.8;
  color: #fff;
}

.icon {
  width: 16px;
  height: 16px;
  opacity: 0.8;
}

/* Hero Section */
.nutrend-hero {
  background: #fff;
  padding: 40px 0;
  border-bottom: 1px solid #e0e0e0;
}

.collection-header {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

.collection-info {
  flex: 1;
}

.collection-title {
  font-size: 36px;
  font-weight: 300;
  margin: 0 0 10px;
  letter-spacing: -1px;
}

.collection-meta {
  display: flex;
  gap: 30px;
  margin-bottom: 20px;
  color: #666;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.processing-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #2e7d32;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Key Insights */
.key-insights {
  background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
  padding: 30px;
  border-radius: 12px;
  margin-top: 30px;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.insight-card {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  transition: transform 0.2s;
}

.insight-card:hover {
  transform: translateY(-2px);
}

.insight-label {
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.insight-value {
  font-size: 20px;
  font-weight: 600;
  color: #000;
}

/* Analysis Sections */
.analysis-section {
  margin-top: 40px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease-out;
}

.analysis-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-title {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
}

.view-toggle {
  display: flex;
  gap: 8px;
  background: #f0f0f0;
  padding: 4px;
  border-radius: 6px;
}

.toggle-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-btn.active {
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Color Harmonies */
.color-harmonies {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.harmony-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: transform 0.2s;
}

.harmony-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.harmony-gradient {
  height: 120px;
  position: relative;
  overflow: hidden;
}

.harmony-content {
  padding: 20px;
}

.harmony-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px;
}

.harmony-description {
  font-size: 14px;
  color: #666;
  margin: 0 0 16px;
}

.color-codes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f5f5f5;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
}

.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.1);
}

/* Garment Category Analysis */
.garment-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.garment-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: transform 0.2s, box-shadow 0.2s;
}

.garment-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.garment-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.garment-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.garment-icon-dress { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.garment-icon-jacket { background: linear-gradient(135deg, #10b981, #059669); }
.garment-icon-pants { background: linear-gradient(135deg, #f59e0b, #d97706); }
.garment-icon-top { background: linear-gradient(135deg, #ec4899, #db2777); }
.garment-icon-skirt { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.garment-icon-accessory { background: linear-gradient(135deg, #a855f7, #9333ea); }

.garment-info h4 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px;
}

.garment-count {
  font-size: 14px;
  color: #666;
}

.garment-colors {
  display: flex;
  height: 40px;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.color-bar {
  transition: all 0.3s;
  position: relative;
}

.color-bar:hover {
  transform: scaleY(1.1);
}

.color-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.2s;
}

.color-item:hover {
  background: #f8f9fa;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.1);
}

.color-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.color-percentage {
  font-size: 14px;
  font-weight: 600;
  color: #666;
}

/* Comparison Matrix */
.comparison-matrix {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-top: 24px;
}

.matrix-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 20px;
}

.matrix-grid {
  display: grid;
  gap: 1px;
  background: #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

/* Charts */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.chart-card {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.chart-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 20px;
}

.chart-placeholder {
  height: 300px;
  position: relative;
}

/* AI Insights */
.ai-insights {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.ai-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.ai-header h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.ai-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  font-size: 12px;
}

.ai-paragraph {
  font-size: 16px;
  line-height: 1.8;
  color: #333;
  margin-bottom: 16px;
}

.key-findings {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  margin-top: 20px;
}

.findings-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  color: #666;
}

.finding-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.finding-bullet {
  width: 24px;
  height: 24px;
  background: #e3f2fd;
  color: #1976d2;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
}

.insights-subtitle {
  font-size: 18px;
  font-weight: 600;
  margin: 24px 0 16px;
}

.recommendation-item {
  margin-bottom: 12px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
}

/* Image Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.gallery-item {
  aspect-ratio: 3/4;
  background: #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s;
}

.gallery-item:hover {
  transform: scale(1.02);
}

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

.gallery-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  padding: 20px 12px 12px;
  color: #fff;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  padding: 32px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
}

.modal-close {
  background: #000;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 16px;
}

/* Responsive */
@media (max-width: 768px) {
  .collection-title {
    font-size: 28px;
  }
  
  .collection-meta {
    flex-direction: column;
    gap: 10px;
  }
  
  .insights-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .color-harmonies,
  .garment-analysis-grid,
  .charts-grid {
    grid-template-columns: 1fr;
  }
  
  .section-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }
}

/* Add this to css/nutrend-analysis.css */

/* Color Harmony Views */
.harmony-card[data-view="gradients"] .view-gradients { display: block; }
.harmony-card[data-view="gradients"] .view-palettes { display: none; }
.harmony-card[data-view="gradients"] .view-swatches { display: none; }

.harmony-card[data-view="palettes"] .view-gradients { display: none; }
.harmony-card[data-view="palettes"] .view-palettes { display: block; }
.harmony-card[data-view="palettes"] .view-swatches { display: none; }

.harmony-card[data-view="swatches"] .view-gradients { display: none; }
.harmony-card[data-view="swatches"] .view-palettes { display: none; }
.harmony-card[data-view="swatches"] .view-swatches { display: block; }

/* Palette View */
.harmony-palette {
  padding: 20px;
  height: 120px;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  height: 80px;
}

.palette-color {
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s;
}

.palette-color:hover {
  transform: scale(1.1);
  z-index: 10;
}

.palette-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #666;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
}

.palette-color:hover .palette-label {
  opacity: 1;
}

/* Swatches View */
.harmony-swatches {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.swatch-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.swatch-color {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.swatch-info {
  flex: 1;
  min-width: 0;
}

.swatch-name {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swatch-code {
  font-size: 11px;
  color: #666;
  font-family: monospace;
}

/* Chart Containers */
.chart-placeholder {
  position: relative;
  height: 300px;
  padding: 10px;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.chart-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.chart-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #333;
}

/* Color Matrix Enhancement */
#color-matrix {
  min-height: 200px;
}

#color-matrix .matrix-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
}

#color-matrix .matrix-cell[data-value="0"] {
  color: #e0e0e0;
  background: #fafafa;
}

#color-matrix .matrix-cell:not(.header):hover {
  background: #e3f2fd !important;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 10;
  font-weight: 700;
}

/* Loading state for charts */
.chart-placeholder.loading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-placeholder.loading::after {
  content: 'Loading chart...';
  color: #666;
  font-size: 14px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  
  .harmony-swatches {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .palette-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Add this to css/nutrend-analysis.css */

/* Lightbox */
.nutrend-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  transition: opacity 0.2s;
}

.lightbox-close:hover {
  opacity: 0.7;
}

/* Chart error message */
.chart-error {
  text-align: center;
  color: #666;
  padding: 40px;
  font-size: 14px;
}

/* Matrix hover effects */
#color-matrix .matrix-cell.hover-active {
  background: #1976d2 !important;
  color: #fff !important;
  font-weight: bold;
}

#color-matrix .matrix-cell.hover-row {
  background: rgba(25, 118, 210, 0.1);
}

#color-matrix .matrix-cell.hover-column {
  background: rgba(25, 118, 210, 0.1);
}

#color-matrix .matrix-cell.hover-row.hover-column {
  background: rgba(25, 118, 210, 0.2);
}

/* List view for garment categories */
.garment-analysis-grid.list-view {
  display: block;
}

.garment-analysis-grid.list-view .garment-card {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  padding: 16px;
}

.garment-analysis-grid.list-view .garment-header {
  margin-bottom: 0;
  margin-right: 24px;
}

.garment-analysis-grid.list-view .garment-colors {
  width: 200px;
  height: 30px;
  margin: 0 24px 0 0;
}

.garment-analysis-grid.list-view .color-details {
  display: flex;
  flex-direction: row;
  gap: 16px;
}

/* Animation */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}



