:root {
  --primary: #ff6f61;
  --primary-dark: #e65b50;
  --secondary: #4a90e2;
  --bg: #f9f9f9;
  --card-bg: #ffffff;
  --text: #2d2d2d;
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  --highlight: #ffd700;
}

[data-theme="dark"] {
  --primary: #ff8a80;
  --primary-dark: #ff6f61;
  --secondary: #64b5f6;
  --bg: #1a1a1a;
  --card-bg: #2c2c2c;
  --text: #ffffff;
}

body {
  font-family: 'Open Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  transition: all 0.3s ease;
  scroll-behavior: smooth; /* Add this line */
}


/*section and footer style*/
.intro {
  text-align: center;
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
  transition: transform 1.2s cubic-bezier(0.33, 1, 0.68, 1), opacity 1.2s cubic-bezier(0.33, 1, 0.68, 1); /* Ultra-smooth, luxurious easing */
}

.intro.hidden {
  transform: translateX(-100%) scale(0.95); /* Slide left with a subtle shrink */
  opacity: 0; /* Fade out */
  display: none; /* Remove from layout after animation */
}

.intro h2 {
  font-family: 'Merriweather', serif;
  color: #ff6f61;
  margin-bottom: 10px;
}

.intro p {
  font-family: 'Open Sans', sans-serif;
  color: #333;
}
footer {
    text-align: center;
    padding: 10px;
    background: #f4f4f4;
    color: #666;
    font-size: 0.9em;
}


header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 10px;
  color: white;
  box-shadow: var(--shadow);
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  height: 35px;
  border-radius: 50%;
}

h1 {
  font-family: 'Merriweather', serif;
  font-size: 1.5em;
  margin: 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.header-controls {
  display: flex;
  gap: 15px;
}

#theme-toggle, #theme-toggle-sticky, #word-of-day-btn, #word-of-day-btn-sticky, #bookmarks-btn, #bookmarks-btn-sticky, #search-btn, #back-to-top, .modal-buttons button {
  padding: 8px 15px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.3);
  color: white;
  border: none;
  cursor: pointer;
  transition: background 0.3s;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.9em;
}

#theme-toggle:hover, #theme-toggle-sticky:hover, #word-of-day-btn:hover, #word-of-day-btn-sticky:hover, #bookmarks-btn:hover, #bookmarks-btn-sticky:hover, #search-btn:hover, #back-to-top:hover, .modal-buttons button:hover {
  background: rgba(255, 255, 255, 0.5);
}

#word-of-day-btn, #word-of-day-btn-sticky, #bookmarks-btn, #bookmarks-btn-sticky {
  background: var(--highlight);
  color: var(--text);
}

#search-btn {
  background: var(--primary);
}

#back-to-top {
  background: var(--primary);
}

.modal-buttons button[type="submit"] {
  background: var(--secondary);
}

.modal-buttons button#cancel-feedback {
  background: #ccc;
}

.modal-buttons button#cancel-feedback:hover {
  background: #bbb;
}

.admin-link {
  color: white;
  text-decoration: none;
  font-weight: 600;
  padding: 8px 15px;
  border-radius: 20px;
  background: var(--secondary);
  transition: background 0.3s;
}

.admin-link:hover {
  background: var(--secondary-dark);
}

.popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
}

.popup-content {
  background: var(--card-bg);
  padding: 15px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-width: 300px;
  width: 90%;
  position: relative;
}

.popup-content h2 {
  color: var(--primary);
  font-family: 'Merriweather', serif;
  margin: 0 0 10px;
  font-size: 1.2em;
}

.close-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  transition: background 0.3s;
}

.close-btn:hover {
  background: var(--primary-dark);
}

