:root {
  /* Updated colors for dark mode */
  --primary-color: #5a8c66;
  --primary-light: #72b480;
  --primary-dark: #2e4d36;
  --secondary-color: #3da8ff;
  --secondary-dark: #1e88e5;
  --text-dark: #e0e0e0;
  --text-light: #f0fdf4;
  --background-light: #333333;
  --background-gradient: linear-gradient(to top, #2d4a2d, #333333);
  --shadow-color: rgba(0, 0, 0, 0.3);
  --shadow-elevation: 0 4px 6px var(--shadow-color);
  --border-radius: 12px;
  --transition: all 0.3s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, 
               Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background-image: url("https://www.moodaimusic.com/bg_image_1.png");
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  padding: 1rem;
  line-height: 1.5;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  font-weight: bold;
  transition: var(--transition);
}

p {
  color: var(--primary-light);
  font-family: "Boldonse", system-ui;
  font-weight: 100;
  font-size: 14px;
  margin-bottom: 0.5rem;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.mood, .music {
  color: var(--primary-color); 
}

.ai {
  color: black; 
}

#moodaimusic_title {
  font-family: "Boldonse", system-ui;
  font-weight: 400;
  font-style: normal;
  padding: 2rem;
  text-align: center;
  font-size: clamp(2rem, 5vw, 3rem);
}

.container {
  background: var(--background-gradient);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-elevation);
  width: 100%;
  max-width: min(400px, 90vw);
  margin: 1rem auto;
}

.inner_container {
    display: flex;
}

button {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  background-color: var(--primary-light);
  color: white;
  border-radius: 0.5rem;
  width: 100%;
  margin: 0.5rem 0;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-elevation);
  transition: var(--transition);
  font-weight: 600;
}

button:hover,
button:active,
button:focus {
  background-color: var(--primary-dark);
  transform: scale(0.98);
}

button:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
  transform: none;
}

.auth-container {
  margin-bottom: 1.25rem;
}

.status-message {
  margin: 1rem 0;
  font-size: 1rem;
}

.profile-pic {
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  margin-bottom: 0.625rem;
  display: none;
  object-fit: cover;
}

#createAccount {
  background-color: var(--secondary-color);
}

#createAccount:hover,
#createAccount:active {
  background-color: var(--secondary-dark);
}

#loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 1rem;
}

.modal-content {
  border-radius: var(--border-radius);
  padding: 1.25rem;
  width: 100%;
  max-width: 22rem;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  background: linear-gradient(to top, #2d4a2d, #333333);
  color: #f5f5f5;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.modal-title {
  font-family: "Boldonse", system-ui;
  font-weight: 100;
  font-size: 14px;
}

.close-btn {
  cursor: pointer;
  font-size: 1.5rem;
  color: #777;
  background: none;
  border: none;
  padding: 0;
  width: auto;
  margin: 0;
  transition: var(--transition);
}

.close-btn:hover {
  color: var(--primary-dark);
}

.form-group {
  margin-bottom: 1rem;
  text-align: left;
  color: white;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: var(--transition);
}

.form-group input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(114, 180, 128, 0.2);
  outline: none;
}

.submit-btn {
  background-color: var(--primary-light);
  margin-top: 0.625rem;
}

#send_email {
  width: 100%;
}

#moodDropdownContainer, #typeDropdownContainer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

#moodSelect, #typeSelect {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--primary-light);
  border-radius: var(--border-radius);
  background-color: #e9f5ec;
  font-size: 1rem;
  color: #444;
  transition: var(--transition);
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23417049%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem top 50%;
  background-size: 0.65rem auto;
}

#moodSelect:hover, #typeSelect:hover {
  border-color: var(--primary-light);
  background-color: #dbf0dc;
}

#moodSelect:focus, #typeSelect:focus {
  outline: none;
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 3px rgba(114, 180, 128, 0.4);
}

#moodSelect option, #typeSelect option {
  background-color: #f0fdf4;
  color: #444;
  padding: 0.625rem;
}

#moodSelect option:checked, #typeSelect option:checked {
  background-color: var(--primary-color);
  color: #444;
}

label[for="moodSelect"], label[for="typeSelect"] {
  color: var(--primary-light);
  margin-bottom: 0.5rem;
  font-family: "Boldonse", system-ui;
  font-weight: 100;
  font-size: 14px;
}

