/* ==========================================================================
   COMPONENTS: SEARCH MODAL, DRAWERS, TOASTS, TOOLTIPS & CHARTS
   ========================================================================== */

/* Command Search Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(13, 19, 33, 0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5rem 1rem 2rem 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

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

.search-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  transform: translateY(-20px);
  transition: transform 0.2s ease;
}

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

.search-modal-header {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  gap: 1rem;
}

.search-modal-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 1.15rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
}

.search-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.search-modal-results {
  overflow-y: auto;
  padding: 1rem;
  max-height: 450px;
}

.search-category-group {
  margin-bottom: 1rem;
}

.search-category-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 0.75rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.search-result-item:hover, .search-result-item.selected {
  background-color: var(--bg-surface);
  color: var(--color-secondary);
}

.search-result-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-result-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.search-result-category {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.search-modal-footer {
  padding: 0.75rem 1.5rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.search-modal-shortcuts {
  display: flex;
  gap: 0.75rem;
}

.search-modal-shortcuts kbd {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
}

/* Slideout Drawer (History / Favorites) */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(13, 19, 33, 0.6);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

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

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  z-index: 2001;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.drawer-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.drawer-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: var(--transition);
  text-decoration: none;
}

.drawer-item:hover {
  border-color: var(--color-secondary);
}

.drawer-item-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.drawer-item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

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

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  background: var(--color-primary);
  color: #FFFFFF;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  pointer-events: auto;
  animation: toastSlideUp 0.3s ease forwards;
}

[data-theme="dark"] .toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
}

@keyframes toastSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Chart Canvas & SVG Styles */
.chart-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-donut-segment {
  transition: stroke-width 0.2s ease, opacity 0.2s ease;
  cursor: pointer;
}

.chart-donut-segment:hover {
  opacity: 0.85;
  stroke-width: 22;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
