/* ============================================================
   MAX EXAM LAB — UNIVERSAL IELTS NAVIGATOR VOCABULARY BANK
   Unified across Listening, Reading, Writing, Speaking & Dashboard
   ============================================================ */

/* ------------------------------------------------------------
   1. UNIVERSAL 2-REGION DESKTOP LAYOUT (Listening, Reading, Writing, Speaking)
   Full-width workspace + right-hand IELTS Navigator
   ------------------------------------------------------------ */
@media (min-width: 1101px) {
  #view-ielts-exam .layout {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 280px !important;
    gap: 24px !important;
    justify-content: stretch !important;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
  }

  body.ielts-nav-collapsed #view-ielts-exam .layout,
  #view-ielts-exam.ielts-nav-collapsed .layout {
    grid-template-columns: minmax(0, 1fr) 52px !important;
  }

  /* Main examination workspace occupies full available width without dead space */
  #view-ielts-exam .exam-content {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  #view-ielts-exam .ielts-tabbar {
    width: 100% !important;
    max-width: 100% !important;
  }

  #view-ielts-exam .ielts-pane,
  #view-ielts-exam .ielts-pane[data-pane="listening"],
  #view-ielts-exam .ielts-pane[data-pane="reading"],
  #view-ielts-exam .ielts-pane[data-pane="writing"],
  #view-ielts-exam .ielts-pane[data-pane="speaking"] {
    width: 100% !important;
    max-width: 100% !important;
    padding-inline-start: 0 !important;
    padding-inline-end: 0 !important;
  }

  #view-ielts-exam .ielts-audio-player {
    width: 100% !important;
    max-width: 100% !important;
  }

  #view-ielts-exam .ielts-qblock,
  #view-ielts-exam .ielts-notes,
  #view-ielts-exam .ielts-table-wrap,
  #view-ielts-exam .ielts-table {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Writing editor takes full comfortable responsive width */
  #view-ielts-exam .ielts-task-box,
  #view-ielts-exam .ielts-task-textarea {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Speaking cards take full responsive width */
  #view-ielts-exam .speaking-part-box {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Ensure collapsed navigator hides the embedded vocabulary mount cleanly */
body.ielts-nav-collapsed #ieltsNavigator .ielts-nav-vocab-mount,
#view-ielts-exam.ielts-nav-collapsed #ieltsNavigator .ielts-nav-vocab-mount,
body.ielts-nav-collapsed #ieltsNavVocabMount,
#view-ielts-exam.ielts-nav-collapsed #ieltsNavVocabMount {
  display: none !important;
}

/* Obsolete left sidebar elimination safeguard */
#ieltsVocabBankPanel,
.ielts-vocab-panel {
  display: none !important;
}

/* ------------------------------------------------------------
   2. UNIVERSAL NAVIGATOR VOCABULARY WIDGET (Inside #ieltsNavigator)
   Used across Listening, Reading, Writing & Speaking
   Positioned directly below TIME YOURSELF and above performance card
   ------------------------------------------------------------ */
.ielts-nav-vocab-mount {
  width: 100%;
  box-sizing: border-box;
}

