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

:root {
  --color-primary: #6b9e8d; /* Muted Teal */
  --color-secondary: #d49d6b; /* Earthy Ochre */
  --color-text-dark: #333333; /* Charcoal */
  --color-background-light: #f8f8f8; /* Off-White */
  --color-footer-bg: #5a8d70; /* Slightly darker green for footer/header */
  --color-error: #e74c3c;
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Base Styles */
body {
  font-family: "Roboto", sans-serif;
  background-color: #f7f9fc;
  color: #333;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  padding-bottom: 0; /* Remove bottom padding */
}

/* Header */
/* header {
  width: 100%;
  background: linear-gradient(135deg, #007bff, #00aaff);
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  animation: fadeInDown 1s ease-out;
} */

header {
  /* position: sticky; */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9999; /* Ensures header stays above other elements */
  /* background: linear-gradient(135deg, #5d3f80, #845faf); */
  background-color: var(--color-footer-bg);
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  animation: fadeInDown 1s ease-out;
}

header h2 {
  font-size: 1.8rem;
  letter-spacing: 0.5px;
}

header nav a {
  color: #fff;
  text-decoration: none;
  margin-left: 20px;
  padding: 8px 12px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.3s ease;
}

header nav a:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Main Container */
main {
  max-width: 1000px; /* Increased from 800px */
  width: 95%;
  background: #fff;
  padding: 40px;
  border-radius: 8px;
  margin: 100px auto 100px auto; /* Added margin-bottom to prevent footer overlap */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  animation: fadeIn 1s ease-out;
  min-height: calc(
    100vh - 200px
  ); /* Ensures minimum height considering header/footer */
  overflow-y: auto; /* Adds scroll if content exceeds height */
}

/* Headings */
h2,
h3 {
  margin-bottom: 20px;
  text-align: center;
}

/* Sentence Display */
.sentence {
  font-size: clamp(1.5rem, 4vw, 2.2rem); /* Responsive font size */
  text-align: center;
  color: #d84865;
  margin: 20px auto;
  position: relative;
  animation: pulse 2s infinite;
  max-width: 90%;
  word-wrap: break-word;
  line-height: 1.3;
  min-height: 80px; /* Ensures consistent height */
  display: flex;
  align-items: center;
  justify-content: center;
}

#sentenceSection {
  margin-bottom: 30px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
  main {
    width: 100%;
    padding: 20px;
    margin: 80px auto 80px auto;
  }

  .sentence {
    font-size: clamp(1.2rem, 3.5vw, 1.8rem);
    min-height: 60px;
  }

  #sentenceSection {
    padding: 15px;
    margin-bottom: 20px;
  }
}

@media (max-width: 480px) {
  main {
    margin: 70px auto 70px auto;
    padding: 15px;
  }

  .sentence {
    font-size: clamp(1rem, 3vw, 1.5rem);
    min-height: 50px;
  }
}

/* Form Elements */
#translationForm input[type="text"] {
  width: 100%;
  padding: 14px;
  margin: 10px 0 20px;
  border: 1px solid #ccc;
  border-radius: 4px;
  transition: border-color 0.3s ease;
  font-size: 1rem;
}

#translationForm input[type="text"]:focus {
  border-color: #007bff;
  outline: none;
}

/* Buttons */
button {
  background: #007bff;
  border: none;
  color: #fff;
  padding: 12px 20px;
  margin: 10px 0;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease;
  font-size: 1rem;
}

button:hover {
  background: #0056b3;
  transform: translateY(-3px);
}

button:active {
  transform: translateY(0);
}

/* Audio Recorder Section */
#audioRecorder {
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#audioRecorder button {
  margin: 5px;
  padding: 10px 16px;
  font-size: 0.9rem;
}

audio {
  margin-top: 10px;
  width: 100%;
  max-width: 400px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Previous Translations List */
ol {
  list-style-type: decimal;
  margin-left: 20px;
}

ol li {
  margin: 15px 0;
  padding: 10px;
  border-left: 4px solid #007bff;
  background: #f7f9fc;
  border-radius: 4px;
  transition: transform 0.3s ease;
}

ol li:hover {
  transform: scale(1.02);
}

.loading-spinner {
  margin-right: 8px;
  animation: fa-spin 2s infinite linear;
}

#englishSentence[data-loading] {
  color: #666;
  min-height: 24px;
}

@keyframes fa-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(359deg);
  }
}

.section.loading {
  opacity: 0.6;
  pointer-events: none;
}

#nextSentence {
  background-color: #5a8d70;
  border-radius: 50px;
}

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

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* @keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
} */

.signup-link {
  margin-top: 20px;
  text-align: center;
  font-size: 0.9rem;
}
.signup-link a {
  color: #007bff;
  text-decoration: none;
  font-weight: bold;
}

.signup-link a:hover {
  text-decoration: underline;
}

