/* ═══════════════════════════════════════
   WORD LIBRARY — Premium Vocabulary Module
   ═══════════════════════════════════════ */

/* ─── Page Header ───────────────────── */
.wl-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.wl-page-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 4px;
}

/* ─── Stats Bar ─────────────────────── */
.wl-stats-bar {
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.wl-stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-light);
  box-shadow: var(--shadow-xs);
}

.wl-stat-pill strong {
  font-size: 18px;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.02em;
}

.wl-stat-pill.wl-stat-warning strong { color: var(--warning); }
.wl-stat-pill.wl-stat-success strong { color: var(--success); }
.wl-stat-pill.wl-stat-danger strong { color: var(--danger); }

/* ─── Toolbar ───────────────────────── */
.wl-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.wl-toolbar .form-search {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.wl-toolbar select.form-control {
  width: auto;
  min-width: 140px;
  height: 40px;
  font-size: 12px;
}

.wl-toolbar .button {
  height: 40px;
}

/* ─── Table Enhancements ────────────── */
.wl-table .data-table td {
  vertical-align: middle;
}

.wl-word-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wl-word-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-alt);
  flex-shrink: 0;
  border: 1px solid var(--line);
}

.wl-word-thumb-placeholder {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
  border: 1px solid transparent;
}

.wl-word-info strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.wl-word-info .wl-ipa {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

.wl-pos-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--brand-soft);
  color: var(--brand);
  text-transform: uppercase;
}

.wl-pos-noun { background: #EEF2FF; color: #4F46E5; }
.wl-pos-verb { background: #FEF2F2; color: #DC2626; }
.wl-pos-adjective { background: #FEFCE8; color: #CA8A04; }
.wl-pos-adverb { background: #F0FDF4; color: #16A34A; }
.wl-pos-pronoun { background: #FFF7ED; color: #EA580C; }
.wl-pos-preposition { background: #F5F3FF; color: #7C3AED; }
.wl-pos-conjunction { background: #ECFDF5; color: #059669; }
.wl-pos-interjection { background: #FDF2F8; color: #DB2777; }

.wl-usage-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.wl-action-group {
  display: flex;
  gap: 4px;
  align-items: center;
}

.wl-action-group .icon-button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.wl-action-group .icon-button svg {
  width: 15px;
  height: 15px;
}

/* ─── Empty State ───────────────────── */
.wl-empty {
  text-align: center;
  padding: 64px 24px;
}

.wl-empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: var(--radius-xl);
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wl-empty-icon svg {
  width: 32px;
  height: 32px;
}

.wl-empty h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.wl-empty p {
  font-size: 12px;
  color: var(--muted);
  max-width: 380px;
  margin: 0 auto 18px;
  line-height: 1.5;
}

/* ─── Modal Overlay ─────────────────── */
.wl-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.wl-modal-overlay.is-open {
  display: flex;
}

.wl-modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
}

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

.wl-modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.wl-modal-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.wl-modal-close:hover {
  background: var(--bg-alt);
  color: var(--ink);
}

.wl-modal .form-group {
  margin-bottom: 16px;
}

.wl-modal .form-control {
  height: 42px;
  font-size: 13px;
}

.wl-modal textarea.form-control {
  min-height: 80px;
}

.wl-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.wl-form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

/* ─── Upload Area ───────────────────── */
.wl-upload-area {
  border: 2px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  background: var(--surface-2);
}

.wl-upload-area:hover {
  border-color: var(--brand);
  background: var(--brand-ghost);
}

.wl-upload-area.has-file {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-soft);
  padding: 12px;
}

.wl-upload-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 8px;
  color: var(--muted);
}

.wl-upload-area.has-file .wl-upload-icon {
  display: none;
}

.wl-upload-text {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.wl-upload-text strong {
  color: var(--brand);
}

.wl-upload-preview {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wl-upload-preview img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.wl-upload-preview audio {
  height: 36px;
  flex: 1;
}

.wl-upload-info {
  flex: 1;
  min-width: 0;
}

.wl-upload-info strong {
  display: block;
  font-size: 12px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wl-upload-info small {
  font-size: 10px;
  color: var(--muted);
}

.wl-upload-remove {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: var(--danger-soft);
  color: var(--danger);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* ─── Detail Page ───────────────────── */
.wl-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.wl-detail-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.wl-detail-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-xs);
}

.wl-detail-card h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wl-detail-card h3 svg {
  width: 18px;
  height: 18px;
  color: var(--brand);
}

/* Word Hero */
.wl-word-hero {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.wl-word-hero-img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.wl-word-hero-img-placeholder {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
  flex-shrink: 0;
}

.wl-word-hero-info h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 2px;
}

.wl-word-hero-ipa {
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 6px;
}

.wl-word-hero-meaning {
  font-size: 14px;
  color: var(--ink-light);
  line-height: 1.5;
}

/* Detail rows */
.wl-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-light);
  gap: 12px;
}

.wl-detail-row:last-child {
  border-bottom: none;
}

.wl-detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.wl-detail-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-align: right;
  line-height: 1.4;
}

/* Usage list */
.wl-usage-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wl-usage-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-light);
  font-size: 12px;
}

.wl-usage-item:last-child {
  border-bottom: none;
}

.wl-usage-breadcrumb {
  color: var(--muted);
  font-size: 11px;
}

.wl-usage-breadcrumb span {
  color: var(--ink);
  font-weight: 600;
}

.wl-usage-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--brand);
  margin-left: auto;
  flex-shrink: 0;
}

/* Topic tags */
.wl-topic-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wl-topic-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-alt);
  color: var(--ink-light);
  border: 1px solid var(--line);
}