.ielts-nav-vocab-card {
  background: rgba(12, 24, 22, 0.75);
  border: 1px solid rgba(0, 245, 196, 0.25);
  border-radius: 12px;
  padding: 12px 10px;
  margin: 10px 0 14px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.ielts-nav-vocab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.ielts-nav-vocab-title {
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #00f5c4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* Word Count Pill (Interactive Modal Trigger) — matches universal dark-emerald pill */
#ieltsNavigator .ielts-vb-count-pill,
.ielts-vb-count-pill {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 4px 10px !important;
  border-radius: 999px !important;
  font-family: var(--font-body, system-ui, sans-serif) !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  letter-spacing: 0.03em !important;
  color: #00f5c4 !important;
  background: rgba(0, 245, 196, 0.14) !important;
  border: 1px solid rgba(0, 245, 196, 0.36) !important;
  box-shadow: none !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease !important;
}

#ieltsNavigator .ielts-vb-count-pill:hover,
#ieltsNavigator .ielts-vb-count-pill:focus-visible,
.ielts-vb-count-pill:hover,
.ielts-vb-count-pill:focus-visible {
  background: rgba(0, 245, 196, 0.24) !important;
  color: #00f5c4 !important;
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(0, 245, 196, 0.28) !important;
  outline: none;
}

.ielts-nav-vocab-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.ielts-vb-input-row {
  display: flex;
  gap: 6px;
  width: 100%;
}

.ielts-vb-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(6, 14, 12, 0.8);
  border: 1px solid rgba(0, 245, 196, 0.3);
  color: #ffffff;
  font-size: 12px;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ielts-vb-input:focus {
  outline: none;
  border-color: #00f5c4;
  box-shadow: 0 0 10px rgba(0, 245, 196, 0.35);
}

.ielts-vb-input-sub {
  width: 100%;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  background: rgba(6, 14, 12, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cde0dc;
  font-size: 11px;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.ielts-vb-input-sub:focus {
  outline: none;
  border-color: rgba(0, 245, 196, 0.6);
  box-shadow: 0 0 8px rgba(0, 245, 196, 0.2);
}

#ieltsNavigator .ielts-vb-add-btn,
.ielts-vb-add-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0 !important;
  border-radius: 8px !important;
  background: linear-gradient(135deg, #00f5c4, #10b981) !important;
  border: 1px solid #00f5c4 !important;
  color: #04120f !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 8px rgba(0, 245, 196, 0.25) !important;
  flex-shrink: 0 !important;
}

#ieltsNavigator .ielts-vb-add-btn:hover,
.ielts-vb-add-btn:hover {
  filter: brightness(1.12);
  color: #04120f !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 245, 196, 0.45) !important;
}

@media (max-width: 1024px) {
  .ielts-vb-input,
  .ielts-vb-input-sub {
    font-size: 16px !important;
    min-height: 44px !important;
    height: auto !important;
    padding: 8px 10px !important;
  }
  .ielts-vb-add-btn {
    min-width: 44px !important;
    min-height: 44px !important;
  }
}

/* ------------------------------------------------------------
   3. POPUP MODAL (My IELTS Vocabulary Bank)
   Accessible dialog with search, inline editing, delete & sync status
   ------------------------------------------------------------ */
.ielts-vocab-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  background: rgba(3, 7, 6, 0.88);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.ielts-vocab-modal-dialog {
  background: #081210;
  border: 1px solid rgba(0, 245, 196, 0.35);
  border-radius: 20px;
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75), 0 0 32px rgba(0, 245, 196, 0.15);
  overflow: hidden;
  box-sizing: border-box;
}

.ielts-vocab-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid rgba(0, 245, 196, 0.15);
  background: rgba(14, 28, 25, 0.6);
}

.ielts-vb-eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #00f5c4;
  margin-bottom: 4px;
}

.ielts-vocab-modal-title {
  margin: 0;
  font-family: var(--font-display, var(--font-body, system-ui, sans-serif));
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
}

.ielts-vocab-modal-subtitle {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: #94a8a2;
}

.ielts-vocab-modal-head-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.ielts-vocab-modal-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cde0dc;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ielts-vocab-modal-close:hover {
  background: rgba(255, 110, 133, 0.2);
  border-color: #ff6e85;
  color: #ff8fa0;
}

/* Modal Search Tools */
.ielts-vocab-modal-tools {
  padding: 14px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(10, 22, 19, 0.4);
}

.ielts-vocab-search-wrap {
  position: relative;
  width: 100%;
}

.ielts-vocab-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
  opacity: 0.6;
}

