/**
 * @file
 * Styles for NuTrend instant analysis interface.
 */

/* Instant Analysis Controls */
.nutrend-instant-controls {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 0;
  color: white;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.nutrend-instant-controls h3 {
  margin-top: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
}

.nutrend-instant-controls .controls-description {
  margin-bottom: 1.5rem;
  opacity: 0.9;
  line-height: 1.6;
}

.nutrend-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  align-items: start;
}

.control-section {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
}

.control-section h4 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  color: white;
}

/* Analysis Buttons */
.nutrend-instant-analysis-btn,
.nutrend-analyze-single-item {
  background: linear-gradient(45deg, #4CAF50, #45a049);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.nutrend-instant-analysis-btn:hover,
.nutrend-analyze-single-item:hover {
  background: linear-gradient(45deg, #45a049, #4CAF50);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.nutrend-instant-analysis-btn:active,
.nutrend-analyze-single-item:active {
  transform: translateY(0);
}

.nutrend-instant-analysis-btn.analyzing,
.nutrend-analyze-single-item.analyzing {
  background: linear-gradient(45deg, #ff9800, #f57c00);
  cursor: not-allowed;
  animation: pulse 2s infinite;
}

.nutrend-instant-analysis-btn:disabled,
.nutrend-analyze-single-item:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

@keyframes pulse {
  0% { box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3); }
  50% { box-shadow: 0 4px 25px rgba(255, 152, 0, 0.6); }
  100% { box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3); }
}

/* Permission Warning */
.permission-warning {
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 6px;
  padding: 1rem;
  margin: 1rem 0;
  color: rgba(255, 255, 255, 0.9);
}

.permission-warning .warning-icon {
  display: inline-block;
  margin-right: 0.5rem;
  font-weight: bold;
}

/* Analysis Status */
.nutrend-analysis-status {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  margin-left: 1rem;
}

.nutrend-analysis-status.status-none {
  background: rgba(108, 117, 125, 0.2);
  color: rgba(255, 255, 255, 0.7);
}

.nutrend-analysis-status.status-complete {
  background: rgba(40, 167, 69, 0.2);
  color: #28a745;
}

.nutrend-analysis-status.status-processing {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
  animation: processing-blink 1.5s infinite;
}

@keyframes processing-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.6; }
}

.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.5rem;
}

.status-none .status-indicator {
  background: #6c757d;
}

.status-complete .status-indicator {
  background: #28a745;
}

.status-processing .status-indicator {
  background: #ffc107;
  animation: pulse 1s infinite;
}

/* Progress Indicator */
#nutrend-analysis-progress {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  display: none;
}

.progress-container {
  margin-bottom: 1rem;
}

.progress-bar-container {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  height: 20px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  background: linear-gradient(45deg, #4CAF50, #45a049);
  height: 100%;
  border-radius: 10px;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    transparent 35%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 65%
  );
  animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-message {
  color: white;
  font-weight: 500;
  margin-top: 0.5rem;
  text-align: center;
}

.progress-percentage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-weight: bold;
  font-size: 0.8rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Messages */
#nutrend-messages {
  margin: 1rem 0;
}

#nutrend-messages .messages {
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

#nutrend-messages .messages--success {
  background: rgba(40, 167, 69, 0.1);
  border: 1px solid rgba(40, 167, 69, 0.3);
  color: #28a745;
}

#nutrend-messages .messages--error {
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.3);
  color: #dc3545;
}

/* Analysis Summary */
#nutrend-analysis-summary {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  display: none;
}

.analysis-summary h3 {
  margin-top: 0;
  color: white;
  font-size: 1.3rem;
}

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

.stat-item {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 1rem;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 0.5rem;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: bold;
  color: #4CAF50;
}

/* Collection Gallery */
.nutrend-collection-gallery {
  margin: 2rem 0;
}

.nutrend-collection-gallery h3 {
  margin-bottom: 1.5rem;
  color: #333;
  font-size: 1.4rem;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.collection-item {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.collection-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.item-image-container {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
}

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

.collection-item:hover .item-image {
  transform: scale(1.05);
}

.item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  padding: 1rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.collection-item:hover .item-overlay {
  transform: translateY(0);
}

.item-controls {
  padding: 1rem;
  text-align: center;
}

.item-index {
  display: inline-block;
  background: #667eea;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.nutrend-analyze-single-item {
  width: 100%;
  font-size: 0.9rem;
  padding: 0.75rem 1rem;
}

/* Modal Styles */
.nutrend-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(5px);
}

.nutrend-modal {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 90vw;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modal-appear 0.3s ease;
}

@keyframes modal-appear {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-body {
  padding: 2rem;
  max-height: 60vh;
  overflow-y: auto;
}

.single-item-analysis .analysis-section {
  margin-bottom: 1.5rem;
}

.single-item-analysis .analysis-section:last-child {
  margin-bottom: 0;
}

.single-item-analysis h4 {
  color: #333;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e9ecef;
}

.single-item-analysis ul {
  margin: 0;
  padding-left: 1.5rem;
}

.single-item-analysis li {
  margin-bottom: 0.5rem;
  color: #555;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nutrend-instant-controls {
    padding: 1.5rem;
  }
  
  .nutrend-controls-grid {
    grid-template-columns: 1fr;
  }
  
  .collection-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }
  
  .summary-stats {
    grid-template-columns: 1fr;
  }
  
  .nutrend-modal {
    width: 95vw;
    margin: 1rem;
  }
  
  .modal-body {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .nutrend-instant-controls {
    padding: 1rem;
  }
  
  .collection-grid {
    grid-template-columns: 1fr;
  }
  
  .nutrend-instant-analysis-btn,
  .nutrend-analyze-single-item {
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* Loading States */
.analyzing-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Utility Classes */
.text-center {
  text-align: center;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}