/**
 * Keylogger UI Styles - Cohesive Light Theme
 * 
 * Soft, modern light theme with unified color palette
 * Base: Warm gray scale with blue accents
 */

/* =============================================
   COLOR PALETTE
   =============================================
   Background:     #f3f4f6  (soft page background)
   Surface:        #ffffff  (cards, containers)
   Surface-2:      #f9fafb  (headers, secondary)
   Surface-3:      #f5f5f5  (groups, hover states)
   
   Border:         #e5e7eb  (subtle borders)
   Border-2:       #d1d5db  (input borders)
   
   Text-primary:   #1f2937  (headings, primary)
   Text-secondary: #4b5563  (body text)
   Text-muted:     #6b7280  (labels, hints)
   Text-subtle:    #9ca3af  (placeholders)
   
   Accent-blue:    #3b82f6  (primary actions)
   Accent-green:   #10b981  (success, active)
   Accent-amber:   #f59e0b  (warnings)
   Accent-red:     #ef4444  (danger, stop)
   ============================================= */

/* Keylog Container */
#keylog-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #ffffff;
  color: #1f2937;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

/* Header */
#keylog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

#keylog-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.keylog-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #4b5563;
}

.keylog-status.active::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.keylog-status.inactive::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.keylog-app {
  font-size: 12px;
  color: #4b5563;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
}

/* Controls */
#keylog-controls {
  display: flex;
  gap: 8px;
}

#keylog-controls .btn {
  padding: 6px 14px;
  font-size: 13px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

#keylog-controls .btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

#keylog-controls .btn-success {
  background: #10b981;
  color: white;
}

#keylog-controls .btn-danger {
  background: #ef4444;
  color: white;
}

#keylog-controls .btn-secondary {
  background: #3b82f6;
  color: white;
}

/* Keystrokes Display */
#keylog-keystrokes {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  background: #f3f4f6;
}

/* Keystroke Group */
.keylog-group {
  margin-bottom: 16px;
  padding: 12px;
  background: #ffffff;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  border-left: 3px solid #3b82f6;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.keylog-group:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  border-left-color: #3b82f6;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Group Header */
.keylog-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f3f4f6;
}

.keylog-time {
  font-size: 11px;
  color: #6b7280;
  font-family: monospace;
}

.keylog-app-tag {
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
}

.keylog-url {
  font-size: 12px;
  cursor: help;
  color: #3b82f6;
}

/* Group Content */
.keylog-content {
  white-space: pre-wrap;
  word-break: break-word;
  color: #1f2937;
  font-size: 13px;
  line-height: 1.7;
  min-height: 20px;
}

/* Special key styling within content */
.keylog-content .special-key {
  color: #d97706;
  font-weight: 500;
}

/* Empty state */
.keylog-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #6b7280;
  font-size: 14px;
}

.keylog-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Scrollbar styling */
#keylog-keystrokes::-webkit-scrollbar {
  width: 8px;
}

#keylog-keystrokes::-webkit-scrollbar-track {
  background: #f3f4f6;
}

#keylog-keystrokes::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

#keylog-keystrokes::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Export dropdown */
.keylog-export-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 100;
  min-width: 120px;
}

.keylog-export-menu button {
  display: block;
  width: 100%;
  padding: 8px 12px;
  text-align: left;
  background: none;
  border: none;
  color: #1f2937;
  font-size: 13px;
  cursor: pointer;
}

.keylog-export-menu button:hover {
  background: #f9fafb;
}

/* Stats panel */
.keylog-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  padding: 12px 16px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.keylog-stat {
  text-align: center;
}

.keylog-stat-value {
  font-size: 20px;
  font-weight: 600;
  color: #3b82f6;
}

.keylog-stat-label {
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Responsive */
@media (max-width: 768px) {
  #keylog-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  #keylog-controls {
    width: 100%;
    justify-content: flex-end;
  }
  
  .keylog-group {
    padding: 10px;
  }
  
  #keylog-keystrokes {
    padding: 12px;
    font-size: 12px;
  }
}

/* Syntax highlighting for special characters */
.keylog-content .newline {
  color: #10b981;
  font-style: italic;
}

.keylog-content .tab {
  color: #f59e0b;
}

.keylog-content .control-char {
  color: #ef4444;
}

/* Search match highlighting */
mark.keylog-match {
  background: rgba(250, 204, 21, 0.35);
  color: #92400e;
  padding: 1px 2px;
  border-radius: 2px;
}

/* Search bar styling */
#keylog-search-bar .input-group-text {
  font-size: 12px;
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #6b7280;
}

#keylog-search {
  border-color: #d1d5db;
  background: #ffffff;
  color: #1f2937;
}

#keylog-search:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  background: #ffffff;
}

#keylog-search::placeholder {
  color: #9ca3af;
}

/* Stats bar */
#keylog-stats {
  padding: 6px 12px;
  background: #f9fafb;
  border-radius: 6px;
  font-family: 'SF Mono', Monaco, monospace;
  border: 1px solid #e5e7eb;
  color: #4b5563;
}

#keylog-stats span {
  white-space: nowrap;
}

/* Run selector */
#keylog-run-selector {
  font-size: 13px;
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f9fafb;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

#keylog-run-selector label {
  color: #4b5563;
  font-weight: 500;
  white-space: nowrap;
}

#keylog-run-select {
  font-size: 12px;
  font-family: 'SF Mono', Monaco, monospace;
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 6px 28px 6px 10px;
  cursor: pointer;
  appearance: menulist;
  -webkit-appearance: menulist;
  min-width: 200px;
}

#keylog-run-select:hover {
  border-color: #9ca3af;
  background: #f9fafb;
}

#keylog-run-select:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  outline: none;
}

/* Dropdown options styling for light theme */
#keylog-run-select option {
  background: #ffffff;
  color: #1f2937;
  padding: 8px;
}

#keylog-run-select option:hover,
#keylog-run-select option:focus {
  background: #f9fafb;
}

#keylog-run-info {
  color: #9ca3af;
  font-size: 11px;
}

/* Dropdown menus - light theme */
#keylog-tab .dropdown-menu {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#keylog-tab .dropdown-item {
  color: #1f2937;
  font-size: 13px;
  padding: 8px 16px;
}

#keylog-tab .dropdown-item:hover,
#keylog-tab .dropdown-item:focus {
  background: #f9fafb;
  color: #1f2937;
}

#keylog-tab .dropdown-divider {
  border-top: 1px solid #e5e7eb;
}

#keylog-tab .dropdown-toggle::after {
  margin-left: 6px;
}

/* History panel */
#keylog-history-panel {
  border-top: 1px solid #e5e7eb;
  padding-top: 16px;
}

#keylog-history-panel h5 {
  color: #1f2937;
  font-size: 15px;
  font-weight: 600;
}

#keylog-history-list .list-group-item {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #1f2937;
  transition: all 0.15s;
}

#keylog-history-list .list-group-item:hover {
  background: #f9fafb !important;
  border-color: #d1d5db;
}

#keylog-history-list .list-group-item .badge {
  font-size: 10px;
  padding: 2px 6px;
}

#keylog-history-detail-content .keylog-group {
  background: #ffffff;
  border-color: #e5e7eb;
  border-left-color: #3b82f6;
}

#keylog-history-detail-content .keylog-group:last-child {
  margin-bottom: 0;
}
