/* index.css */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-dark: #dcfce7;          /* Soft light mint green */
  --bg-darker: #f0fdf4;        /* Fresh mint off-white */
  --card-bg: rgba(255, 255, 255, 0.75); /* Clean white translucent glass */
  --card-border: rgba(16, 185, 129, 0.12); /* Soft green border */
  --card-hover-border: rgba(16, 185, 129, 0.25);
  
  --primary: #059669;          /* Emerald green for high contrast text/buttons */
  --primary-glow: rgba(5, 150, 105, 0.15);
  --secondary: #65a30d;        /* Bright lime green */
  --secondary-glow: rgba(101, 163, 13, 0.15);
  --accent: #10b981;           /* Mint accent */
  --accent-glow: rgba(16, 185, 129, 0.15);
  
  --masc: #2563eb; /* der (slightly deeper blue for light mode) */
  --fem: #db2777;  /* die (slightly deeper pink for light mode) */
  --neut: #059669; /* das (slightly deeper green for light mode) */
  --plural: #ca8a04; /* die pl (slightly deeper yellow for light mode) */
  --other: #4b5563;  /* verbs/others */
  
  --text-main: #064e3b;        /* Deepest forest green for readable text */
  --text-muted: #374151;       /* Dark grey-slate for descriptions */
  --text-dark: #ffffff;        /* White text for elements inside primary buttons */
  
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-display: 'Outfit', sans-serif;
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-darker);
  background-image: 
    radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(132, 204, 22, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(255, 255, 255, 0.8) 0px, var(--bg-darker) 100%);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-darker);
}
::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(16, 185, 129, 0.4);
}

/* Glassmorphism Common */
.glass {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(4, 47, 31, 0.06);
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.glass:hover {
  border-color: var(--card-hover-border);
}

/* Layout */
.app-container {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px;
  gap: 16px;
}

/* Navbar */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: white;
  box-shadow: 0 0 15px var(--primary-glow);
}

.logo h1 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, var(--text-main), #1e293b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo span {
  font-size: 0.8rem;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
  margin-left: 6px;
  text-transform: uppercase;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 10px;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: white;
  background: linear-gradient(135deg, var(--primary), rgba(5, 150, 105, 0.4));
  box-shadow: 0 4px 15px var(--primary-glow);
}

/* Stats / Progress Badge */
.progress-widget {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}

.progress-bar-container {
  width: 120px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  transition: width 0.5s ease-out;
}

.progress-text {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--secondary);
}

/* Main Content Area */
main {
  height: calc(100vh - 120px);
  position: relative;
  overflow: hidden;
}

.view-panel {
  display: none;
  height: 100%;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.view-panel.active {
  display: grid;
  opacity: 1;
  transform: translateY(0);
}

/* Explorer Layout */
#explorer-view {
  grid-template-columns: 320px 1fr;
  gap: 16px;
}

/* Sidebar List */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.search-box {
  padding: 16px;
  border-bottom: 1px solid var(--card-border);
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 12px 16px 12px 40px;
  border-radius: 12px;
  font-family: var(--font-main);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

/* Letter Filter Scroller */
.letter-filter {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--card-border);
  scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.letter-filter::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari */
}

.letter-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 700;
  min-width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.letter-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.letter-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Word List Scroll Container */
.word-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.word-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.word-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
}

.word-item.active {
  background: rgba(5, 150, 105, 0.12);
  border-color: rgba(5, 150, 105, 0.3);
}

.word-item.learned {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.15);
}

.word-item.learned:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.25);
}

.word-item.learned.active {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.45);
}

.word-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.word-item-de {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.word-item-en {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badge for parts of speech/genders */
.gender-badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.gender-badge.der { background: rgba(59, 130, 246, 0.15); color: var(--masc); }
.gender-badge.die { background: rgba(244, 63, 94, 0.15); color: var(--fem); }
.gender-badge.das { background: rgba(16, 185, 129, 0.15); color: var(--neut); }
.gender-badge.pl { background: rgba(234, 179, 8, 0.15); color: var(--plural); }
.gender-badge.other { background: rgba(107, 114, 128, 0.15); color: var(--text-muted); }

/* Detail Display Panel */
.detail-panel {
  display: flex;
  flex-direction: column;
  padding: 40px;
  position: relative;
  overflow-y: auto;
  justify-content: center;
}

.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 16px;
  text-align: center;
}

.detail-empty-icon {
  font-size: 3rem;
  opacity: 0.5;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.detail-content {
  display: flex;
  flex-direction: column;
  gap: 28px;
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.detail-title-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-word-de {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--text-main), #1e293b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.detail-meta {
  display: flex;
  gap: 8px;
  align-items: center;
}

.detail-word-en {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--secondary);
}

/* Pronunciation Speak Button */
.speak-btn {
  background: rgba(5, 150, 105, 0.1);
  border: 1px solid rgba(5, 150, 105, 0.2);
  color: var(--primary);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.05);
}

