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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
  padding-top: 80px;
}

.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

/* Auth Screen */
.auth-container {
  background: rgba(255, 255, 255, 0.95);
  padding: 3rem;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  text-align: center;
  backdrop-filter: blur(10px);
  max-width: 400px;
  width: 90%;
}

.logo {
  margin-bottom: 2rem;
}

.logo i {
  font-size: 3rem;
  color: #667eea;
  margin-bottom: 1rem;
}

.logo h1 {
  color: #333;
  font-size: 2rem;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  padding: 1rem;
  border: 2px solid #e1e5e9;
  border-radius: 10px;
  font-size: 1rem;
  margin-bottom: 1rem;
  transition: border-color 0.3s ease;
}

.auth-form input:focus {
  outline: none;
  border-color: #667eea;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

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

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  background: #f8f9fa;
  color: #6c757d;
  border: 2px solid #e9ecef;
}

.btn-secondary:hover {
  background: #e9ecef;
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

/* Main Header */
.main-header {
  width: 100vw;
  position: fixed;
  top: 0;
  left: 0;
  height: 70px;
  background: rgba(255,255,255,0.98);
  box-shadow: 0 2px 20px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.site-title {
  font-size: 2rem;
  font-weight: 800;
  color: #667eea;
  letter-spacing: 1px;
}
.header-right {
  position: absolute;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.user-display {
  font-weight: 600;
  color: #333;
  font-size: 1rem;
}
.logout-btn-top {
  font-size: 0.9rem;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  min-width: unset;
  z-index: 10;
}
.header-motivation {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 0);
  font-size: 1.1rem;
  color: #764ba2;
  font-weight: 500;
  margin-top: 0.2rem;
  text-align: center;
  width: 100vw;
  pointer-events: none;
}

/* App Screen */
.app-header {
  background: rgba(255, 255, 255, 0.95);
  padding: 1rem 2rem 1rem 2rem;
  display: flex;
  align-items: flex-start;
  position: relative;
  min-height: 60px;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.logout-btn-top {
  position: absolute;
  top: 16px;
  right: 24px;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  min-width: unset;
  z-index: 10;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: #333;
}

.user-info i {
  font-size: 1.5rem;
  color: #667eea;
}

.app-main {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Dashboard */
.dashboard {
  display: grid;
  gap: 2rem;
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.95);
  padding: 2rem;
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
}

.stat-card i {
  font-size: 2.5rem;
  color: #667eea;
  margin-bottom: 1rem;
}

.stat-card h3 {
  color: #6c757d;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

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

/* Workout Section */
.workout-section {
  background: rgba(255, 255, 255, 0.95);
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  margin-bottom: 2rem;
}

.workout-section h2 {
  color: #333;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.workout-section h2 i {
  color: #667eea;
}

.workout-controls {
  display: grid;
  gap: 1.5rem;
}

.activity-selector {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.activity-selector select {
  padding: 1rem;
  border: 2px solid #e1e5e9;
  border-radius: 10px;
  font-size: 1rem;
  background: white;
  transition: border-color 0.3s ease;
}

.activity-selector select:focus {
  outline: none;
  border-color: #667eea;
}

.timer-display {
  text-align: center;
  padding: 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 15px;
  color: white;
}

.time-display {
  font-size: 3rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  margin-bottom: 1rem;
}

.current-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
}

.control-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* History Section */
.history-section {
  background: rgba(255, 255, 255, 0.95);
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.history-section h2 {
  color: #333;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-section h2 i {
  color: #667eea;
}

.history-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.history-list {
  max-height: 400px;
  overflow-y: auto;
}

.workout-item {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  border-left: 4px solid #667eea;
  transition: transform 0.2s ease;
}

.workout-item:hover {
  transform: translateX(5px);
}

.workout-item .workout-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.workout-item .activity {
  font-weight: 600;
  color: #667eea;
}

.workout-item .date {
  color: #6c757d;
  font-size: 0.9rem;
}

.workout-item .stats {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
  color: #495057;
}

/* Leaderboard Section */
.leaderboard-section {
  background: rgba(255,255,255,0.97);
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 6px 24px rgba(102,126,234,0.07);
  margin: 2rem auto 2rem auto;
  max-width: 600px;
}
.leaderboard-section h2 {
  color: #764ba2;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
}
.leaderboard-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.2rem;
}
.leaderboard-controls label {
  font-weight: 600;
  color: #333;
}
.leaderboard-controls select {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1.5px solid #e1e5e9;
  font-size: 1rem;
  background: #f8f9fa;
}
.leaderboard-list {
  margin-top: 1rem;
}
.leaderboard-entry {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  background: #f5f5fa;
  border-radius: 10px;
  padding: 0.8rem 1.2rem;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(102,126,234,0.04);
}
.leaderboard-entry.top1 {
  background: #ffe082;
  color: #764ba2;
  font-weight: 700;
}
.leaderboard-entry.top2 {
  background: #b2ebf2;
  color: #667eea;
  font-weight: 700;
}
.leaderboard-entry.top3 {
  background: #c8e6c9;
  color: #388e3c;
  font-weight: 700;
}
.leaderboard-rank {
  font-size: 1.3rem;
  width: 2.2rem;
  text-align: center;
}
.leaderboard-name {
  flex: 1;
  font-weight: 600;
}
.leaderboard-time {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  color: #333;
}

/* Nutrition Section */
.nutrition-section {
  background: rgba(255,255,255,0.97);
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 6px 24px rgba(102,126,234,0.07);
  margin: 2rem auto 2rem auto;
  max-width: 600px;
}
.nutrition-section h2 {
  color: #388e3c;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
}
.nutrition-controls {
  display: flex;
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}
.nutrition-controls input {
  flex: 1;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  border: 1.5px solid #e1e5e9;
  font-size: 1rem;
  background: #f8f9fa;
}
.nutrition-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.2rem;
  font-size: 1.1rem;
  color: #333;
}
.nutrition-log {
  margin-top: 1.2rem;
}
.nutrition-log h3 {
  color: #764ba2;
  margin-bottom: 0.7rem;
}
#nutrition-log-list {
  list-style: none;
  padding: 0;
}
#nutrition-log-list li {
  background: #f5f5fa;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(102,126,234,0.04);
}

/* Sleep Section */
.sleep-section {
  background: rgba(255,255,255,0.97);
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 6px 24px rgba(102,126,234,0.07);
  margin: 2rem auto 2rem auto;
  max-width: 600px;
}
.sleep-section h2 {
  color: #1976d2;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
}
.sleep-controls {
  display: flex;
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}
.sleep-controls input, .sleep-controls select {
  flex: 1;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  border: 1.5px solid #e1e5e9;
  font-size: 1rem;
  background: #f8f9fa;
}
.sleep-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.2rem;
  font-size: 1.1rem;
  color: #333;
}
.sleep-log {
  margin-top: 1.2rem;
}
.sleep-log h3 {
  color: #1976d2;
  margin-bottom: 0.7rem;
}
#sleep-log-list {
  list-style: none;
  padding: 0;
}
#sleep-log-list li {
  background: #f5f5fa;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(102,126,234,0.04);
}

