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

/* Sections take full screen */
main section {
  display: none;
  position: relative; /* needed for overlay */
}
main section.active {
  display: block;
}
main section::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%; /* full section overlay */
  background: rgba(0,0,0,0.5);
  z-index: -1;
}

/* Home */
#home {
  background-image: url('images/home-bg.jpg'); 
  background-size: cover;
  background-position: center;
}

nav {
  text-align: center;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.95);
  padding: 15px 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}
nav button {
  padding: 12px 24px;
  margin: 5px 8px;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  cursor: pointer;
  border-radius: 25px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}
nav button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
}
nav button.active {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  box-shadow: 0 4px 20px rgba(245, 87, 108, 0.4);
}
main section {
  max-width: 800px;
  margin: 30px auto;
  padding: 40px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 25px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 0;
  transform: translateY(20px);
  backdrop-filter: blur(10px);
}
main section.active {
  opacity: 1;
  transform: translateY(0);
}

/* Breathing Section */
#breathing {
  text-align: center;
  padding: 40px 20px;
}
#circle {
  width: 150px;
  height: 150px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  margin: 40px auto;
  transition: transform 1s ease;
  box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
  position: relative;
}
#circle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}
#breath-text {
  font-size: 24px;
  font-weight: 600;
  color: #2a5b84;
  margin: 20px 0;
}

/* Form elements */
#journal-entry, #chat-input, #message, #email, #name {
  width: 100%;
  padding: 15px;
  margin: 15px 0;
  border: 2px solid #e0e7ff;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #ffffff 0%, #f5f7fa 100%);
}
#journal-entry:focus, #chat-input:focus, #message:focus, #email:focus, #name:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
  background: #ffffff;
}

/* Loading animation */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.loading::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}
button {
  padding: 12px 28px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}
button:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  transform: translateY(-3px);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}
button:active {
  transform: translateY(-1px);
}
button:disabled {
  background: linear-gradient(135deg, #a3bffa 0%, #c3cfe2 100%);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
#chat-window {
  height: 200px;
  overflow-y: auto;
  border: 1px solid #ddd;
  padding: 10px;
  margin-bottom: 10px;
  background-color: #f9f9f9;
}

/* Headings & text */
h1 {
  text-align: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 3em;
  margin: 30px 0;
  font-weight: 800;
  text-shadow: 0 2px 10px rgba(102, 126, 234, 0.1);
}
h2 {
  text-align: center;
  color: #2a5b84;
  font-size: 2em;
  margin: 20px 0;
  font-weight: 700;
}
h3 {
  color: #2a5b84;
  font-size: 1.5em;
  margin: 20px 0;
  font-weight: 600;
}
p {
  line-height: 1.8;
  margin: 15px 0;
}

/* Home Page Layout */
.home-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 25px;
  margin-top: 30px;
  flex-wrap: wrap;
}
.home-box {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 280px;
  background: linear-gradient(135deg, #ffffff 0%, #f5f7fa 100%);
  padding: 25px;
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
}
.home-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}
.home-img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 15px;
  margin-right: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.home-text h3 {
  color: #2a5b84;
  margin: 0 0 10px;
  font-weight: 700;
}
.home-text p {
  margin: 0;
  font-size: 15px;
  color: #555;
  line-height: 1.6;
}

/* About Section */
.about-content {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.about-img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 15px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.about-text {
  flex: 1;
  font-size: 15px;
  color: #444;
  line-height: 1.6;
}

/* Journal Section */
#journal {
  max-width: 800px;
  margin: 30px auto;
  padding: 30px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}