.login-container h2 {
  margin-bottom: 20px;
  color: #007bff;
}
.login-container {
  max-width: 500px; /* Increased from 400px */
  width: 95%;
  margin: 120px auto;
  padding: 30px 40px;
  background: linear-gradient(to bottom, #ffffff, #f8f9fa);
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  text-align: center;
  animation: fadeIn 1s ease-out;
}
.login-container h2 {
  margin-bottom: 20px;
  color: #6c5ce7;
}
.input-container {
  position: relative;
  width: 100%;
  margin: 10px 0;
}
.input-container input {
  width: 100%;
  padding: 12px 40px 12px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}
.input-container input:focus {
  border-color: #6c5ce7;
  outline: none;
}
.input-container .eye-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: #5a8d70;
}
form button {
  background: #5a8d70; /* Changed from blue to purple */
  border: none;
  color: #fff;
  padding: 14px 24px;
  margin-top: 15px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s ease;
}
form button:hover {
  background: #5849c4;
  transform: translateY(-2px);
}
.login-container p.error {
  color: red;
  margin-top: 10px;
}
.login-container p {
  margin-top: 15px;
  font-size: 0.9rem;
}

/* Add footer styles */
/* footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(135deg, #5d3f80, #845faf);
  padding: 20px 0;
  color: #fff;
  text-align: center;
  box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
} */

/* footer {
  position: relative;
  width: 100%;
  background: linear-gradient(135deg, #5d3f80, #845faf);
  padding: 20px 0;
  color: #fff;
  text-align: center;
  box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
  margin-top: auto; 
}

footer nav {
  display: flex;
  justify-content: center;
  gap: 30px;
}

footer a {
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 5px 10px;
  transition: all 0.3s ease;
}

footer a:hover {
  color: #dfe6e9;
  transform: translateY(-2px);
} */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.signup-container {
  max-width: 400px;
  width: 90%;
  margin: 120px auto;
  padding: 20px 30px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
  animation: fadeIn 1s ease-out;
}
.signup-container h2 {
  margin-bottom: 20px;
  color: #6c5ce7;
}

.signup-container p.error {
  color: red;
  margin-top: 10px;
}
.signup-container p {
  margin-top: 15px;
  font-size: 0.9rem;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Leaderboard Table Styles */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}
.leaderboard-table th,
.leaderboard-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #dddddd;
}
.leaderboard-table th {
  background-color: #5d3f80;
  color: white;
  font-weight: 600;
}
.leaderboard-table tr:nth-child(even) {
  background-color: #f8f9fa;
}
.translations-count {
  color: #3498db;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.3s;
}
.translations-count:hover {
  color: #2980b9;
}
/* Modal Styles (Unchanged) */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  padding-top: 1.5rem;
}

.modal-content {
  background-color: white;
  margin: 2rem auto;
  padding: 0 1.5rem 1.5rem;
  width: 80%;
  max-width: 600px;
  border-radius: 8px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10001; /* Ensures the modal header stays on top within the modal */
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #ddd;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.close-modal {
  cursor: pointer;
  font-size: 1.5rem;
  color: #666;
}

.translation-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}
/* Spinner Container */
#spinnerContainer {
  text-align: center;
  padding: 50px 0;
}
/* Responsive Styles */
@media screen and (max-width: 768px) {
  .leaderboard-table {
    font-size: 14px;
    box-shadow: none;
    border-radius: 0;
  }
  .leaderboard-table th,
  .leaderboard-table td {
    padding: 12px 8px;
  }
}
@media screen and (max-width: 480px) {
  .leaderboard-table {
    font-size: 13px;
  }
  .leaderboard-table th,
  .leaderboard-table td {
    padding: 10px 6px;
  }
}

.app-banner {
  position: absolute;
  top: 140px; /* Adjust to where you want it vertically */
  right: 40px; /* Controls how far from the right edge */
  transform: translate(0, 0); /* can tweak if needed */
  /* background: linear-gradient(145deg, #562081, #7048b7); */
  background-color: #d49d6b;
  color: white;
  text-align: center;
  padding: 16px 12px;
  font-size: 0.85rem;
  border-radius: 10px;
  /* border: 2px solid #325a43; */
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  width: 250px;
  z-index: 9999;
}

.app-banner i {
  font-size: 1rem;
  margin-bottom: 8px;
}

@keyframes breathing {
  0% {
    transform: scale(1);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.4);
  }
  50% {
    transform: scale(1.08);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.9);
  }
  100% {
    transform: scale(1);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.4);
  }
}

.app-banner a {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  display: inline-block;
  animation: breathing 2.5s ease-in-out infinite;
  transition: transform 0.3s ease;
}

.app-banner a:hover {
  text-decoration: none;
  transform: scale(1.15);
  color: #ffefef;
}

.theme-background {
  background-image: url("hill.png"); /* REPLACE with your actual image path */
  background-size: cover;
  background-position: center;
  background-attachment: fixed; /* For a fixed background effect */
  background-repeat: no-repeat;
}

/* --- FOOTER --- */
.theme-footer {
  position: relative;
  width: 100%;
  background-color: var(--color-footer-bg); /* Darker Green */
  padding: 20px 0;
  color: #fff;
  text-align: center;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
  margin-top: auto;
}
.theme-footer .footer-note {
  font-size: 0.75rem;
  margin: 10px auto 15px;
  max-width: 80%;
}
.theme-footer nav {
  display: flex;
  justify-content: center;
  gap: 20px;
}
.theme-footer a {
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 5px 10px;
  transition: color 0.3s ease;
}
.theme-footer a:hover {
  color: var(--color-secondary); /* Ochre hover */
}
