/**
 * Calculator Styles - Nutrition Calculator Interface
 * 🧮 CALCULATOR: Styles for calculator view and modal
 */

/* Calculator View Styles */
.calculator-view {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.calculator-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 30px;
  background: linear-gradient(135deg, #283655 0%, #1e2a43 100%);
  color: white;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.calculator-header h1 {
  font-size: 2.5rem;
  margin: 0 0 10px 0;
  font-weight: 700;
}

.calculator-header p {
  font-size: 1.2rem;
  margin: 0 0 20px 0;
  opacity: 0.9;
}

/* Access Status */
.access-status {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.access-granted {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.2);
  padding: 12px 20px;
  border-radius: 25px;
  backdrop-filter: blur(10px);
}

.access-required {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(255, 255, 255, 0.2);
  padding: 12px 20px;
  border-radius: 25px;
  backdrop-filter: blur(10px);
}

.access-icon {
  font-size: 1.2rem;
}

.access-text {
  font-weight: 600;
}

.calculations-remaining {
  background: rgba(255, 255, 255, 0.3);
  padding: 4px 12px;
  border-radius: 15px;
  font-size: 0.9rem;
}

.unlimited-calculations {
  background: rgba(76, 175, 80, 0.3);
  padding: 4px 12px;
  border-radius: 15px;
  font-size: 0.9rem;
}

/* Calculator Interface */
.calculator-interface {
  display: grid;
  gap: 30px;
}

/* Recipe Input Section */
.recipe-input-section {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.recipe-input-section h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.8rem;
}

.recipe-form {
  display: grid;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 600;
  color: #555;
  font-size: 1rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: 12px 16px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #283655;
  box-shadow: 0 0 0 3px rgba(40, 54, 85, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

.form-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 20px;
}

/* Premium Required Section */
.premium-required {
  background: white;
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.premium-content h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 2rem;
}

.premium-content p {
  color: #666;
  margin-bottom: 30px;
  font-size: 1.1rem;
  line-height: 1.6;
}

.premium-features {
  text-align: left;
  max-width: 500px;
  margin: 0 auto 30px;
}

.premium-features h3 {
  color: #333;
  margin-bottom: 15px;
  font-size: 1.3rem;
}

.premium-features ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.premium-features li {
  padding: 8px 0;
  color: #555;
  font-size: 1rem;
}

.upgrade-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Recent Calculations */
.recent-calculations {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.recent-calculations h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.8rem;
}

.calculations-list {
  display: grid;
  gap: 15px;
}

.calculation-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.calculation-item:hover {
  background: #e9ecef;
  border-color: #283655;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.calc-info h3 {
  margin: 0 0 5px 0;
  color: #333;
  font-size: 1.1rem;
}

.calc-info p {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

.calc-nutrition {
  text-align: right;
}

.calc-nutrition .calories {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  color: #283655;
  margin-bottom: 5px;
}

.calc-nutrition .macros {
  font-size: 0.9rem;
  color: #666;
}

.no-calculations {
  text-align: center;
  padding: 40px;
  color: #666;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.btn-primary {
  background: linear-gradient(135deg, #283655 0%, #1e2a43 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(40, 54, 85, 0.4);
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-2px);
}

.btn-large {
  padding: 16px 32px;
  font-size: 1.1rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Calculator Modal Styles */
.calculator-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.calculator-modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.calculator-modal-container {
  background: white;
  border-radius: 15px;
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.calculator-modal-backdrop.active .calculator-modal-container {
  transform: scale(1);
}

.calculator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  background: linear-gradient(135deg, #283655 0%, #1e2a43 100%);
  color: white;
}

.calculator-title h2 {
  margin: 0;
  font-size: 1.8rem;
}

.recipe-info {
  margin-top: 5px;
  font-size: 0.9rem;
  opacity: 0.9;
}

.usda-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.8rem;
  margin-left: 10px;
}

.calculator-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: background 0.3s ease;
}

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

/* Calculator Tabs */
.calculator-tabs {
  display: flex;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.calc-tab-btn {
  flex: 1;
  padding: 15px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: #666;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent;
}

.calc-tab-btn:hover {
  background: #e9ecef;
  color: #333;
}

.calc-tab-btn.active {
  color: #283655;
  border-bottom-color: #283655;
  background: white;
}

/* Calculator Content */
.calculator-content {
  max-height: 60vh;
  overflow-y: auto;
  padding: 30px;
}

.calc-tab-content {
  display: none;
}

.calc-tab-content.active {
  display: block;
}

/* Nutrition Facts */
.nutrition-facts-panel {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 10px;
  border: 2px solid #e9ecef;
}

.nutrition-facts-header {
  text-align: center;
  margin-bottom: 25px;
}

.nutrition-facts-header h3 {
  margin: 0 0 10px 0;
  font-size: 1.5rem;
  color: #333;
}

.serving-info {
  color: #666;
  font-size: 1rem;
  margin: 0 0 10px 0;
}

.usda-attribution {
  color: #999;
  font-size: 0.8rem;
}

.calories-section {
  border-bottom: 8px solid #333;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

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

.calories-label {
  font-size: 1.2rem;
  font-weight: 700;
}

.calories-value {
  font-size: 2rem;
  font-weight: 700;
}

.macronutrients-section h4 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 1.1rem;
}

.nutrient-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e9ecef;
}

.nutrient-row:last-child {
  border-bottom: none;
}

.nutrient-label {
  font-weight: 600;
  color: #333;
}

.nutrient-value {
  font-weight: 600;
  color: #333;
}

/* Calculator Controls */
.calculator-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
}

.servings-control {
  display: flex;
  align-items: center;
  gap: 15px;
}

.servings-control label {
  font-weight: 600;
  color: #333;
}

.servings-input {
  width: 80px;
  padding: 8px 12px;
  border: 2px solid #e1e5e9;
  border-radius: 5px;
  text-align: center;
}

.recalculate-btn {
  padding: 8px 16px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s ease;
}

.recalculate-btn:hover {
  background: #218838;
}

.calculator-actions {
  display: flex;
  gap: 10px;
}

.calc-action-btn {
  padding: 10px 20px;
  background: #283655;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.calc-action-btn:hover {
  background: #1e2a43;
}

/* Loading States */
.calculator-loading {
  text-align: center;
  padding: 60px 30px;
}

.loading-spinner {
  margin-bottom: 20px;
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
  .calculator-view {
    padding: 10px;
  }

  .calculator-header {
    padding: 20px;
  }

  .calculator-header h1 {
    font-size: 2rem;
  }

  .access-status {
    flex-direction: column;
    gap: 10px;
  }

  .form-actions {
    flex-direction: column;
  }

  .calculation-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .calc-nutrition {
    text-align: left;
  }

  .calculator-modal-container {
    width: 95%;
    margin: 10px;
  }

  .calculator-tabs {
    flex-wrap: wrap;
  }

  .calc-tab-btn {
    flex: 1 1 50%;
    font-size: 0.9rem;
    padding: 12px 15px;
  }

  .calculator-controls {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .servings-control {
    justify-content: center;
  }

  .calculator-actions {
    justify-content: center;
  }
}

/* Login Required States */
.calculator-login-required,
.premium-required {
  text-align: center;
  padding: 60px 30px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.calculator-login-required h3,
.premium-required h3 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.8rem;
}

.calculator-login-required p,
.premium-required p {
  color: #666;
  margin-bottom: 30px;
  font-size: 1.1rem;
  line-height: 1.6;
}

.login-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ========================================
   ADDITIONAL STYLES FOR CALCULATOR UI
   Referenced in calculator-ui.js comments
   ======================================== */

/* Ingredient card states */
.ingredient-card.zero-data {
  border-left: 4px solid #ff9800;
  background-color: #fff3e0;
}

.ingredient-card.valid {
  border-left: 4px solid #28a745;
}

.ingredient-card.unmapped {
  border-left: 4px solid #f44336;
  background-color: #ffebee;
}

/* Warning data */
.warning-data {
  padding: 12px;
  background-color: #fff3e0;
  border-radius: 4px;
  margin: 8px 0;
}

.warning-data p {
  margin: 4px 0;
  color: #f57c00;
  font-size: 14px;
}

.warning-data .help-text {
  font-size: 12px;
  color: #666;
}

/* Refetch button */
.btn-refetch {
  width: 100%;
  padding: 10px;
  margin-top: 12px;
  background-color: #DFA774;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.btn-refetch:hover {
  background-color: #d4955f;
}

/* Zero value nutrition */
.nutrition-card.zero-value {
  opacity: 0.5;
  position: relative;
}

.zero-warning {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 16px;
}

/* ========================================
   NUTRITION SUMMARY SECTIONS
   For Total Recipe and Per-Serving display
   ======================================== */

/* Calculator Section Container */
.calculator-section {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.calculator-section h3 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.8rem;
  font-weight: 700;
}

/* Nutrition Section */
.nutrition-section {
  background: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

/* Section Subtitle */
.section-subtitle {
  color: #333;
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 20px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid #e9ecef;
}

/* Total Recipe Nutrition Section */
.nutrition-total-section {
  margin-bottom: 30px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 10px;
  border-left: 4px solid #283655;
}

.nutrition-total-section .section-subtitle {
  color: #283655;
  border-bottom-color: #283655;
}

/* Per-Serving Nutrition Section */
.nutrition-serving-section {
  margin-top: 30px;
  padding: 20px;
  background: #f0f7ff;
  border-radius: 10px;
  border-left: 4px solid #28a745;
}

.nutrition-serving-section .section-subtitle {
  color: #28a745;
  border-bottom-color: #28a745;
}

/* Nutrition Grid */
.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.nutrition-grid-full {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

/* Nutrition Card */
.nutrition-card {
  background: white;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  transition: all 0.3s ease;
}

.nutrition-card:hover {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.nutrition-card-label {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 5px;
  font-weight: 500;
}

.nutrition-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #333;
}

.nutrition-card-unit {
  font-size: 0.9rem;
  color: #999;
  margin-left: 4px;
}

/* Primary Nutrients (Calories, Protein, Carbs, Fat) */
.nutrition-card.primary {
  background: linear-gradient(135deg, #283655 0%, #1e2a43 100%);
  color: white;
  border: none;
}

.nutrition-card.primary .nutrition-card-label,
.nutrition-card.primary .nutrition-card-value,
.nutrition-card.primary .nutrition-card-unit {
  color: white;
}

/* Validation Messages */
.validation-message {
  padding: 12px 16px;
  border-radius: 8px;
  margin: 10px 0;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.validation-message.error {
  background-color: #ffebee;
  border-left: 4px solid #f44336;
  color: #c62828;
}

.validation-message.warning {
  background-color: #fff3e0;
  border-left: 4px solid #ff9800;
  color: #e65100;
}

.validation-message.info {
  background-color: #ebeef3;
  border-left: 4px solid #283655;
  color: #1e2a43;
}

.validation-message.success {
  background-color: #d4edda;
  border-left: 4px solid #28a745;
  color: #2e7d32;
}

.validation-message-icon {
  font-size: 1.2rem;
}

/* No Data Message */
.no-data {
  text-align: center;
  padding: 40px;
  color: #999;
  font-style: italic;
}

/* Responsive Design for Nutrition Sections */
@media (max-width: 768px) {
  .nutrition-grid {
    grid-template-columns: 1fr;
  }

  .nutrition-grid-full {
    grid-template-columns: 1fr;
  }

  .nutrition-total-section,
  .nutrition-serving-section {
    padding: 15px;
  }

  .section-subtitle {
    font-size: 1.1rem;
  }

  .calculator-section {
    padding: 20px;
  }
}
