/* ==========================================================================
   LINGUACARD - FULL RESPONSIVE WEB APPLICATION & AUTH GATEWAY DESIGN SYSTEM
   ========================================================================== */

/* Dark Mode Variables (Default) */
[data-theme="dark"] {
  --bg-dark: #090d16;
  --bg-surface: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.85);
  --bg-card-border: rgba(255, 255, 255, 0.1);
  --bg-card-hover: rgba(40, 53, 78, 0.9);

  --primary-accent: #6366f1;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --gender-der: #38bdf8;
  --gender-die: #fb7185;
  --gender-das: #34d399;

  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  --input-bg: #1e293b;
}

/* Light Mode Variables */
[data-theme="light"] {
  --bg-dark: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-border: rgba(0, 0, 0, 0.1);
  --bg-card-hover: #f1f5f9;

  --primary-accent: #4f46e5;
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --gender-der: #0284c7;
  --gender-die: #e11d48;
  --gender-das: #059669;

  --shadow-lg: 0 15px 35px -10px rgba(0, 0, 0, 0.12);
  --input-bg: #f1f5f9;
}

:root {
  --font-family-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-family-heading: 'Outfit', sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
}

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

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--font-family-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* 1. AUTH GATEWAY LANDING SCREEN */
.gateway-screen {
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at top, rgba(99, 102, 241, 0.15) 0%, var(--bg-dark) 70%);
}

.gateway-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  padding: 36px 28px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
  animation: popIn 0.3s ease-out;
}

.gateway-brand {
  text-align: center;
  margin-bottom: 24px;
}

.gateway-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.8rem;
  margin: 0 auto 14px auto;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.gateway-brand h1 {
  font-family: var(--font-family-heading);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

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

.gateway-tabs {
  margin-bottom: 24px;
}

/* 2. APP SHELL LAYOUT */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* App Top Navigation Bar */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bg-card-border);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

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

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-family-heading);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.brand-tag {
  font-size: 0.72rem;
  color: var(--primary-accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Top Navigation Pills */
.top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-dark);
  padding: 6px;
  border-radius: 30px;
  border: 1px solid var(--bg-card-border);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 20px;
  border: none !important;
  background: transparent !important;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

@media (max-width: 900px) {
  .nav-btn span {
    display: none;
  }
  .nav-btn {
    padding: 8px 12px;
  }
}

.nav-btn i {
  font-size: 1.1rem;
}

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

.nav-btn.active {
  background: var(--primary-gradient) !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Right Header Actions */
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-accent);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
}

.icon-btn-secondary {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--bg-card-border) !important;
  background: var(--bg-card) !important;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.icon-btn-secondary:hover {
  background: var(--bg-card-hover) !important;
  transform: translateY(-1px);
}

