/* ===================================
   PA-German Phrases - Modern Styles
   =================================== */

/* CSS Variables for theming */
:root {
  --primary-color: #2c3e50;
  --secondary-color: #3498db;
  --accent-color: #e74c3c;
  --text-color: #333;
  --light-bg: #f8f9fa;
  --border-color: #dee2e6;
  --hover-color: #ecf0f1;
  --shadow: 0 2px 4px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);

  /* Typography */
  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-german: 'Lucida Sans Unicode', 'Arial Unicode MS', Arial, sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
}

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

body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-color);
  background-color: #fff;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header {
  background-color: var(--primary-color);
  color: white;
  padding: 1rem 0;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
}

/* Navigation */
nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav-link {
  padding: 0.6rem 1.2rem;
  background-color: rgba(255,255,255,0.1);
  color: white;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.3s ease;
  font-weight: 500;
}

.nav-link:hover {
  background-color: rgba(255,255,255,0.2);
}

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

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

.hero-image {
  width: 100%;
  max-height: 500px;
  overflow: hidden;
}

.hero-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

/* Donation Section */
.donation-section {
  text-align: center;
  padding: 3rem 2rem;
  background-color: var(--light-bg);
}

.donation-section h2 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.donation-section p {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  color: #666;
}

.donate-button {
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.donate-button:hover {
  transform: scale(1.05);
}

.donate-button img {
  height: auto;
}

/* Footer */
footer {
  background-color: var(--primary-color);
  color: white;
  padding: 2rem 0;
  margin-top: 3rem;
  text-align: center;
}

footer p {
  margin: 0;
}

/* Lexicon Styles */
.lexicon-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.lexicon-sidebar h2 {
  margin-top: 0;
  font-size: 1.3rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.lexicon-sidebar {
  background-color: var(--light-bg);
  padding: 1.5rem;
  border-radius: 8px;
  height: fit-content;
  position: sticky;
  top: 80px;
}

.lexicon-content {
  background-color: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

/* Entry Styles */
.lexicon-entry {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.lexicon-entry:last-child {
  border-bottom: none;
}

.entry-name {
  font-size: 1.2rem;
  font-weight: 700;
  font-family: var(--font-german);
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.entry-translation {
  font-size: 1rem;
  font-family: var(--font-serif);
  color: #555;
  margin-bottom: 0.5rem;
}

.entry-category {
  font-size: 0.9rem;
  font-weight: 600;
  color: purple;
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background-color: #f8f4ff;
  border-radius: 3px;
  margin-top: 0.3rem;
}

/* Audio Player Styles */
.audio-player {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.audio-player audio {
  height: 30px;
}

.audio-icon {
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

/* Category List Navigation */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.category-item {
  color: var(--text-color);
  text-decoration: none;
  padding: 0.6rem 0.8rem;
  display: block;
  border-radius: 4px;
  background-color: white;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.category-item:hover {
  background-color: var(--secondary-color);
  color: white;
  border-color: var(--secondary-color);
  transform: translateX(3px);
}

.category-item:active {
  background-color: var(--primary-color);
}

/* Tree Navigation */
.tree-nav {
  list-style: none;
  padding-left: 0;
}

.tree-nav ul {
  list-style: none;
  padding-left: 1.5rem;
  margin-top: 0.3rem;
}

.tree-nav li {
  margin: 0.3rem 0;
}

.tree-nav a {
  color: var(--text-color);
  text-decoration: none;
  padding: 0.3rem 0.5rem;
  display: block;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.tree-nav a:hover {
  background-color: var(--hover-color);
}

.tree-folder {
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.tree-folder::before {
  content: '▶';
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform 0.2s ease;
}

.tree-folder.open::before {
  transform: rotate(90deg);
}

/* Index/Alphabetical Navigation */
.alpha-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1rem 0;
  justify-content: center;
}

.alpha-link {
  display: inline-block;
  padding: 0.5rem 0.8rem;
  background-color: var(--light-bg);
  color: var(--text-color);
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
}

.alpha-link:hover {
  background-color: var(--secondary-color);
  color: white;
  border-color: var(--secondary-color);
}

.alpha-link.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Page Title */
.page-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin: 2rem 0;
  color: var(--primary-color);
}

.page-subtitle {
  font-size: 1.2rem;
  text-align: center;
  margin: 1rem 0 2rem;
  color: #666;
}

/* English Index Table Styles */
.lpIndexEnglish {
  font-family: var(--font-serif);
  color: #555;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

table tr:hover {
  background-color: var(--hover-color);
}

table a {
  color: var(--primary-color);
  text-decoration: none;
  font-family: var(--font-german);
}

table a:hover {
  color: var(--secondary-color);
  text-decoration: underline;
}

/* Mobile Sidebar Toggle Button */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 135px;
  left: 1rem;
  z-index: 1000;
  background-color: var(--primary-color);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
}

.sidebar-toggle:hover {
  background-color: var(--secondary-color);
  transform: scale(1.05);
}

.sidebar-toggle.active {
  background-color: var(--accent-color);
}

/* Hamburger Icon */
.hamburger-icon,
.hamburger-icon::before,
.hamburger-icon::after {
  display: block;
  width: 25px;
  height: 3px;
  background-color: white;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger-icon {
  position: relative;
  margin: 0 auto;
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  position: absolute;
  left: 0;
}

.hamburger-icon::before {
  top: -8px;
}

.hamburger-icon::after {
  top: 8px;
}

.sidebar-toggle.active .hamburger-icon {
  background-color: transparent;
}

.sidebar-toggle.active .hamburger-icon::before {
  transform: rotate(45deg);
  top: 0;
}

.sidebar-toggle.active .hamburger-icon::after {
  transform: rotate(-45deg);
  top: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  header .container {
    flex-direction: column;
    text-align: center;
  }

  nav {
    width: 100%;
    justify-content: center;
  }

  .lexicon-container {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .lexicon-sidebar {
    position: fixed;
    top: 80px;
    left: -100%;
    width: 280px;
    height: calc(100vh - 80px);
    z-index: 999;
    overflow-y: auto;
    transition: left 0.3s ease;
    box-shadow: var(--shadow-lg);
  }

  .lexicon-sidebar.open {
    left: 0;
  }

  

  header h1 {
    font-size: 1.5rem;
  }

  .page-title {
    font-size: 1.6rem;
  }

  .hero-image {
    max-height: 300px;
  }
}

@media (max-width: 480px) {
  .nav-link {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
  }

  .alpha-nav {
    gap: 0.3rem;
  }

  .alpha-link {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
  }
}

/* Print Styles */
@media print {
  header, footer, .donation-section, .audio-player {
    display: none;
  }

  .lexicon-container {
    grid-template-columns: 1fr;
  }

  .lexicon-entry {
    page-break-inside: avoid;
  }
}

/* Accessibility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Focus visible for keyboard navigation */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--secondary-color);
  outline-offset: 2px;
}