.search-container {
  max-width: 1200px;
  margin: 30px auto;
  display: flex;
  align-items: center;
  gap: 15px;
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 10px 20px;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.sticky-logo {
  display: none;
  height: 35px;
  border-radius: 50%;
}

.search-wrapper {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
}

input[type="text"] {
  padding: 15px;
  font-size: 16px;
  border: none;
  border-radius: 25px;
  outline: none;
  background: var(--card-bg);
  flex: 1;
  box-shadow: var(--shadow);
  transition: all 0.3s;
}

input[type="text"]:focus {
  border: 2px solid var(--primary);
}

.sticky-controls {
  display: none;
  gap: 15px;
  align-items: center;
}

.suggestions {
  position: absolute;
  top: 100%;
  width: 70%;
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 250px;
  overflow-y: auto;
  z-index: 10;
}

.suggestions div {
  padding: 10px 15px;
  cursor: pointer;
  transition: background 0.2s;
}

.suggestions div:hover,
.suggestions div:focus {
  background: var(--highlight);
  outline: none;
}

.result-container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 20px;
}

#word-list-container .word-box {
  background: var(--card-bg);
  padding: 15px;
  margin: 15px 0;
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: flex;
  transition: transform 0.2s;
}

#word-list-container .word-box:hover {
  transform: translateY(-5px);
}


/* Existing .word-box style (around line 210) */
#word-list-container .word-box {
  background: var(--card-bg);
  padding: 15px;
  margin: 15px 0;
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: flex;
  transition: transform 0.2s;
}

/* Add new distinct style for search/bookmark results */
.distinct-word-box {
  background: #80008014; /* Light blue for distinction */
  padding: 15px;
  margin: 15px 0;
  border-radius: 10px;
  border-style: groove;
  box-shadow: var(--shadow);
  display: flex;
  transition: transform 0.2s;
}

/* Dark mode adjustment */
[data-theme="dark"] .distinct-word-box {
  background: #2a4d69; /* Darker blue for dark mode */
}

.word-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.word-content h3 {
  margin: 0;
  font-family: 'Merriweather', serif;
  color: #000000;
  font-size: 1.5em;
  font-weight: 700;
}

.word-content > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.word-image {
  width: 200px; /* Resizable base width */
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-left: 15px;
  resize: both;
  overflow: auto;
  max-width: 150px; /* Limit max size */
  max-height: 100px;
}

.audio-btn {
  background: var(--secondary);
  color: white;
  border: none;
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.3s;
  width: 32px;
  height: 32px;
}

.audio-btn:hover {
  background: var(--secondary-dark);
}

.audio-btn.playing::after {
  content: "🎵";
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.tabs {
  display: flex;
  gap: 10px;
}

.tab-btn {
  padding: 6px 12px;
  background: #e0e0e0;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  transition: background 0.3s;
  font-size: 0.9em;
}

.tab-btn.active {
  background: var(--secondary);
  color: white;
}

.tab-btn:focus {
  outline: 2px solid var(--primary);
}

.tab-content {
  display: none;
  padding: 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.03);
  font-size: 0.9em;
}

.tab-content.active {
  display: flex;
  align-items: center;
  gap: 10px;
}

.related-words {
  margin-top: 10px;
}

.related-words span {
  background: var(--secondary);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  margin-right: 8px;
  cursor: pointer;
  transition: background 0.3s;
  font-size: 0.9em;
}

.related-words span:hover {
  background: var(--secondary-dark);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Existing .actions button styles */
/* Existing .actions button styles */
.actions button {
  padding: 8px 12px;
  background: var(--secondary); /* Default color, e.g., #4a90e2 */
  border: none;
  border-radius: 15px;
  cursor: pointer;
  transition: background 0.3s;
  font-size: 0.9em;
}

.actions button:hover {
  background: var(--secondary-dark);
}

/* New class for bookmarked state */
.actions button.bookmarked {
  background: var(--primary); /* e.g., #ff6f61 */
}

.actions button.bookmarked:hover {
  background: var(--primary-dark); /* e.g., #e65b50 */
}
.loading {
  display: none;
  text-align: center;
  color: var(--primary);
  font-size: 1.2em;
  font-weight: 600;
}

.loading.active {
  display: block;
}

.back-to-top {
  position: fixed;
  bottom: 20px;
  left: 20px;
  box-shadow: var(--shadow);
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 15px;
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow);
}

.modal-content h2 {
  margin-top: 0;
  color: var(--primary);
}