.wl-topic-tag .wl-topic-remove {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  border: none;
}

/* Topic select in form */
.wl-topic-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 160px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.wl-topic-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background var(--duration-fast) var(--ease-out);
}

.wl-topic-checkbox:hover {
  background: var(--bg-alt);
}

.wl-topic-checkbox input {
  accent-color: var(--brand);
}

/* Status badges */
.wl-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.wl-status-active {
  background: var(--success-soft);
  color: var(--success);
}

.wl-status-archived {
  background: var(--danger-soft);
  color: var(--danger);
}

.wl-status-draft {
  background: var(--warning-soft);
  color: var(--warning);
}

/* ─── Pagination ────────────────────── */
.wl-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.wl-pagination .button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 11px;
}

.wl-pagination .wl-page-current {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 0 8px;
}

/* ─── Toast / Alert ─────────────────── */
.wl-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: wlSlideIn 0.3s var(--ease-out);
  max-width: 420px;
}

.wl-toast-success {
  background: var(--success);
  color: #fff;
}

.wl-toast-error {
  background: var(--danger);
  color: #fff;
}

.wl-toast-info {
  background: var(--brand);
  color: #fff;
}

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

/* ─── Quick View Side Panel ─────────── */
.wl-quick-view-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 90;
}

.wl-quick-view-overlay.is-open {
  display: block;
}

.wl-quick-view-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  z-index: 91;
  padding: 24px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--duration-normal) var(--ease-out);
}

.wl-quick-view-panel.is-open {
  transform: translateX(0);
}

/* ─── Inline Audio Player ───────────── */
.wl-audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  background: var(--brand-soft);
  color: var(--brand);
  cursor: pointer;
  border: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.wl-audio-btn:hover {
  background: var(--brand);
  color: #fff;
}

.wl-audio-btn svg {
  width: 14px;
  height: 14px;
}

/* ─── Duplicate Alert ───────────────── */
.wl-duplicate-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.wl-duplicate-alert svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════
   IMAGE IMPORT (single page)
   ═══════════════════════════════════════ */
.wli-drop {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  margin-bottom: 16px;
}

.wli-drop:hover,
.wli-drop.is-over {
  border-color: var(--brand);
  background: var(--brand-ghost);
}

.wli-drop input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.wli-drop-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 10px;
  color: var(--brand);
}

.wli-drop-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.wli-drop-title strong { color: var(--brand); }

.wli-drop-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* Sticky toolbar */
.wli-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.wli-summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-light);
}

.wli-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Synchronized top scrollbar */
.wli-scroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  height: 14px;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--surface-2);
}

.wli-scroll-top > div { height: 1px; }

.wli-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 70vh;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: var(--surface);
}

.wli-table { min-width: 1120px; }

.wli-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface-2);
}

.wli-table td { vertical-align: middle; font-size: 12px; }

.wli-thumb {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-alt);
  display: block;
}

.wli-file { color: var(--muted); word-break: break-all; }
.wli-ipa { font-style: italic; color: var(--ink-light); }
.wli-example { color: var(--ink-light); }

.wli-badge {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--bg-alt);
  color: var(--ink-light);
}

.wli-badge-pending { background: var(--bg-alt); color: var(--muted); }
.wli-badge-working { background: var(--brand-soft); color: var(--brand); }
.wli-badge-created { background: var(--success-soft); color: var(--success); }
.wli-badge-update  { background: var(--warning-soft); color: var(--warning); }
.wli-badge-skipped { background: var(--bg-alt); color: var(--muted); }
.wli-badge-error   { background: var(--danger-soft); color: var(--danger); }

/* Result popup rows */
.wli-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-light);
  font-size: 13px;
}

.wli-result-row:last-child { border-bottom: none; }
.wli-result-row strong { font-size: 15px; color: var(--brand); }

/* ─── Responsive ────────────────────── */
@media (max-width: 1024px) {
  .wl-detail-grid {
    grid-template-columns: 1fr;
  }

  .wl-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .wl-toolbar .form-search {
    max-width: none;
  }

  .wl-toolbar select.form-control {
    width: 100%;
    min-width: auto;
  }
}

@media (max-width: 640px) {
  .wl-page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .wl-stats-bar {
    flex-direction: column;
  }

  .wl-form-row,
  .wl-form-row-3 {
    grid-template-columns: 1fr;
  }

  .wl-word-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .wl-quick-view-panel {
    width: 100vw;
    max-width: 100vw;
  }

  .wl-modal {
    padding: 20px;
    max-width: 95vw;
  }

  .wl-table .data-table th:nth-child(3),
  .wl-table .data-table td:nth-child(3),
  .wl-table .data-table th:nth-child(5),
  .wl-table .data-table td:nth-child(5),
  .wl-table .data-table th:nth-child(6),
  .wl-table .data-table td:nth-child(6) {
    display: none;
  }
}
.wl-play-btn{

    width:30px;

    height:30px;

    border:none;

    border-radius:50%;

    cursor:pointer;

    background:#eef4ff;

    font-size:16px;

}

.wl-play-btn:hover{

    background:#dbeafe;

}
.wl-topic-list{

    display:inline-block;

    padding:3px 10px;

    border-radius:999px;

    background:#eef4ff;

    color:#2563eb;

    font-size:12px;

    font-weight:600;

}
.wl-topic-actions{

    display:flex;

    gap:18px;

    margin-bottom:12px;

    font-size:13px;

}

.wl-topic-actions a{

    color:#2563eb;

    text-decoration:none;

    font-weight:600;

}

.wl-topic-actions a:hover{

    text-decoration:underline;

}