/* Modal Components - Overlays, Modal Dialogs */

/* Vocab Detail Overlay */
.vocab-detail-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1300;
}

.vocab-detail-overlay[hidden] {
  display: none;
}

.detail-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 2px solid #ffffff;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  font-size: 20px;
  cursor: pointer;
  color: #ffffff;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  box-shadow: 0 3px 15px rgba(239, 68, 68, 0.6), 0 0 0 4px rgba(239, 68, 68, 0.15);
  font-weight: 800;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.detail-close-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.5), 0 0 0 4px rgba(239, 68, 68, 0.12);
}

.detail-close-btn:active {
  transform: scale(0.92);
}

.detail-close-btn:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.45);
  outline-offset: 3px;
}

.dict-lang-toggle {
  display: inline-flex;
  align-self: flex-start;
  border: 1px solid rgba(226, 232, 240, 1);
  border-radius: 999px;
  overflow: hidden;
  background: #f8fafc;
  height: 40px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.dict-lang-toggle button {
  border: none;
  background: transparent;
  padding: 0 18px;
  font-weight: 800;
  font-size: 14px;
  color: #475569;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  min-width: 56px;
  line-height: 1;
  touch-action: manipulation;
}

.dict-lang-toggle button.active {
  background: #0f766e;
  color: #ffffff;
}

.vocab-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
}

.vocab-detail-card {
  position: relative;
  width: min(520px, 100%);
  max-height: 88vh;
  background: #ffffff;
  border-radius: 18px 18px 0 0;
  padding: 20px 20px 24px;
  box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.25);
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: vocab-detail-slide-up 0.25s ease;
  overflow: visible;
}

/* PC端适配：居中显示，更大的宽度 */
@media (min-width: 768px) {
  .vocab-detail-overlay {
    align-items: center;
  }

  .vocab-detail-card {
    width: min(800px, 90vw);
    max-height: 90vh;
    border-radius: 18px;
    padding: 24px 28px;
  }
}

@keyframes vocab-detail-slide-up {
  from {
    transform: translateY(60px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-word {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.detail-translation {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.detail-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
  align-self: flex-start;
}

.detail-status.new {
  background: #e3f2fd;
  color: #1976d2;
}

.detail-status.learning {
  background: #fff9e6;
  color: #ff9800;
}

.detail-status.reviewing {
  background: #ede9fe;
  color: #5b21b6;
}

.detail-status.mastered {
  background: #e8f5e9;
  color: #4caf50;
}

.detail-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* 字典卡片内容区域 - 可滚动 */
#detail-dict-card,
#review-dict-card {
  overflow-y: auto;
  max-height: 50vh;
  padding-right: 4px;
}

/* PC端：更大的滚动区域 */
@media (min-width: 768px) {
  #detail-dict-card,
  #review-dict-card {
    max-height: 60vh;
  }

  .detail-contexts {
    max-height: 55vh !important;
  }
}

.detail-contexts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 45vh;
  padding-right: 4px;
}

/* 美化滚动条 */
#detail-dict-card::-webkit-scrollbar,
#review-dict-card::-webkit-scrollbar,
.detail-contexts::-webkit-scrollbar {
  width: 6px;
}

#detail-dict-card::-webkit-scrollbar-track,
#review-dict-card::-webkit-scrollbar-track,
.detail-contexts::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

#detail-dict-card::-webkit-scrollbar-thumb,
#review-dict-card::-webkit-scrollbar-thumb,
.detail-contexts::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

#detail-dict-card::-webkit-scrollbar-thumb:hover,
#review-dict-card::-webkit-scrollbar-thumb:hover,
.detail-contexts::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.detail-context-item {
  background: rgba(241, 245, 249, 0.85);
  border-radius: 12px;
  padding: 10px 12px;
}

.detail-context-item .context-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.detail-context-item .context-sentence {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.detail-context-empty {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  padding: 12px 0;
}

/* Review overlay actions */
.review-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