.speak-btn:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.08);
  box-shadow: 0 4px 15px var(--primary-glow);
}

.speak-btn svg {
  width: 22px;
  height: 22px;
}

/* Detail Sentence Section */
.detail-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 255, 255, 0.5);
  padding: 24px;
  border-radius: 16px;
  border: 1px solid rgba(16, 185, 129, 0.05);
}

.section-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.sentence-de {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  border-left: 3px solid var(--primary);
  padding-left: 16px;
}

.sentence-en {
  font-size: 1.05rem;
  color: var(--text-muted);
  padding-left: 19px;
  font-style: italic;
}

/* Status control buttons inside detail view */
.detail-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.action-btn {
  flex: 1;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-family: var(--font-main);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.action-btn.primary-action {
  background: linear-gradient(135deg, var(--primary), rgba(5, 150, 105, 0.8));
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.action-btn.primary-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--primary-glow);
}

.action-btn.success-action {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--neut);
}

.action-btn.success-action:hover {
  background: var(--neut);
  color: var(--text-dark);
}

/* Flashcards Mode */
#flashcards-view {
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  align-content: center;
  padding: 40px;
  gap: 32px;
}

.flashcard-container {
  width: 480px;
  height: 320px;
  perspective: 1000px;
  cursor: pointer;
}

.flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform var(--transition-slow);
}

.flashcard-container.flipped .flashcard {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
}

.card-front {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(240, 253, 244, 0.8));
  border: 1px solid var(--card-border);
  border-radius: 20px;
}

.card-front-word {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.card-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 24px;
}

.card-back {
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.9), rgba(255, 255, 255, 0.95));
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 20px;
  transform: rotateY(180deg);
  box-shadow: 0 8px 32px 0 rgba(4, 47, 31, 0.06);
}

.card-back-meaning {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 16px;
}

.card-back-example-de {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 10px;
}

.card-back-example-en {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
}

.flashcard-controls {
  display: flex;
  gap: 16px;
  width: 480px;
}

/* Quiz Mode */
#quiz-view {
  grid-template-rows: auto 1fr;
  padding: 40px;
  gap: 24px;
  max-width: 800px;
  margin: 0 auto;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 16px;
}

.quiz-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  justify-content: center;
}

.quiz-question-box {
  background: rgba(255, 255, 255, 0.5);
  padding: 32px;
  border-radius: 16px;
  border: 1px solid rgba(16, 185, 129, 0.05);
  text-align: center;
}

.quiz-question-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
}

.quiz-question {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.option-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 20px;
  color: var(--text-main);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  display: flex;
  align-items: center;
}

.option-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.option-btn.correct {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--neut);
  color: var(--neut);
}

.option-btn.wrong {
  background: rgba(244, 63, 94, 0.15);
  border-color: var(--fem);
  color: var(--fem);
}

.quiz-feedback {
  text-align: center;
  font-weight: 700;
  font-size: 1.2rem;
  min-height: 28px;
}

/* Wortgruppen View */
#wortgruppen-view {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  overflow-y: auto;
  align-content: start;
  padding: 10px;
}

.group-card {
  padding: 24px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.group-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.15);
}

.group-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.group-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.group-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Modal for Wortgruppen Contents */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 47, 31, 0.25);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalScaleUp {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--card-border);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.close-modal-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.group-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(16, 185, 129, 0.08);
}

.group-item-key {
  font-weight: 700;
  color: var(--secondary);
}

.group-item-val {
  color: var(--text-main);
  text-align: right;
}

/* Animations & Confetti */
.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: confettiFall 2.5s ease-out forwards;
  z-index: 10000;
}

@keyframes confettiFall {
  0% { transform: translateY(-50px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Vocab Grid styling */
#sheet-view {
  height: 100%;
}

#sheet-view.active {
  display: flex !important;
  flex-direction: column;
}

.sheet-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px;
  overflow: hidden;
}

.sheet-cells {
  flex: 1;
  overflow-y: auto;
  background: rgba(16, 185, 129, 0.12); /* acts as gridline borders */
  border: 1px solid var(--card-border);
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  padding: 1px;
  gap: 1px;
}

.sheet-cell {
  background: #ffffff;
  color: #064e3b;
  padding: 0 16px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
  user-select: none;
  white-space: nowrap;
}

.sheet-cell:hover {
  filter: brightness(0.95);
  transform: scale(1.02);
  z-index: 1;
}
