/* ------ General Styles ------ */
:root {
    --primary-color: #4caf50;
    --primary-dark: #388e3c;
    --primary-light: #a5d6a7;
    --secondary-color: #ff9800;
    --text-color: #333;
    --text-light: #666;
    --background-color: #f9f9f9;
    --card-background: #fff;
    --border-color: #e0e0e0;
    --success-color: #2e7d32;
    --warning-color: #f57c00;
    --danger-color: #c62828;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --border-radius: 8px;
  }
  
  /* Dark Mode Variables */
  .dark-mode {
    --primary-color: #66bb6a;
    --primary-dark: #43a047;
    --primary-light: #81c784;
    --text-color: #e0e0e0;
    --text-light: #bdbdbd;
    --background-color: #121212;
    --card-background: #1e1e1e;
    --border-color: #333;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  }
  
  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    transition: var(--transition);
  }
  
  .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
  }
  
  h1, h2, h3, h4 {
    margin-bottom: 15px;
    font-weight: 600;
  }
  
  a {
    color: var(--primary-color);
    text-decoration: none;
  }
  
  a:hover {
    text-decoration: underline;
  }
  
  button, .btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
  }
  
  button:hover, .btn:hover {
    background-color: var(--primary-dark);
  }
  
  .hidden {
    display: none !important;
  }
  
  /* ------ Header Styles ------ */
  header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
  }
  
  header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  header h1 {
    margin: 0;
    font-size: 1.8rem;
  }
  
  .dark-mode-toggle {
    background: transparent;
    color: white;
    font-size: 1.2rem;
    padding: 5px;
  }
  
  /* ------ Main Content Styles ------ */
  main {
    padding: 20px 0;
    min-height: calc(100vh - 140px);
  }
  
  /* Tab Navigation */
  .tabs {
    display: flex;
    overflow-x: auto;
    margin-bottom: 20px;
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
  }
  
  .tab-btn {
    padding: 15px 20px;
    font-size: 1rem;
    background-color: transparent;
    color: var(--text-color);
    border: none;
    border-bottom: 3px solid transparent;
    flex: 1;
    min-width: 120px;
    text-align: center;
    transition: var(--transition);
  }
  
  .tab-btn:hover {
    background-color: var(--primary-light);
    color: var(--text-color);
  }
  
  .tab-btn.active {
    border-bottom: 3px solid var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
  }
  
  /* Tab Content */
  .tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
  }
  
  .tab-content.active {
    display: block;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  /* Card Styles */
  .card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
  }
  
  /* Form Styles */
  .form-group {
    margin-bottom: 15px;
  }
  
  label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
  }
  
  input, select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--card-background);
    color: var(--text-color);
    font-size: 1rem;
    transition: var(--transition);
  }
  
  input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
  }
  
  /* Results Box Styles */
  .results-box {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--background-color);
  }
  
  .alternatives h4, .tips-box h4 {
    color: var(--primary-color);
    margin-top: 10px;
  }
  
  /* Chart Container */
  .chart-container {
    margin-top: 20px;
    height: 250px;
    position: relative;
  }
  
  /* Scrollable List */
  .scrollable-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--background-color);
  }
  
  /* ------ Feature-Specific Styles ------ */
  
  /* Meal Calculator */
  #carbon-result {
    font-size: 1.2rem;
    font-weight: 600;
    padding: 10px;
    margin: 10px 0;
    border-radius: var(--border-radius);
    text-align: center;
  }
  
  #carbon-result.low {
    background-color: rgba(76, 175, 80, 0.2);
    color: var(--success-color);
  }
  
  #carbon-result.medium {
    background-color: rgba(255, 152, 0, 0.2);
    color: var(--warning-color);
  }
  
  #carbon-result.high {
    background-color: rgba(198, 40, 40, 0.2);
    color: var(--danger-color);
  }
  
  #alternatives-list li {
    margin: 8px 0;
    padding-left: 20px;
    position: relative;
  }
  
  #alternatives-list li:before {
    content: "↓";
    color: var(--success-color);
    position: absolute;
    left: 0;
  }
  
  /* Waste Tracker */
  .waste-logs {
    margin: 20px 0;
  }
  
  .waste-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
  }
  
  .waste-item:last-child {
    border-bottom: none;
  }
  
  .waste-date {
    color: var(--text-light);
    font-size: 0.9rem;
  }
  
  .tips-box {
    background-color: rgba(76, 175, 80, 0.1);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-top: 20px;
  }
  
  .tip {
    position: relative;
    padding-left: 25px;
  }
  
  .tip:before {
    content: "💡";
    position: absolute;
    left: 0;
  }
  
  /* Weekly Challenges */
  .user-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
  }
  
  .points-display {
    text-align: center;
    padding: 15px;
    flex: 1;
    min-width: 150px;
    background-color: rgba(76, 175, 80, 0.1);
    border-radius: var(--border-radius);
  }
  
  .points {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
  }
  
  .progress-container {
    flex: 2;
    min-width: 200px;
  }
  
  .progress-bar {
    height: 20px;
    background-color: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
  }
  
  .progress {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.5s ease;
  }
  
  .challenge-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
  }
  
  .challenge-card {
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
  }
  
  .challenge-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
  }
  
  .points-badge {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin: 10px 0;
  }
  
  .complete-btn {
    width: 100%;
    margin-top: 10px;
  }
  
  .leaderboard {
    margin-top: 30px;
  }
  
  .leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
  }
  
  .leaderboard-rank {
    font-weight: 700;
    width: 30px;
  }
  
  .leaderboard-name {
    flex: 1;
  }
  
  .leaderboard-points {
    font-weight: 700;
    color: var(--primary-color);
  }
  
  /* Grocery Scanner */
  #product-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
  }
  
  .product-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    width: 100%;
  }
  
  .product-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: var(--border-radius);
    margin-right: 15px;
  }
  
  .product-details {
    flex: 1;
  }
  
  .eco-score {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 50%;
    color: white;
    font-weight: 700;
    margin-left: 10px;
  }
  
  .eco-score.a, .eco-score.b {
    background-color: var(--success-color);
  }
  
  .eco-score.c {
    background-color: var(--secondary-color);
  }
  
  .eco-score.d, .eco-score.e {
    background-color: var(--danger-color);
  }
  
  .product-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    width: 100%;
    margin-top: 15px;
  }
  
  .info-item {
    padding: 10px;
    background-color: var(--background-color);
    border-radius: var(--border-radius);
  }
  
  .barcode-examples {
    margin-top: 20px;
  }
  
  .barcode-examples ul {
    list-style: none;
  }
  
  .sample-barcode {
    background: none;
    color: var(--primary-color);
    padding: 5px;
    margin: 5px 0;
    text-decoration: underline;
    cursor: pointer;
  }
  
  .sample-barcode:hover {
    color: var(--primary-dark);
    background: none;
  }
  
  /* ------ Footer Styles ------ */
  footer {
    background-color: var(--primary-dark);
    color: white;
    padding: 20px 0;
    text-align: center;
  }
  
  footer a {
    color: white;
    text-decoration: underline;
  }
  
  /* ------ Responsive Styles ------ */
  @media screen and (max-width: 768px) {
    .tabs {
      flex-wrap: wrap;
    }
    
    .tab-btn {
      padding: 10px;
      font-size: 0.9rem;
    }
    
    .challenge-cards {
      grid-template-columns: 1fr;
    }
    
    .user-stats {
      flex-direction: column;
    }
    
    .product-header {
      flex-direction: column;
      text-align: center;
    }
    
    .product-image {
      margin-right: 0;
      margin-bottom: 10px;
    }
  }
  
  @media screen and (max-width: 480px) {
    header h1 {
      font-size: 1.5rem;
    }
    
    h2 {
      font-size: 1.3rem;
    }
    
    .card {
      padding: 15px;
    }
    
    .points {
      font-size: 2rem;
    }
  }