.ielts-vb-modal-search {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  border-radius: 10px;
  background: rgba(5, 12, 10, 0.7);
  border: 1px solid rgba(0, 245, 196, 0.2);
  color: #ffffff;
  font-size: 13px;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.ielts-vb-modal-search:focus {
  outline: none;
  border-color: #00f5c4;
  box-shadow: 0 0 12px rgba(0, 245, 196, 0.25);
}

/* Modal Quick Add Form */
.ielts-vocab-modal-add-form {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 8px;
  padding: 12px 24px;
  background: rgba(12, 26, 23, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  align-items: center;
}

@media (max-width: 680px) {
  .ielts-vocab-modal-add-form {
    grid-template-columns: 1fr;
  }
}

.ielts-vb-add-cta {
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, #00f5c4, #10b981);
  border: 1px solid rgba(0, 245, 196, 0.6);
  color: #020907;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.ielts-vb-add-cta:hover {
  filter: brightness(1.15);
  box-shadow: 0 2px 12px rgba(0, 245, 196, 0.4);
}

/* Modal List Body */
.ielts-vocab-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
}

.ielts-vocab-modal-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ielts-vocab-item-card {
  background: rgba(14, 28, 25, 0.65);
  border: 1px solid rgba(0, 245, 196, 0.16);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ielts-vocab-item-card:hover {
  background: rgba(16, 32, 28, 0.85);
  border-color: rgba(0, 245, 196, 0.35);
}

.ielts-vocab-item-card.is-editing {
  border-color: #00f5c4;
  background: rgba(10, 22, 19, 0.95);
}

.ielts-vocab-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ielts-vocab-term-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ielts-vocab-term-text {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.ielts-vocab-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ielts-vocab-source-badge {
  font-size: 10px;
  font-weight: 700;
  color: #00f5c4;
  background: rgba(0, 245, 196, 0.12);
  border: 1px solid rgba(0, 245, 196, 0.25);
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ielts-vocab-sync-badge.is-pending {
  font-size: 10px;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.28);
  padding: 2px 7px;
  border-radius: 6px;
}

.ielts-vocab-retry-badge {
  font-size: 10px;
  font-weight: 800;
  color: #ff6e85;
  background: rgba(255, 110, 133, 0.12);
  border: 1px solid rgba(255, 110, 133, 0.35);
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
}

.ielts-vocab-meaning-text {
  margin: 2px 0 0;
  font-size: 13px;
  color: #d8e8e4;
  line-height: 1.45;
}

.ielts-vocab-note-text {
  margin: 2px 0 0;
  font-size: 12px;
  color: #94a8a2;
  line-height: 1.4;
}

.ielts-vocab-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ielts-vocab-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a8a2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ielts-vocab-icon-btn:hover {
  background: rgba(0, 245, 196, 0.15);
  border-color: #00f5c4;
  color: #00f5c4;
}

.ielts-vocab-icon-btn.delete-btn:hover {
  background: rgba(255, 110, 133, 0.18);
  border-color: #ff6e85;
  color: #ff8fa0;
}

/* Inline Edit Form */
.ielts-vocab-edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.ielts-vocab-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ielts-vocab-field label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #00f5c4;
}

.ielts-vb-edit-term,
.ielts-vb-edit-meaning,
.ielts-vb-edit-note {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  background: rgba(5, 12, 10, 0.9);
  border: 1px solid rgba(0, 245, 196, 0.3);
  color: #ffffff;
  font-size: 12.5px;
  box-sizing: border-box;
}

.ielts-vocab-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.ielts-vocab-save-edit-btn {
  padding: 6px 14px;
  border-radius: 6px;
  background: #00f5c4;
  border: 1px solid #00f5c4;
  color: #04120e;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.ielts-vocab-cancel-edit-btn {
  padding: 6px 14px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 12px;
  cursor: pointer;
}

/* Empty State */
.ielts-vocab-modal-empty {
  padding: 36px 20px;
  text-align: center;
  color: #94a8a2;
}

.ielts-vocab-empty-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
}

/* Modal Footer */
.ielts-vocab-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 20, 18, 0.6);
}

.ielts-vocab-modal-note {
  font-size: 11.5px;
  color: #94a8a2;
}

.ielts-vocab-modal-done-btn {
  padding: 8px 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ielts-vocab-modal-done-btn:hover {
  background: rgba(0, 245, 196, 0.15);
  border-color: #00f5c4;
  color: #00f5c4;
}

/* Toast */
.ielts-vocab-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: rgba(12, 26, 23, 0.95);
  border: 1px solid rgba(0, 245, 196, 0.4);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 100000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.ielts-vocab-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.ielts-vocab-toast.is-error {
  border-color: #ff6e85;
  color: #ff8fa0;
}

/* ------------------------------------------------------------
   4. RESPONSIVE MODAL QUERIES
   ------------------------------------------------------------ */
@media (max-width: 640px) {
  .ielts-vocab-modal-dialog {
    max-height: 94vh;
    border-radius: 16px;
  }
  .ielts-vocab-modal-head {
    padding: 16px 18px 12px;
  }
  .ielts-vocab-modal-title {
    font-size: 1.15rem;
  }
  .ielts-vocab-modal-tools,
  .ielts-vocab-modal-add-form,
  .ielts-vocab-modal-body,
  .ielts-vocab-modal-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
}
