/**
 * @fileoverview Styles for the keyboard shortcuts overlay
 * Follows the yaze web UI design system with dark theme support
 */

/* Overlay background */
.yaze-shortcuts-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  animation: yaze-shortcuts-fade-in 0.2s ease-out forwards;
}

@keyframes yaze-shortcuts-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Modal container */
.yaze-shortcuts-modal {
  background-color: var(--bg-app);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  width: 90%;
  max-width: 650px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  transform: translateY(-10px);
  animation: yaze-shortcuts-slide-in 0.2s ease-out forwards;
}

@keyframes yaze-shortcuts-slide-in {
  from {
    transform: translateY(-10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Header */
.yaze-shortcuts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.yaze-shortcuts-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  color: var(--accent-primary);
}

.yaze-shortcuts-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.15s, color 0.15s;
}

.yaze-shortcuts-close:hover {
  background-color: var(--bg-header);
  color: var(--text-primary);
}

/* Search */
.yaze-shortcuts-search {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
}

.yaze-shortcuts-search input {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-header);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.yaze-shortcuts-search input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(14, 99, 156, 0.25);
}

.yaze-shortcuts-search input::placeholder {
  color: var(--text-muted);
}

/* Content area */
.yaze-shortcuts-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* Custom scrollbar */
.yaze-shortcuts-content::-webkit-scrollbar {
  width: 10px;
}

.yaze-shortcuts-content::-webkit-scrollbar-track {
  background: var(--bg-app);
}

.yaze-shortcuts-content::-webkit-scrollbar-thumb {
  background-color: var(--border-light);
  border-radius: 5px;
  border: 2px solid var(--bg-app);
}

.yaze-shortcuts-content::-webkit-scrollbar-thumb:hover {
  background-color: #4e4e52;
}

/* Category section */
.yaze-shortcuts-category {
  padding: 0 20px;
  margin-bottom: 8px;
}

.yaze-shortcuts-category-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--bg-panel);
}

.yaze-shortcuts-category:first-child .yaze-shortcuts-category-header {
  margin-top: 8px;
}

/* Shortcut list */
.yaze-shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Individual shortcut row */
.yaze-shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 4px;
  transition: background-color 0.1s;
}

.yaze-shortcut-row:hover {
  background-color: var(--bg-panel);
}

/* Keyboard keys */
.yaze-shortcut-keys {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.yaze-shortcut-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  background: linear-gradient(180deg, var(--border-light) 0%, var(--bg-panel) 100%);
  border: 1px solid #4e4e52;
  border-radius: 4px;
  box-shadow: 0 2px 0 var(--bg-header);
  color: var(--text-primary);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
}

/* Shortcut description */
.yaze-shortcut-description {
  color: var(--text-primary);
  font-size: 14px;
  text-align: right;
  margin-left: 16px;
}

/* Footer */
.yaze-shortcuts-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  text-align: center;
}

.yaze-shortcuts-footer span {
  color: var(--text-muted);
  font-size: 12px;
}

.yaze-shortcuts-footer kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: linear-gradient(180deg, var(--border-light) 0%, var(--bg-panel) 100%);
  border: 1px solid #4e4e52;
  border-radius: 3px;
  box-shadow: 0 1px 0 var(--bg-header);
  color: var(--text-primary);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  margin: 0 2px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .yaze-shortcuts-modal {
    width: 95%;
    max-height: 90vh;
    border-radius: 12px 12px 0 0;
    position: fixed;
    bottom: 0;
    margin-bottom: 0;
  }

  .yaze-shortcuts-header {
    padding: 14px 16px;
  }

  .yaze-shortcuts-header h2 {
    font-size: 16px;
  }

  .yaze-shortcuts-search {
    padding: 10px 16px;
  }

  .yaze-shortcuts-category {
    padding: 0 16px;
  }

  .yaze-shortcut-row {
    padding: 10px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .yaze-shortcut-description {
    text-align: left;
    margin-left: 0;
    font-size: 13px;
    color: #9e9e9e;
  }

  .yaze-shortcuts-footer {
    padding: 10px 16px;
  }
}

/* Touch-friendly enhancements */
@media (hover: none) and (pointer: coarse) {
  .yaze-shortcut-row {
    padding: 12px;
  }

  .yaze-shortcuts-close {
    width: 44px;
    height: 44px;
  }

  .yaze-shortcuts-search input {
    padding: 14px 16px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .yaze-shortcuts-modal {
    border-width: 2px;
  }

  .yaze-shortcut-keys kbd {
    border-width: 2px;
  }

  .yaze-shortcut-description {
    color: #ffffff;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .yaze-shortcuts-overlay,
  .yaze-shortcuts-modal {
    animation: none;
  }

  .yaze-shortcut-row,
  .yaze-shortcuts-close {
    transition: none;
  }
}

/* Dark mode is default, but support light mode if system prefers */
@media (prefers-color-scheme: light) {
  .yaze-shortcuts-overlay {
    background-color: rgba(0, 0, 0, 0.5);
  }

  .yaze-shortcuts-modal {
    background-color: #ffffff;
    border-color: #d4d4d4;
  }

  .yaze-shortcuts-header {
    border-bottom-color: #e5e5e5;
  }

  .yaze-shortcuts-header h2 {
    color: #0066b8;
  }

  .yaze-shortcuts-close {
    color: #666666;
  }

  .yaze-shortcuts-close:hover {
    background-color: #e5e5e5;
    color: #000000;
  }

  .yaze-shortcuts-search {
    border-bottom-color: #e5e5e5;
  }

  .yaze-shortcuts-search input {
    background-color: #f3f3f3;
    border-color: #d4d4d4;
    color: #333333;
  }

  .yaze-shortcuts-search input:focus {
    border-color: #0066b8;
    box-shadow: 0 0 0 2px rgba(0, 102, 184, 0.2);
  }

  .yaze-shortcuts-search input::placeholder {
    color: #999999;
  }

  .yaze-shortcuts-content::-webkit-scrollbar-track {
    background: #ffffff;
  }

  .yaze-shortcuts-content::-webkit-scrollbar-thumb {
    background-color: #d4d4d4;
    border-color: #ffffff;
  }

  .yaze-shortcuts-content::-webkit-scrollbar-thumb:hover {
    background-color: #b0b0b0;
  }

  .yaze-shortcuts-category-header {
    color: #666666;
    border-bottom-color: #e5e5e5;
  }

  .yaze-shortcut-row:hover {
    background-color: #f0f0f0;
  }

  .yaze-shortcut-keys kbd {
    background: linear-gradient(180deg, #ffffff 0%, #f3f3f3 100%);
    border-color: #d4d4d4;
    box-shadow: 0 2px 0 #e5e5e5;
    color: #333333;
  }

  .yaze-shortcut-description {
    color: #333333;
  }

  .yaze-shortcuts-footer {
    border-top-color: #e5e5e5;
  }

  .yaze-shortcuts-footer span {
    color: #666666;
  }

  .yaze-shortcuts-footer kbd {
    background: linear-gradient(180deg, #ffffff 0%, #f3f3f3 100%);
    border-color: #d4d4d4;
    box-shadow: 0 1px 0 #e5e5e5;
    color: #333333;
  }
}
