/**
 * Centralized Keyboard Shortcuts Modal Styling
 *
 * Ported from scitex-cloud/static/shared/css/components/shortcuts-modal.css
 * Uses workspace semantic color tokens for consistent theming.
 */

/* ============================================================================
 * Modal Overlay
 * ============================================================================ */
.shortcuts-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.shortcuts-modal-overlay.visible {
  opacity: 1;
}

/* ============================================================================
 * Modal Content Container
 * ============================================================================ */
.shortcuts-modal-content {
  background: var(--workspace-bg-elevated);
  border: 1px solid var(--workspace-border-default);
  border-radius: 8px;
  max-width: 720px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ============================================================================
 * Modal Header
 * ============================================================================ */
.shortcuts-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--workspace-bg-secondary);
  border-bottom: 1px solid var(--workspace-border-subtle);
}

.shortcuts-modal-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.shortcuts-modal-header h3 i {
  color: var(--workspace-icon-primary);
  font-size: 14px;
}

/* Context badge */
.shortcuts-context-badge {
  font-size: 11px;
  background: var(--workspace-bg-tertiary);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
}

/* Close button */
.shortcuts-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s ease;
  line-height: 1;
}

.shortcuts-modal-close:hover {
  background: var(--workspace-bg-tertiary);
  color: var(--text-primary);
}

/* ============================================================================
 * Modal Body - Grid Layout
 * ============================================================================ */
.shortcuts-modal-body {
  padding: 16px 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  max-height: calc(80vh - 100px);
  overflow-y: auto;
  background: var(--workspace-bg-primary);
}

/* Scrollbar styling */
.shortcuts-modal-body::-webkit-scrollbar {
  width: 6px;
}

.shortcuts-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.shortcuts-modal-body::-webkit-scrollbar-thumb {
  background: var(--workspace-border-default);
  border-radius: 3px;
}

.shortcuts-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--workspace-border-hover);
}

/* ============================================================================
 * Shortcut Sections
 * ============================================================================ */
.shortcuts-section {
  min-width: 0;
}

.shortcuts-section h4 {
  margin: 0 0 8px 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--workspace-icon-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--workspace-border-subtle);
}

/* ============================================================================
 * Shortcut Rows
 * ============================================================================ */
.shortcut-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* Keyboard key styling */
.shortcut-row kbd,
.shortcuts-modal-content kbd {
  background: var(--workspace-bg-secondary);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  min-width: 54px;
  text-align: center;
  color: var(--text-primary);
  border: 1px solid var(--workspace-border-default);
  white-space: nowrap;
}

/* ============================================================================
 * Modal Footer
 * ============================================================================ */
.shortcuts-modal-footer {
  padding: 10px 18px;
  background: var(--workspace-bg-secondary);
  border-top: 1px solid var(--workspace-border-subtle);
  text-align: center;
}

.shortcuts-hint {
  color: var(--text-muted);
  font-size: 11px;
}

.shortcuts-hint kbd {
  font-size: 10px;
  padding: 1px 4px;
}

/* ============================================================================
 * Responsive Design
 * ============================================================================ */
@media (max-width: 600px) {
  .shortcuts-modal-content {
    max-width: 95%;
    max-height: 90vh;
  }

  .shortcuts-modal-body {
    grid-template-columns: 1fr;
    padding: 12px 14px;
  }

  .shortcuts-modal-header {
    padding: 12px 14px;
  }

  .shortcut-row kbd,
  .shortcuts-modal-content kbd {
    min-width: 48px;
    font-size: 9px;
  }
}

/* ============================================================================
 * Legacy ID-based selectors for backwards compatibility
 * ============================================================================ */

/* Global modal (Alt+/) */
#shortcuts-modal-global {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
