/* ==========================================================================
   DEEPL PRO TRANSLATE - HISTORY, GLOSSARY, MODALS & SETTINGS
   ========================================================================== */

/* ================= MODAL OVERLAYS & BOXES ================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 23, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

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

.modal-subtitle {
  padding: 0 1.5rem;
  margin-top: 0.75rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.title-with-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.badge-pro {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-teal) 100%);
  color: #ffffff;
}

/* ================= LANGUAGE PICKER MODAL ================= */
.lang-modal {
  max-width: 780px;
}

.modal-search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-input);
}

.modal-search-bar svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

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

.lang-modal-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
}

.lang-tab-filter {
  padding: 0.35rem 0.85rem;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.lang-tab-filter:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.lang-tab-filter.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.5rem;
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  max-height: 480px;
}

.lang-grid-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-grid-item:hover {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
  color: var(--accent-primary);
}

.lang-grid-item.selected {
  background: rgba(0, 102, 255, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 700;
}

.lang-flag {
  font-size: 1.15rem;
}

.lang-name-col {
  display: flex;
  flex-direction: column;
}

.lang-native {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ================= HISTORY DRAWER ================= */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 23, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
}

.drawer-overlay.active {
  display: block;
}

.history-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 440px;
  max-width: 90vw;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-drawer.active {
  transform: translateX(0);
}

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

.drawer-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-primary);
  font-weight: 700;
}

.drawer-title svg {
  width: 20px;
  height: 20px;
  color: var(--accent-primary);
}

.drawer-close-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.drawer-close-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.history-controls {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-search input {
  width: 100%;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
}

.history-filter-chips {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chip {
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

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

.chip-action {
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
}

.chip-action.danger {
  margin-left: 0;
  color: var(--accent-danger);
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.history-item {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  transition: all var(--transition-fast);
}

.history-item:hover {
  border-color: var(--border-focus);
}

.history-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-pair-badge {
  font-weight: 700;
  color: var(--accent-primary);
}

.history-text-src {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.history-text-target {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.history-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.history-btn-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.history-btn-icon:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.history-btn-icon.starred {
  color: var(--accent-gold);
}

.history-empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  font-size: 0.9rem;
}

/* ================= GLOSSARY MODAL ================= */
.glossary-form {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-subtle);
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input {
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent-primary);
}

.btn-add-glossary {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  height: 38px;
}

.glossary-list-wrapper {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  max-height: 280px;
}

.glossary-list-wrapper h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.glossary-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.glossary-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.glossary-rule-text {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
}

.glossary-arrow {
  color: var(--accent-teal);
  margin: 0 0.5rem;
  font-weight: 700;
}

.glossary-del-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.glossary-del-btn:hover {
  color: var(--accent-danger);
}

/* ================= SETTINGS MODAL ================= */
.settings-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.setting-group h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-primary);
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.setting-item.column {
  flex-direction: column;
  align-items: flex-start;
}

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

.setting-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.setting-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.setting-input {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  margin-top: 0.35rem;
}

.full-width {
  width: 100%;
}

.custom-select-sm {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.85rem;
}

/* Switch Toggle Slider */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  transition: 0.3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #ffffff;
}

.api-key-config {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.api-key-config small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.settings-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}