.modal-content input,
.modal-content textarea {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid #ddd;
  border-radius: 5px;
  box-sizing: border-box;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

#bookmarks-content span {
  display: block;
/*  padding: 8px 12px;*/
  cursor: pointer;
  transition: background 0.3s;
 /* border-bottom: 1px solid rgba(0, 0, 0, 0.1);*/
}

#bookmarks-content span:hover {
  background: var(--highlight);
}

.toast {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--secondary);
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  box-shadow: var(--shadow);
  z-index: 1000;
}

.toast.show {
  display: block;
  animation: fadeInOut 3s forwards;
}

@keyframes fadeInOut {
  0% { opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { opacity: 0; }
}

@media (max-width: 600px) {
  .search-container {
    flex-direction: row;
    padding: 10px;
  }
//hide the word of day,bookmark and theme word 
  @media (max-width: 600px) {
    .top-word{
      display: none;
    }

  }
  .search-wrapper {
    flex: 1;
    position: relative;
  }
  #search-btn {
    padding: 8px;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 50%;
    width: 32px;
    height: 32px;
  }
  #word-list-container .word-box {
    flex-direction: column;
  }
  .word-image {
    margin-left: 0;
    margin-top: 10px;
    width: 100px;
    max-width: 100px;
  }
  .actions {
    flex-direction: row;
    gap: 5px;
  }
  .actions button {
    padding: 6px 10px;
    font-size: 0.8em;
  }
  .audio-btn {
    width: 28px;
    height: 28px;
  }
  #word-of-day-btn span:not(:first-child), #bookmarks-btn span:not(:first-child),
  #word-of-day-btn-sticky span:not(:first-child), #bookmarks-btn-sticky span:not(:first-child),
  #theme-toggle span:not(:first-child), #theme-toggle-sticky span:not(:first-child),
  #search-btn span:not(:first-child), #back-to-top span:not(:first-child),
  .modal-buttons button span:not(:first-child) {
    display: none;
  }
}

@media (min-width: 601px) {
  .scrolled .sticky-logo,
  .scrolled .sticky-controls {
    display: inline-flex;
  }
  .scrolled #main-header {
    display: none;
  }
}

button[title]:hover::after {
  content: attr(title);
  position: absolute;
  background: var(--primary);
  color: white;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  z-index: 100;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
}
/* Existing styles remain unchanged until the relevant sections */

/* Bookmark Popup Improvements */
#bookmarks-list {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
}

#bookmarks-content {
  background: var(--card-bg);
  padding: 1px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-width: 300px;
  width: 90%;
  position: relative;
  max-height: 400px; /* Limit height for scrolling */
  overflow-y: auto; /* Enable vertical scrolling */
}

#bookmarks-content span {
  display: block;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.3s;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

#bookmarks-content span:hover {
  background: var(--highlight);
}

/* Autosuggestion Improvements */
.suggestions {
  position: absolute;
  top: 100%;
  width: 80%;
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 250px;
  overflow-y: auto;
  z-index: 10;
}

.suggestions div {
  padding: 10px 15px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 8px; /* Space between thulung and details */
}

.suggestions div:hover,
.suggestions div:focus {
  background: var(--highlight);
  outline: none;
}

.suggestion-thulung {
  font-weight: 700; /* Bold Thulung word */
  color: var(--primary); /* Distinct color */
}

.suggestion-details {
  font-size: 0.9em; /* Slightly smaller */
  color: var(--text); /* Regular text color */
  opacity: 0.8; /* Slightly faded for contrast */
}

/* Rest of the CSS remains unchanged */




/* Add styles for the Edit button in the related-words section */
.related-words {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px; /* Space between related word spans and edit buttons */
  align-items: center;
}

.related-words span {
  background: var(--secondary);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.3s;
  font-size: 0.9em;
}

.related-words span:hover {
  background: var(--secondary-dark);
}

.edit-btn-link {
  text-decoration: none; /* Remove underline from <a> tag */
}

.edit-btn {
  background: var(--primary);
  color: white;
  padding: 4px 8px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.3s;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 4px; /* Space between icon and text */
}

.edit-btn:hover {
  background: var(--primary-dark);
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .related-words {
    gap: 5px;
  }
  .related-words span,
  .edit-btn {
    padding: 3px 6px;
    font-size: 0.8em;
  }
}