/* Deutsch B1 - Modern Responsive Theme */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #334155;
  --accent-color: #6366f1;
  --accent-hover: #4f46e5;
  
  --color-der: #3b82f6;      /* Blue */
  --color-die: #ef4444;      /* Red */
  --color-das: #10b981;      /* Green */
  --color-plural: #f59e0b;   /* Amber */
  --color-verb: #8b5cf6;     /* Purple */
  --color-other: #06b6d4;    /* Cyan */
  
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #0ea5e9;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-height: 64px;
  --bottom-nav-height: 68px;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}

.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--bottom-nav-height) + 20px);
}

@media (min-width: 769px) {
  .main-content {
    margin-left: 260px;
    padding-bottom: 40px;
  }
}

.content-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 24px 20px;
}

.sidebar {
  display: none;
}
@media (min-width: 769px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    width: 260px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 24px 16px;
    z-index: 100;
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  margin-bottom: 32px;
  padding: 0 8px;
}
.sidebar-brand .badge-b1 {
  background: linear-gradient(135deg, var(--accent-color), #ec4899);
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 800;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
}
.sidebar-link:hover, .sidebar-link.active {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.sidebar-link.active {
  background: var(--accent-color);
  color: white;
}
.sidebar-link svg {
  width: 20px;
  height: 20px;
}

.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: rgba(30, 41, 59, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-color);
  z-index: 999;
  justify-content: space-around;
  align-items: center;
  padding: 4px 8px;
}
[data-theme="light"] .bottom-nav {
  background: rgba(255, 255, 255, 0.92);
}
@media (min-width: 769px) {
  .bottom-nav {
    display: none;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  min-width: 60px;
  gap: 4px;
}
.bottom-nav-item.active {
  color: var(--accent-color);
}
.bottom-nav-item svg {
  width: 22px;
  height: 22px;
}

.top-bar {
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}
.user-info-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
}
.streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
}
.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.stat-info h4 {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.stat-info .value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-primary);
}

.flashcard-area {
  perspective: 1200px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto 24px auto;
  min-height: 380px;
}
.flashcard {
  position: relative;
  width: 100%;
  min-height: 380px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
  border-radius: var(--radius-lg);
}
.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
}
.flashcard-back {
  transform: rotateY(180deg);
  background: linear-gradient(145deg, var(--bg-card), var(--bg-card-hover));
}

.flashcard.article-der .flashcard-front { border-color: var(--color-der); }
.flashcard.article-die .flashcard-front { border-color: var(--color-die); }
.flashcard.article-das .flashcard-front { border-color: var(--color-das); }
.flashcard.article-plural .flashcard-front { border-color: var(--color-plural); }
.flashcard.type-verb .flashcard-front { border-color: var(--color-verb); }

.card-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.article-badge {
  font-weight: 800;
  font-size: 1rem;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.badge-der { background: rgba(59, 130, 246, 0.18); color: var(--color-der); }
.badge-die { background: rgba(239, 68, 68, 0.18); color: var(--color-die); }
.badge-das { background: rgba(16, 185, 129, 0.18); color: var(--color-das); }
.badge-plural { background: rgba(245, 158, 11, 0.18); color: var(--color-plural); }
.badge-verb { background: rgba(139, 92, 246, 0.18); color: var(--color-verb); }

.box-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

.word-display {
  text-align: center;
  margin: auto 0;
}
.german-word {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  word-break: break-word;
}
.preposition-tag {
  display: inline-block;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  font-size: 1rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}
.plural-info {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 14px;
}

.example-box {
  background: var(--bg-primary);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin-top: 14px;
  border-left: 3px solid var(--accent-color);
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-primary);
}

.card-footer-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-speaker {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.btn-speaker:hover {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  transform: scale(1.05);
}
.btn-speaker:active {
  transform: scale(0.95);
}

.srs-actions {
  display: flex;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
}
.btn-srs {
  flex: 1;
  padding: 14px 10px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  min-height: 58px;
  box-shadow: var(--shadow-md);
}
.btn-srs span.sub {
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.85;
}
.btn-hard {
  background: #dc2626;
  color: white;
}
.btn-hard:hover { background: #b91c1c; transform: translateY(-2px); }
.btn-good {
  background: #2563eb;
  color: white;
}
.btn-good:hover { background: #1d4ed8; transform: translateY(-2px); }
.btn-easy {
  background: #059669;
  color: white;
}
.btn-easy:hover { background: #047857; transform: translateY(-2px); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  min-height: 44px;
}
.btn-primary {
  background: var(--accent-color);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
}
.btn-block {
  width: 100%;
}

.quiz-container {
  max-width: 640px;
  margin: 0 auto;
}
.quiz-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 20px;
}
@media (min-width: 500px) {
  .quiz-options.options-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.quiz-opt-btn {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: left;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.quiz-opt-btn:hover {
  border-color: var(--accent-color);
  background: var(--bg-card-hover);
}
.quiz-opt-btn.correct {
  border-color: var(--color-success);
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
}
.quiz-opt-btn.wrong {
  border-color: var(--color-danger);
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
}

.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.form-control {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.table th, .table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}
.table th {
  color: var(--text-secondary);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.table tr:hover {
  background: var(--bg-card-hover);
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-overlay.active {
  display: flex;
}
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  color: var(--text-primary);
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), #ec4899);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}