.user-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  padding: 4px 12px 4px 4px;
  border-radius: 25px;
  border: 1px solid var(--bg-card-border);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.admin-badge {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.icon-btn-danger {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none !important;
  background: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.icon-btn-danger:hover {
  background: rgba(239, 68, 68, 0.25) !important;
}

.main-viewport {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 20px 10px 80px 10px;
  width: 100%;
}

@media (min-width: 768px) {
  .main-viewport {
    padding: 30px 20px 80px 20px;
  }
}

.container-center {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.tab-page {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-page.active {
  display: block;
}

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

/* Study Progress Card */
.study-progress-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.progress-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-count {
  font-family: var(--font-family-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background: var(--bg-dark);
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 10px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Anki 3D Card Stage */
.card-stage {
  perspective: 1200px;
  width: 100%;
  height: 380px;
  margin-bottom: 24px;
}

.anki-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.anki-card.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
}

.card-front {
  z-index: 2;
}

.card-back {
  transform: rotateY(180deg);
}

.card-type-tag {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 5px 12px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-accent);
}

.card-main-content {
  text-align: center;
  margin: auto 0;
}

.source-word {
  font-family: var(--font-family-heading);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 12px;
}

.source-hint {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 80%;
  margin: 0 auto;
  line-height: 1.5;
}

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

/* Card Back Design */
.card-back-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gender-badge {
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gender-feminine {
  background: rgba(251, 113, 133, 0.15);
  color: var(--gender-die);
  border: 1px solid rgba(251, 113, 133, 0.3);
}

.gender-masculine {
  background: rgba(56, 189, 248, 0.15);
  color: var(--gender-der);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.gender-neuter {
  background: rgba(52, 211, 153, 0.15);
  color: var(--gender-das);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.word-type-pill {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: 4px 10px;
  background: var(--bg-dark);
  border-radius: 12px;
}

.target-word-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 10px;
}

.target-word {
  font-family: var(--font-family-heading);
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--text-main);
}

.speech-btn-sm {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none !important;
  background: var(--primary-gradient) !important;
  color: #fff !important;
  font-size: 1.2rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.speech-btn-sm:hover {
  transform: scale(1.08);
}

.target-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 85%;
  margin: 0 auto;
}

.expand-card-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--primary-accent) !important;
  background: rgba(99, 102, 241, 0.08) !important;
  color: var(--primary-accent) !important;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.expand-card-btn:hover {
  background: rgba(99, 102, 241, 0.18) !important;
}

/* Rating Bar */
.anki-rating-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: 100%;
}

.anki-btn {
  padding: 14px 10px;
  border-radius: var(--radius-md);
  border: none !important;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #fff !important;
  font-weight: 700;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.anki-btn:hover {
  transform: translateY(-2px);
  opacity: 0.92;
}

.btn-again { background: #ef4444 !important; }
.btn-hard { background: #f59e0b !important; }
.btn-good { background: #3b82f6 !important; }
.btn-easy { background: #10b981 !important; }

.btn-time {
  font-size: 0.72rem;
  opacity: 0.85;
}

.btn-text {
  font-size: 0.95rem;
}

/* Expanded Sheet Overlay */
.expanded-card-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.expanded-card-sheet {
  background: var(--bg-surface);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle-bar {
  padding: 12px;
  display: flex;
  justify-content: center;
  cursor: pointer;
}

.sheet-pill {
  width: 44px;
  height: 5px;
  background: var(--text-dim);
  border-radius: 10px;
  opacity: 0.5;
}

.sheet-content {
  padding: 0 28px 24px 28px;
  overflow-y: auto;
  flex: 1;
}

.expanded-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.expanded-word-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.expanded-word-title h1 {
  font-family: var(--font-family-heading);
  font-size: 2.2rem;
  font-weight: 800;
}

.exp-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.source-equiv {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.divider {
  border: none;
  border-top: 1px solid var(--bg-card-border);
  margin: 16px 0;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.accordion-item {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.meaning-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary-accent);
  margin-bottom: 10px;
}

.example-box {
  background: var(--bg-dark);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.example-de {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.sheet-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--bg-card-border);
  background: var(--bg-surface);
}

/* Dictionary List UI & Action Group */
.dict-header-box {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}

.search-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-bar {
  flex: 1;
  min-width: 250px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--input-bg);
  border: 1px solid var(--bg-card-border);
  border-radius: 30px;
  padding: 10px 18px;
}

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
}

.action-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--bg-card-border) !important;
  background: var(--bg-dark) !important;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  color: var(--text-main);
}

.chip.active {
  background: var(--primary-accent) !important;
  color: #fff !important;
  border-color: var(--primary-accent) !important;
}

.dict-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.dict-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.dict-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.dict-target {
  font-family: var(--font-family-heading);
  font-size: 1.3rem;
  font-weight: 800;
}

.dict-source {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.dict-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--bg-card-border);
}

/* Admin Users Management Panel */
.admin-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-header-box {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.admin-header-box h2 {
  font-family: var(--font-family-heading);
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-header-box p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.table-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.admin-table th {
  background: var(--bg-surface);
  padding: 14px 18px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--bg-card-border);
}

.admin-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--bg-card-border);
  color: var(--text-main);
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.badge-role-admin {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.78rem;
}

.badge-role-user {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-accent);
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.78rem;
}

/* Modal Overlays & Auth Cards */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: popIn 0.25s ease-out;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-family: var(--font-family-heading);
  font-size: 1.3rem;
  font-weight: 700;
}

.modal-tabs {
  display: flex;
  background: var(--bg-dark);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.modal-tab-btn {
  flex: 1;
  padding: 9px;
  border-radius: var(--radius-sm);
  border: none !important;
  background: transparent !important;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-tab-btn.active {
  background: var(--bg-card) !important;
  color: var(--text-main) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-field input, .input-field select, .input-field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-card-border);
  background: var(--input-bg);
  color: var(--text-main);
  font-family: var(--font-family-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.input-field input:focus, .input-field select:focus, .input-field textarea:focus {
  border-color: var(--primary-accent);
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
}

/* Animated Language Switch Track & Sliding Thumb */
.lang-toggle-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toggle-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.lang-switch-track {
  position: relative;
  display: inline-flex;
  background: var(--bg-dark);
  border: 1px solid var(--bg-card-border);
  border-radius: 30px;
  padding: 4px;
  width: 100%;
  max-width: 280px;
  overflow: hidden;
}

.lang-switch-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 6px);
  height: calc(100% - 8px);
  background: var(--primary-gradient);
  border-radius: 20px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
  z-index: 1;
}

.lang-switch-track.de .lang-switch-thumb {
  transform: translateX(100%);
}

.lang-switch-btn {
  position: relative;
  z-index: 2;
  flex: 1;
  padding: 8px 14px;
  border-radius: 20px;
  border: none !important;
  background: transparent !important;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.3s ease;
  text-align: center;
}

.lang-switch-btn.active {
  color: #ffffff !important;
}

.auto-detect-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-accent);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  animation: fadeIn 0.25s ease-out;
}

/* Settings Page Styling */
.settings-container {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 10px 0 40px 0;
}

.settings-group {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.settings-group h3 {
  font-family: var(--font-family-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.settings-group h3 i {
  color: var(--primary-accent);
  font-size: 1.5rem;
}

.settings-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: -6px 0 6px 0;
}

.settings-group .input-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-group .input-field label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-main);
  margin-top: 4px;
}

.settings-group .input-field input,
.settings-group .input-field select {
  padding: 14px 16px;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  background: var(--input-bg);
  border: 1px solid var(--bg-card-border);
  color: var(--text-main);
}

.settings-group #saveSettingsBtn {
  margin-top: 8px;
}

/* Activities Cards */
.activities-hero {
  text-align: center;
  margin-bottom: 28px;
}

.activities-hero h2 {
  font-family: var(--font-family-heading);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.activities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.activity-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.activity-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-accent);
}