#journal h2 {
  text-align: center;
  color: #155f9c;
  margin-bottom: 15px;
}
.journal-intro {
  text-align: center;
  color: #555;
  margin-bottom: 20px;
  font-size: 15px;
}
.journal-motivation {
  text-align: center;
  font-weight: bold;
  color: #333;
  margin-bottom: 20px;
  font-size: 17px;
  transition: opacity 0.5s ease-in-out;
  padding: 15px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 10px;
}
.journal-toggle {
  cursor: pointer;
  text-align: center;
  margin-top: 25px;
  color: #2c7a7b;
  font-size: 18px;
  font-weight: bold;
  transition: all 0.3s ease;
}
.journal-toggle:hover {
  color: #667eea;
  transform: scale(1.05);
}
#journal-list {
  margin-top: 20px;
  padding: 15px;
  background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
  border-radius: 12px;
}
.journal-entry {
  background: linear-gradient(135deg, #ffffff 0%, #f7f9fc 100%);
  padding: 25px;
  border-radius: 15px;
  margin-bottom: 20px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.08);
  border-left: 5px solid #667eea;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: slideIn 0.3s ease;
}
.journal-entry:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.journal-entry p {
  margin: 10px 0;
  font-size: 15px;
}
.journal-entry strong {
  color: #667eea;
  font-size: 14px;
  display: block;
  margin-bottom: 10px;
}
.journal-buttons {
  margin-top: 15px;
  display: flex;
  justify-content: space-between;
}
#journal button {
  padding: 10px 20px;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: 0.3s;
}
#journal button:hover {
  opacity: 0.85;
}
.clear-btn {
  background: linear-gradient(135deg, #ff9800 0%, #ff6b00 100%);
  color: white;
}
.clear-btn:hover {
  background: linear-gradient(135deg, #ff6b00 0%, #ff9800 100%);
}
.edit-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  margin-right: 8px;
}
.edit-btn:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}
.delete-btn {
  background: linear-gradient(135deg, #ff4d4d 0%, #cc0000 100%);
  color: white;
}
.delete-btn:hover {
  background: linear-gradient(135deg, #cc0000 0%, #ff4d4d 100%);
}
.journal-subtitle {
  margin-top: 20px;
  color: #2a5b84;
  border-bottom: 2px solid #e0e7ff;
  padding-bottom: 5px;
}

/* Mood Section */
#mood {
  text-align: center;
  padding: 20px;
}

/* Mood Statistics Dashboard */
.mood-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 30px 0;
}
.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 25px;
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
  color: white;
  animation: fadeInUp 0.5s ease;
}
.stat-card:hover {
  transform: translateY(-10px) scale(1.05);
  box-shadow: 0 12px 30px rgba(102, 126, 234, 0.5);
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.stat-icon {
  font-size: 40px;
  margin-bottom: 10px;
}
.stat-label {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.stat-value {
  font-size: 32px;
  font-weight: 800;
  margin-top: 10px;
}

.mood-buttons {
  margin: 30px 0;
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}
.mood-buttons button {
  border: none;
  padding: 20px 40px;
  margin: 0;
  border-radius: 20px;
  font-size: 20px;
  cursor: pointer;
  color: white;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  font-weight: 600;
  position: relative;
  overflow: hidden;
}
.mood-buttons button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}
.mood-buttons button:hover::before {
  width: 300px;
  height: 300px;
}
.mood-buttons button:hover {
  transform: scale(1.15) rotate(-2deg);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.mood-buttons button:active {
  transform: scale(1.05);
}
.mood-buttons button[onclick*="Happy"] {
  background: linear-gradient(135deg, #FFD93D 0%, #FFA500 100%);
  color: #333;
}
.mood-buttons button[onclick*="Calm"] {
  background: linear-gradient(135deg, #6BCB77 0%, #4D908E 100%);
}
.mood-buttons button[onclick*="Sad"] {
  background: linear-gradient(135deg, #4D96FF 0%, #6C5CE7 100%);
}
#mood-log {
  font-weight: bold;
  margin-top: 25px;
  font-size: 22px;
  transition: all 0.3s ease;
  padding: 20px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
#mood-quote {
  font-style: italic;
  margin-top: 15px;
  color: #555;
  transition: opacity 0.3s ease;
  font-size: 18px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  border-left: 4px solid #667eea;
}
#mood-history {
  list-style: none;
  padding: 0;
  margin-top: 20px;
  max-height: 400px;
  overflow-y: auto;
}
#mood-history li {
  margin: 10px 0;
  padding: 15px 20px;
  border-radius: 12px;
  font-size: 16px;
  color: white;
  animation: slideInRight 0.4s ease;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}
#mood-history li:hover {
  transform: translateX(5px);
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
#mood-history li.happy { 
  background: linear-gradient(135deg, #FFD93D 0%, #FFA500 100%);
  color: #333; 
}
#mood-history li.calm { 
  background: linear-gradient(135deg, #6BCB77 0%, #4D908E 100%);
}
#mood-history li.sad { 
  background: linear-gradient(135deg, #4D96FF 0%, #6C5CE7 100%);
}

/* Mood Charts (inline-block left-right) */
.charts {
  text-align: center;
  margin-top: 30px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  padding: 20px 0;
}
.charts canvas {
  width: 100% !important;
  height: auto !important;
  max-width: 500px;
  margin: 0 auto;
  background: linear-gradient(135deg, #ffffff 0%, #f5f7fa 100%);
  padding: 20px;
  border-radius: 20px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
}
.charts canvas:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 35px rgba(0,0,0,0.2);
}

/* Quotes Section */
#quotes {
  text-align: center;
  padding: 40px 20px;
}
.quote-container {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 40px;
  border-radius: 20px;
  margin: 30px 0;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
  position: relative;
  overflow: hidden;
}
.quote-container::before {
  content: '"';
  position: absolute;
  top: -20px;
  left: 20px;
  font-size: 120px;
  color: rgba(255, 255, 255, 0.1);
  font-family: Georgia, serif;
}
.quote-container p {
  color: white;
  font-size: 24px;
  font-style: italic;
  line-height: 1.6;
  margin: 0;
  position: relative;
  z-index: 1;
  font-weight: 500;
}

/* Mobile Optimization */
@media (max-width: 768px) {
  nav button {
    padding: 8px 12px;
    margin: 3px;
    font-size: 13px;
  }
  
  h1 {
    font-size: 2em;
    margin: 15px 0;
  }
  
  h2 {
    font-size: 1.6em;
    margin: 15px 0;
  }
  
  h3 {
    font-size: 1.3em;
  }
  
  main section {
    max-width: 100%;
    margin: 15px;
    padding: 25px;
  }
  
  .home-content {
    flex-direction: column;
    gap: 15px;
  }
  
  .home-box {
    min-width: 100%;
    padding: 15px;
  }
  
  .home-img {
    width: 100px;
    height: 100px;
    margin-right: 12px;
  }
  
  .about-content {
    flex-direction: column;
  }
  
  .about-img {
    width: 100%;
    max-width: 300px;
    height: auto;
  }
  
  #journal {
    max-width: 100%;
    margin: 15px;
    padding: 20px;
  }
  
  .charts {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .charts canvas {
    display: block;
    width: 100% !important;
    max-width: 100%;
    margin: 10px auto;
  }
  
  .mood-stats {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .mood-buttons {
    gap: 15px;
  }
  
  .mood-buttons button {
    padding: 15px 30px;
    font-size: 18px;
  }
  
  .quote-container {
    padding: 30px 20px;
  }
  
  .quote-container p {
    font-size: 20px;
  }
  
  #journal-entry, #chat-input, #message, #email, #name {
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  button {
    padding: 12px 20px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  nav {
    margin-bottom: 15px;
  }
  
  nav button {
    padding: 6px 10px;
    margin: 2px;
    font-size: 12px;
  }
  
  h1 {
    font-size: 1.8em;
  }
  
  h2 {
    font-size: 1.4em;
  }
  
  main section {
    margin: 10px;
    padding: 15px;
  }
  
  .home-img {
    width: 80px;
    height: 80px;
  }
  
  .home-text h3 {
    font-size: 1.1em;
  }
  
  .home-text p {
    font-size: 13px;
  }
}