.status-message {
  font-size: 1.5rem;
  font-weight: bold;
  color: #666866;
  text-align: center;
  margin-top: 2.5rem;
  animation: heartbeat 1.5s infinite;
  transform-origin: center;
}

#total_tokens {
  font-family: "Boldonse", system-ui;
  font-weight: 100;
  font-size: 14px;
  color: white;
}

.footer {
  font-family: "Boldonse", system-ui;
  font-weight: 100;
  font-size: 14px;
  color: white;
}

@keyframes heartbeat {
  0% {
    transform: scale(1);
  }
  10% {
    transform: scale(1.3);
  }
  20% {
    transform: scale(1);
  }
  32% {
    transform: scale(1.3);
  }
  60% {
    transform: scale(1);
  }
}

/* Target only the menu_bar container */
.menu_bar {
  display: flex;
  width: 100%;
  align-items: flex-end; /* Align items to bottom */
  gap: 0.25rem; /* Small gap between buttons */
}

/* Target only menu_btn class without affecting other buttons */
.menu_bar .menu_btn {
  flex: 1 1 0; /* Equal width distribution */
  height: 44px; /* Fixed height */
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #666866;
  margin-bottom: 0; /* Remove bottom margin */
  padding: 0.5rem;
  font-size: 0.875rem;
}

.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.125rem 0.3125rem;
  background-color: #666866;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 0.25rem;
  transition: var(--transition);
  box-shadow: var(--shadow-elevation);
  height: 40px;
  margin-top: 6px;
  width: 50px;
}

.arrow {
  font-size: 1.25rem;
  margin-right: 0.0625rem;
}

.back-button:hover {
  background-color: var(--primary-dark);
  transform: translateY(-0.1875rem);
  box-shadow: 0 0.375rem 0.625rem rgba(0, 0, 0, 0.2);
}

.back-button:active {
  transform: translateY(0);
}

button.acc_update {
  width: 100%;
}

#accLogout {
  margin-left: 65%;
}

/* Enhanced Audio Player with Download Button */
audio {
  background-color: #444;
  width: 100%;
}

audio::-webkit-media-controls-enclosure,
audio::-webkit-media-controls-panel {
  background-color: #444;
}

audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display {
  color: #f5f5f5;
}

audio::-webkit-media-controls-timeline,
audio::-webkit-media-controls-volume-slider {
  background-color: #444;
}

audio::-webkit-media-controls-play-button,
audio::-webkit-media-controls-mute-button,
audio::-webkit-media-controls-download-button {
  background-color: var(--primary-dark);
}

.danger-zone {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #ff4d4d;
    border-radius: 5px;
    background-color: rgba(255, 77, 77, 0.1);
}

.danger-zone h3 {
    color: #ff4d4d;
    margin-top: 0;
    margin-bottom: 10px;
}

.delete-account-btn {
    background-color: #ff4d4d;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
    font-weight: bold;
}

.delete-account-btn:hover {
    background-color: #ff3333;
}

.message-container {
    text-align: center;
    padding: 20px;
}

.message-container h2 {
    color: #333;
    margin-bottom: 20px;
}

.error-message {
    background-color: #ffeeee;
    color: #cc0000;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #cc0000;
    margin-bottom: 15px;
}