/* Gender Toggle Group */
.gender-toggle-group {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1rem;
}
.gender-toggle-group label {
  font-weight: 600;
  color: #333;
}
.gender-btn {
  padding: 0.6rem 1.2rem;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  background: #f8f9fa;
  color: #667eea;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.gender-btn.selected, .gender-btn:focus {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-color: #764ba2;
}
.height-group {
  display: flex;
  gap: 2%;
  margin-bottom: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-header {
    padding: 1rem;
  }
  
  .app-main {
    padding: 1rem;
  }
  
  .stats-cards {
    grid-template-columns: 1fr;
  }
  
  .time-display {
    font-size: 2rem;
  }
  
  .current-stats {
    flex-direction: column;
    gap: 1rem;
  }
  
  .control-buttons {
    flex-direction: column;
  }
  
  .history-controls {
    flex-direction: column;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen {
  animation: fadeIn 0.5s ease-out;
}

/* Scrollbar Styling */
.history-list::-webkit-scrollbar {
  width: 8px;
}

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

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

.history-list::-webkit-scrollbar-thumb:hover {
  background: #5a6fd8;
}

/* Navigation Tabs */
.main-nav {
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255,255,255,0.97);
  box-shadow: 0 1px 8px rgba(0,0,0,0.04);
  position: fixed;
  top: 70px;
  left: 0;
  z-index: 99;
  height: 54px;
}
.nav-btn {
  background: none;
  border: none;
  outline: none;
  font-size: 1.1rem;
  font-weight: 600;
  color: #667eea;
  padding: 0.7rem 2.2rem;
  margin: 0 0.2rem;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: color 0.2s, border-bottom 0.2s;
  border-radius: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-btn.active, .nav-btn:focus {
  color: #764ba2;
  border-bottom: 3px solid #764ba2;
  background: rgba(118,75,162,0.07);
}
.nav-btn:hover {
  color: #4b3c7a;
}

/* Adjust content for header and nav height */
#app-screen, #auth-screen {
  margin-top: 124px;
}
@media (max-width: 768px) {
  .main-header { height: 60px; }
  .main-nav { top: 60px; height: 48px; }
  #app-screen, #auth-screen { margin-top: 108px; }
  .site-title { font-size: 1.3rem; }
}
  
/* Barcode Scanner */
.barcode-scanner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scanner-container {
  background: white;
  border-radius: 15px;
  padding: 2rem;
  text-align: center;
  max-width: 500px;
  width: 90%;
}
.viewport {
  width: 100%;
  height: 300px;
  border: 2px solid #667eea;
  border-radius: 10px;
  margin-bottom: 1rem;
  overflow: hidden;
}

/* Nutrition Charts */
.nutrition-charts {
  margin: 2rem 0;
  background: rgba(255,255,255,0.95);
  border-radius: 15px;
  padding: 1.5rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Workout Charts */
.workout-charts {
  margin: 2rem 0;
  background: rgba(255,255,255,0.95);
  border-radius: 15px;
  padding: 1.5rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Share Buttons */
.share-btn {
  margin-left: auto;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.share-btn:hover {
  opacity: 1;
}

.motivational-login {
  margin-top: 2rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}
.motivational-login p {
  color: white;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  line-height: 1.4;
}
  