.activity-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  flex-shrink: 0;
}

.gender-quiz-icon { background: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%); }
.choice-quiz-icon { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }

.activity-info h3 {
  font-family: var(--font-family-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.activity-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Buttons & Utils */
.btn-primary {
  padding: 10px 20px;
  border-radius: 20px;
  border: none !important;
  background: var(--primary-gradient) !important;
  color: #fff !important;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-primary-full {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: none !important;
  background: var(--primary-gradient) !important;
  color: #fff !important;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary-full:hover {
  opacity: 0.92;
}

.btn-secondary {
  padding: 9px 16px;
  border-radius: 20px;
  border: 1px solid var(--bg-card-border) !important;
  background: var(--bg-dark) !important;
  color: var(--text-main) !important;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-card-hover) !important;
}

.icon-btn-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-main) !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 3. MOBILE BOTTOM NAVIGATION (< 768px) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  background: var(--bg-surface);
  border-top: 1px solid var(--bg-card-border);
  padding: 8px 12px;
  z-index: 200;
  justify-content: space-around;
  backdrop-filter: blur(12px);
  box-sizing: border-box;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  padding: 4px;
  border: none !important;
  background: transparent !important;
}

.mobile-nav-item i {
  font-size: 1.3rem;
}

.mobile-nav-item.active {
  color: var(--primary-accent) !important;
  font-weight: 700;
}

/* RESPONSIVE MEDIA QUERIES (< 768px Smartphones) */
@media (max-width: 768px) {
  .top-nav {
    display: none !important;
  }

  .mobile-bottom-nav {
    display: flex !important;
  }

  .app-topbar {
    padding: 12px 16px;
  }

  .main-viewport {
    padding: 16px 12px 90px 12px;
  }

  .card-stage {
    height: 340px;
  }

  .card-face {
    padding: 20px;
  }

  .source-word, .target-word {
    font-size: 2rem;
  }

  .dict-list {
    grid-template-columns: 1fr;
  }

  .search-row {
    flex-direction: column;
  }

  .search-bar {
    width: 100%;
  }

  .action-btn-group {
    width: 100%;
    justify-content: space-between;
  }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--bg-surface);
  border: 1px solid var(--primary-accent);
  color: var(--text-main);
  padding: 12px 24px;
  border-radius: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 500;
  font-weight: 600;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

.hidden,
.hidden * {
  display: none !important;
}

/* Stats & Analytics Dashboard CSS */
.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-icon {
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: var(--bg-dark);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

/* Stacked Mastery Progress Bar */
.progress-bar-stacked {
  width: 100%;
  height: 14px;
  background: var(--bg-dark);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  margin-top: 14px;
}

.progress-segment {
  height: 100%;
  transition: width 0.4s ease;
}

.segment-mastered {
  background: #34d399;
}

.segment-learning {
  background: #38bdf8;
}

.segment-hard {
  background: #f43f5e;
}

.progress-legend {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  flex-wrap: wrap;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Curious Facts Grid */
.curious-facts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.fact-card {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fact-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-accent);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fact-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  word-break: break-word;
}

.fact-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