/* Mobile App Experience - Enhanced Responsive Adjustments */
@media (max-width: 400px) {
  /* Base styles */
  * {
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
  }
  
  html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%; 
    -webkit-font-smoothing: antialiased;
  }
  
  body {
    padding: 0; /* Remove padding to use full screen width */
    overscroll-behavior: none; /* Prevent pull-to-refresh */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; /* System fonts */
    background-color: #f8f8f8;
  }
  
  /* Container */
  .container {
    padding: 1rem;
    margin: 0.5rem;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: min(400px, 90vw);
    -webkit-overflow-scrolling: touch; /* Enable momentum scrolling on iOS */
  }
  
  /* Title */
  #moodaimusic_title {
    padding: 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    margin: 0;
  }

  .menu_bar {
    flex-wrap: nowrap; /* Prevent wrapping */
  }
  
  .menu_bar .menu_btn {
    font-size: 0.75rem; /* Smaller font for mobile */
  }

  /* Buttons - Bigger for better touch targets */
  #emailSignIn, #createAccount, .submit-btn, #send_email {
    border: none;
    background-color: var(--primary-light);
    color: white;
    padding: 0.875rem 1.25rem; /* Increased padding */
    font-size: 1rem; /* Larger font size */
    font-weight: 500;
    border-radius: 10px; /* Slightly larger radius */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); /* Enhanced shadow */
    transition: background-color 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 30px; /* Minimum height for better touch target */
    min-width: 100px; /* Minimum width for better touch target */
    margin: 0.5rem 0; /* Add some margin between buttons */
    text-transform: uppercase; /* Optional: makes buttons look more app-like */
    letter-spacing: 0.5px; /* Optional: improves text readability */
  }

  #createAccount {
    background-color: var(--secondary-dark);
  }

  button:active {
    transform: scale(0.98);
    background-color: #3367d6;
  }
  
  /* Modal */
  .modal-content {
    padding: 1rem;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 400px;
    margin: 0 auto;
  }
  
  /* Audio player */
  audio {
    width: 100%;
    height: 36px;
    padding: 0; /* Remove padding */
    background-color: #444;
    border-radius: 18px;
    margin: 8px 0;
  }
  
  audio::-webkit-media-controls-enclosure {
    justify-content: center;
    border-radius: 18px;
  }
  
  audio::-webkit-media-controls-panel {
    background-color: #444;
    border-radius: 18px;
  }
  
  audio::-webkit-media-controls-download-button,
  audio::-webkit-media-controls-play-button,
  audio::-webkit-media-controls-mute-button {
    transform: scale(0.8);
    margin: 0 2px;
  }
  
  audio::-webkit-media-controls-timeline,
  audio::-webkit-media-controls-volume-slider {
    width: 100%;
    margin: 8px 0;
  }
  
  /* Form elements */
  input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 1rem;
    background-color: #f9f9f9;
  }
  
  input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
  }
  
  /* Vertical scrollable container */
  .vertical-scroll {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling for iOS */
    scrollbar-width: thin; /* For Firefox */
    padding-right: 8px; /* Space for the scrollbar */
    max-height: 400px; /* Adjust this value as needed to trigger scrolling */
  }
  
  /* Styling for the vertical scrollbar */
  .vertical-scroll::-webkit-scrollbar {
    width: 4px; /* Width of the scrollbar */
    display: block;
  }
  
  .vertical-scroll::-webkit-scrollbar-track {
    background: #f1f1f1; /* Track color */
    border-radius: 10px;
  }
  
  .vertical-scroll::-webkit-scrollbar-thumb {
    background: #888; /* Handle color - darker for better visibility */
    border-radius: 10px;
  }
  
  .vertical-scroll::-webkit-scrollbar-thumb:hover {
    background: #555; /* Handle color on hover */
  }
  
  /* App-like scrolling - keeping your existing class but enhancing it */
  .scroll-container {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: 100%;
    max-height: 400px; /* Add max-height to ensure scrolling triggers */
  }
  
  /* Style the scrollbar for scroll-container */
  .scroll-container::-webkit-scrollbar {
    width: 4px;
    display: block;
  }
  
  .scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
  }
  
  .scroll-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
  }
  
  .scroll-container::-webkit-scrollbar-thumb:hover {
    background: #555;
  }
  
  /* Horizontal scrollable container */
  .horizontal-scroll {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling for iOS */
    scrollbar-width: thin; /* For Firefox */
    padding-bottom: 8px; /* Space for the scrollbar */
  }
  
  /* Styling for the horizontal scrollbar */
  .horizontal-scroll::-webkit-scrollbar {
    height: 4px; /* Height of the scrollbar */
    display: block;
  }
  
  .horizontal-scroll::-webkit-scrollbar-track {
    background: #f1f1f1; /* Track color */
    border-radius: 10px;
  }
  
  .horizontal-scroll::-webkit-scrollbar-thumb {
    background: #c1c1c1; /* Handle color */
    border-radius: 10px;
  }
  
  .horizontal-scroll::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8; /* Handle color on hover */
  }
  
  /* Hide scrollbars but keep functionality */
  .hide-scrollbar::-webkit-scrollbar {
    display: none;
  }
  
  .hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  
  /* Status bar style */
  .status-bar {
    height: 24px;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    font-size: 0.75rem;
    color: #757575;
  }
}