:root {
  --primary: #2563eb;
  --secondary: #4f46e5;
  --accent: #818cf8;
  --background: #f8fafc;
  --text: #1e293b;
  --card: #ffffff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

body {
  background-color: var(--background);
  line-height: 1.6;
  color: var(--text);
}

/* Header Styles */
header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  padding: 0.75rem; /* Reduced padding for mobile */
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

nav a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: background-color 0.3s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

nav a:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Hamburger Menu */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 10px;
  z-index: 101;
}

.hamburger span {
  display: block;
  width: 25px;
  height: 3px;
  background: white;
  transition: 0.3s;
}

/* Mobile Styles */
@media (max-width: 768px) {
  .header-content {
    flex-wrap: wrap;
  }

  .hamburger {
    display: flex;
  }

  nav {
    display: none;
    position: fixed;
    top: 0;
    right: -250px;
    width: 250px;
    background: var(--primary);
    flex-direction: column;
    padding: 1rem;
    height: 100vh;
    transition: right 0.3s ease-in-out;
    z-index: 100;
  }

  nav.active {
    right: 0;
    display: flex;
  }

  nav a {
    width: 100%;
    padding: 1rem;
    justify-content: center;
  }

  .header-content {
    flex-direction: row;
    text-align: left;
    gap: 0;
  }

  .hamburger {
    margin-left: auto;
  }

  /* Small header line for mobile */
  header {
    padding: 0.5rem;
  }

  .brand h1 {
    font-size: 1rem;
  }

  .search-box {
    flex-direction: column;
  }

  .search-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Main Content */
main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Search Section */
.search-container {
  background: var(--card);
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.search-box {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

#wordInput {
  flex: 1;
  padding: 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.3s;
}

#wordInput:focus {
  outline: none;
  border-color: var(--primary);
}

.search-btn {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.3s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-btn:hover {
  background-color: var(--secondary);
}

/* Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.result-card {
  background: var(--card);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.result-card h3 {
  color: var(--primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-list {
  list-style: none;
}

.result-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.result-list li:last-child {
  border-bottom: none;
}


/* Loading and Error States */
.loading, .error {
  text-align: center;
  padding: 2rem;
  border-radius: 0.5rem;
  display: none;
}

.loading {
  background: rgba(37, 99, 235, 0.1);
}

.error {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

/* History Section */
#searchHistory {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.history-tag {
  background: var(--accent);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

.history-tag:hover {
  background: var(--secondary);
}

/* Footer Styles */
footer {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  padding: 2rem 0;
  margin-top: 4rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.footer-section h4 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-section ul li a {
  color: white;
  text-decoration: none;
  transition: opacity 0.3s;
}

.footer-section ul li a:hover {
  opacity: 0.8;
}

.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.social-links a {
  color: white;
  text-decoration: none;
  font-size: 1.5rem;
  transition: transform 0.3s;
}

.social-links a:hover {
  transform: scale(1.2);
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  margin-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Dark Mode Toggle */
.theme-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--primary);
  color: white;
  border: none;
  padding: 1rem;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s;
}

.theme-toggle:hover {
  background: var(--secondary);
}

/* Pronunciation Player */
.pronunciation-player {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.play-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.3s;
}

.play-btn:hover {
  background: var(--secondary);
}

/* Etymology Section */
.etymology {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(37, 99, 235, 0.1);
  border-radius: 0.5rem;
}

/* Examples Section */
.examples {
  margin-top: 1rem;
}

.example-card {
  background: rgba(37, 99, 235, 0.05);
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Translation Box */
.translation-box {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.lang-select {
  padding: 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid var(--accent);
}

.translate-result {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(37, 99, 235, 0.1);
  border-radius: 0.5rem;
}