/* ==========================================================================
   Wortschatz B1 - Components & Interactive UI Elements
   ========================================================================== */

/* --------------------------------------------------------------------------
   Buttons & Inputs
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--brand-gradient);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.25);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.25);
}

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger-outline:hover {
  background: var(--danger-bg);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
}

/* --------------------------------------------------------------------------
   Category Tabs Bar
   -------------------------------------------------------------------------- */
.categories-bar-wrapper {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 70px;
  z-index: 90;
}

.categories-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.75rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.categories-bar::-webkit-scrollbar {
  height: 4px;
}

.categories-bar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.category-tab-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.category-tab-btn:hover {
  background: var(--bg-primary);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.category-tab-btn.active {
  background: var(--brand-gradient);
  color: #ffffff;
  border-color: var(--brand-secondary);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.tab-badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.1);
}

.category-tab-btn.active .tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Category Header & Stats Card
   -------------------------------------------------------------------------- */
.topic-header-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-md);
}

.topic-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.topic-title-group h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topic-title-group p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.stats-grid-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  text-align: center;
}

[data-perimeter-light] { position: relative; }
.perimeter-light-canvas {
  position: absolute;
  /* Absolute positioning starts at the padding edge; cover the border too. */
  top: -1px;
  left: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .perimeter-light-canvas { display: none; }
}

.stat-box .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-box .stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 0.2rem;
}

.stat-box.learned .stat-value { color: var(--success); }
.stat-box.remaining .stat-value { color: var(--brand-secondary); }
.stat-box.wrong .stat-value { color: var(--danger); }

/* Progress Bar */
.progress-bar-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.progress-track {
  flex: 1;
  height: 10px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-color);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #10b981 100%);
  border-radius: var(--radius-full);
  transition: width 0.4s ease-out;
}

.progress-percentage-label {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-primary);
  min-width: 48px;
  text-align: left;
}

/* --------------------------------------------------------------------------
   Vocabulary Practice Table & Card Rows
   -------------------------------------------------------------------------- */
.vocab-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 2rem;
}

.vocab-table-header {
  display: grid;
  grid-template-columns: 60px 1fr 1.2fr 130px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.vocab-row {
  display: grid;
  grid-template-columns: 60px 1fr 1.2fr 130px;
  align-items: center;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s, transform 0.2s, opacity 0.2s;
}

.vocab-row:hover {
  background: var(--bg-tertiary);
}

.vocab-row.answering-correct {
  background: var(--success-bg) !important;
  border-left: 4px solid var(--success);
  transform: translateX(-4px);
}

.vocab-row.answering-wrong {
  background: var(--danger-bg) !important;
  border-left: 4px solid var(--danger);
  transform: translateX(4px);
}

.vocab-row .row-num {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-muted);
}

.vocab-row .word-ar {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.vocab-row .word-de-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  direction: ltr;
}

.vocab-row .word-ar-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Blurred & Revealed German Word */
.word-de {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-german);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

/* Blurred & Revealed Arabic Word (used in reversed "German -> Arabic" mode) */
.word-ar {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.word-de.blurred,
.word-ar.blurred {
  cursor: pointer;
  user-select: none;
  filter: blur(7px);
  background: var(--bg-tertiary);
  color: transparent;
  border: 1px dashed var(--border-color);
  opacity: 0.6;
}

.word-de.blurred:hover,
.word-ar.blurred:hover {
  filter: blur(5px);
  opacity: 0.85;
  border-color: var(--brand-secondary);
}

.word-de.revealed,
.word-ar.revealed {
  cursor: default;
  filter: blur(0);
  background: var(--brand-surface);
  color: var(--brand-primary);
  border: 1px solid rgba(37, 99, 235, 0.2);
  user-select: text;
  animation: popIn 0.25s ease-out;
}

@keyframes popIn {
  0% { transform: scale(0.96); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

/* Audio Pronunciation Button */
.audio-speak-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 1rem;
}

.audio-speak-btn:hover {
  color: var(--brand-secondary);
  background: var(--brand-surface);
}

/* Row Action Buttons (✓ and ✕) */
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.action-btn-correct,
.action-btn-wrong {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
}

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

.action-btn-correct:hover {
  background: var(--success);
  color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.action-btn-wrong {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.action-btn-wrong:hover {
  background: var(--danger);
  color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* --------------------------------------------------------------------------
   Category Completed Banner & Reinforce
   -------------------------------------------------------------------------- */
.completed-banner-card {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--success);
  margin: 2rem 0;
  box-shadow: var(--shadow-lg);
}

.completed-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.completed-banner-card h3 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.completed-banner-card p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 500px;
  margin: 0 auto 1.75rem;
}

/* --------------------------------------------------------------------------
   Modals & Dialogs
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 1.75rem;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.modal-header h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

/* Form Controls */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-secondary);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px var(--brand-surface);
}

/* --------------------------------------------------------------------------
   Toasts Notification Popup
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-right: 5px solid var(--brand-secondary);
  box-shadow: var(--shadow-xl);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  min-width: 300px;
  max-width: 420px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.toast-success { border-right-color: var(--success); }
.toast.toast-danger { border-right-color: var(--danger); }
.toast.toast-warning { border-right-color: var(--warning); }

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

/* Notifications Dropdown */
.notifications-dropdown {
  position: absolute;
  top: 55px;
  left: 0;
  width: 340px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 150;
  display: none;
  overflow: hidden;
}

.notifications-dropdown.active {
  display: block;
  animation: popIn 0.2s ease-out;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 0.9rem;
}

.notif-list {
  max-height: 360px;
  overflow-y: auto;
}

.notif-item {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
  cursor: pointer;
}

.notif-item:hover {
  background: var(--bg-tertiary);
}

.notif-item.unread {
  background: var(--brand-surface);
}

.notif-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.notif-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.notif-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}
