/* CSS Variables for Theme Management */
:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary-color: #f59e0b;
  --background: #ffffff;
  --background-secondary: #f8fafc;
  --background-tertiary: #f1f5f9;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl:
    0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.2);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --primary-color: #818cf8;
  --primary-dark: #6366f1;
  --primary-light: #a5b4fc;
  --secondary-color: #fbbf24;
  --background: #0f172a;
  --background-secondary: #1e293b;
  --background-tertiary: #334155;
  --surface: #1e293b;
  --surface-hover: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --border-color: #334155;
  --border-light: #475569;
  --glass-bg: rgba(30, 41, 59, 0.8);
  --glass-border: rgba(255, 255, 255, 0.1);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: var(--transition);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 700;
  line-height: 1.2;
}

/* Navigation Bar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition);
}

.brand-icon {
  color: var(--primary-color);
  font-size: 1.5rem;
}

.brand-name {
  font-family: "Space Grotesk", sans-serif;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: var(--transition);
  position: relative;
}

.nav-link:hover {
  color: var(--primary-color);
  background: var(--surface-hover);
}

.nav-link.active {
  color: var(--primary-color);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -1rem;
  left: 50%;
  transform: translateX(-50%);
  width: 2rem;
  height: 3px;
  background: var(--primary-color);
  border-radius: 2px;
}

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.75rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--surface-hover);
  color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Main Content */
.main-content {
  min-height: calc(100vh - 80px);
}

/* Hero Section */
.hero-section {
  padding: 4rem 2rem;
  text-align: center;
  background: linear-gradient(
    135deg,
    var(--background-secondary) 0%,
    var(--background) 100%
  );
}

.hero-container {
  max-width: 800px;
  margin: 0 auto;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-dark)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 0.8s ease-out;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* Search Container */
.search-container {
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

.search-wrapper {
  display: flex;
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: 1rem;
  padding: 0.5rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.search-wrapper:focus-within {
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 1rem 1.5rem;
  font-size: 1.125rem;
  color: var(--text-primary);
  outline: none;
}

.search-input::placeholder {
  color: var(--text-tertiary);
}

.search-button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.search-button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.search-button:active {
  transform: translateY(0);
}

/* Content Wrapper */
.content-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 120px;
  height: fit-content;
}

.sidebar-section {
  background: var(--surface);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.sidebar-section:hover {
  box-shadow: var(--shadow-lg);
}

.sidebar-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-history,
.favorites-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item,
.favorite-item {
  padding: 0.75rem;
  background: var(--background-secondary);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.history-item:hover,
.favorite-item:hover {
  background: var(--surface-hover);
  border-color: var(--border-color);
  transform: translateX(4px);
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-tertiary);
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

/* Results Section */
.results-section {
  min-height: 500px;
}

.empty-results {
  text-align: center;
  padding: 6rem 2rem;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 2rem;
  opacity: 0.3;
  color: var(--primary-color);
}

.empty-results h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem;
}

/* Results Container */
.results-container {
  animation: fadeIn 0.5s ease-out;
}

.word-card {
  background: var(--surface);
  border-radius: 1rem;
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.word-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.word-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.word-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.word-phonetic {
  font-size: 1.25rem;
  color: var(--text-secondary);
  font-family: "Inter", sans-serif;
  margin-bottom: 1rem;
}

.word-actions {
  display: flex;
  gap: 0.75rem;
}

.action-button {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.75rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-button:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.action-button.favorited {
  background: var(--secondary-color);
  color: white;
  border-color: var(--secondary-color);
}

.part-of-speech {
  display: inline-block;
  background: var(--primary-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.definition-section {
  margin-bottom: 2rem;
}

.definition-text {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.example-container {
  background: var(--background-secondary);
  border-left: 4px solid var(--primary-color);
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  margin-top: 1rem;
}

.example-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.example-text {
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Footer */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
  margin-top: 4rem;
}

.footer-container p {
  margin: 0.5rem 0;
}

.designed-by {
  font-weight: 600;
  color: var(--primary-color);
}

.contact-info {
  font-size: 0.9rem;
  color: var(--text-muted);
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .content-wrapper {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  .nav-container {
    padding: 1rem;
  }

  .nav-links {
    display: none;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1.125rem;
  }

  .search-wrapper {
    flex-direction: column;
    padding: 1rem;
  }

  .search-button {
    width: 100%;
    justify-content: center;
  }

  .content-wrapper {
    padding: 1rem;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }

  .word-header {
    flex-direction: column;
    gap: 1rem;
  }

  .word-title {
    font-size: 2rem;
  }

  .word-card {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2rem;
  }

  .hero-section {
    padding: 2rem 1rem;
  }

  .word-title {
    font-size: 1.75rem;
  }

  .word-card {
    padding: 1rem;
  }
}
