/**
 * Global Search Modal Styles
 * Version: 2026.1.7
 */

.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.search-modal.hidden {
  display: none;
}

.search-modal.active {
  opacity: 1;
  pointer-events: all;
}

.search-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.search-container {
  position: relative;
  width: 90%;
  max-width: 640px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transform: translateY(-20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-modal.active .search-container {
  transform: translateY(0);
}

/* Header */
.search-header {
  padding: 20px;
  border-bottom: 1px solid #e2e8f0;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f8fafc;
  border: 2px solid transparent;
  border-radius: 12px;
  transition: all 0.2s;
}

.search-input-wrapper:focus-within {
  background: white;
  border-color: #00488d;
  box-shadow: 0 0 0 4px rgba(0, 72, 141, 0.1);
}

.search-icon {
  flex-shrink: 0;
  color: #64748b;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  color: #0f172a;
  outline: none;
}

.search-input::placeholder {
  color: #94a3b8;
}

.search-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}

.search-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* Filters */
.search-filters {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.filter-btn {
  padding: 6px 12px;
  font-size: 14px;
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}

.filter-btn.active {
  background: #00488d;
  border-color: #00488d;
  color: white;
}

/* Content */
.search-content {
  max-height: 50vh;
  overflow-y: auto;
  padding: 8px;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.search-result-item:hover,
.search-result-item.selected {
  background: #f8fafc;
}

.search-result-item.selected {
  background: #eff6ff;
  border-left: 3px solid #00488d;
}

.result-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
}

.search-result-item[data-type="student"] .result-icon {
  background: #dbeafe;
  color: #3b82f6;
}

.search-result-item[data-type="infringement"] .result-icon {
  background: #fee2e2;
  color: #ef4444;
}

.search-result-item[data-type="affirmation"] .result-icon {
  background: #d1fae5;
  color: #10b981;
}

.result-content {
  flex: 1;
  min-width: 0;
}

.result-title {
  font-size: 14px;
  font-weight: 500;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-meta {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Empty state */
.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: #94a3b8;
}

.search-empty svg {
  margin-bottom: 16px;
  opacity: 0.5;
}

.search-empty p {
  font-size: 14px;
  margin: 0;
}

/* Default state */
.search-default {
  padding: 12px;
}

.search-section {
  margin-bottom: 24px;
}

.search-section:last-child {
  margin-bottom: 0;
}

.search-section h3 {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 12px 0;
}

.recent-item {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: #0f172a;
  cursor: pointer;
  transition: background 0.2s;
}

.recent-item:hover {
  background: #f8fafc;
}

.empty-state {
  font-size: 13px;
  color: #94a3b8;
  margin: 0;
  padding: 12px;
  text-align: center;
}

/* Footer */
.search-footer {
  padding: 12px 20px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.search-hint {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #64748b;
}

.search-hint span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-hint kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  font-size: 11px;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Scrollbar */
.search-content::-webkit-scrollbar {
  width: 8px;
}

.search-content::-webkit-scrollbar-track {
  background: transparent;
}

.search-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.search-content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Dark mode */
[data-theme="dark"] .search-container {
  background: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .search-header {
  border-color: #334155;
}

[data-theme="dark"] .search-input-wrapper {
  background: #0f172a;
}

[data-theme="dark"] .search-input-wrapper:focus-within {
  background: #1e293b;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .search-input {
  color: #e2e8f0;
}

[data-theme="dark"] .search-input::placeholder {
  color: #64748b;
}

[data-theme="dark"] .search-close:hover {
  background: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .filter-btn {
  border-color: #334155;
  color: #94a3b8;
}

[data-theme="dark"] .filter-btn:hover {
  background: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .filter-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
}

[data-theme="dark"] .search-result-item:hover,
[data-theme="dark"] .search-result-item.selected {
  background: #0f172a;
}

[data-theme="dark"] .result-icon {
  background: #334155;
  color: #94a3b8;
}

[data-theme="dark"] .result-title {
  color: #e2e8f0;
}

[data-theme="dark"] .result-meta {
  color: #94a3b8;
}

[data-theme="dark"] .recent-item:hover {
  background: #334155;
}

[data-theme="dark"] .search-footer {
  border-color: #334155;
  background: #0f172a;
}

[data-theme="dark"] .search-hint kbd {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

/* Responsive */
@media (max-width: 640px) {
  .search-modal {
    padding-top: 20px;
    align-items: flex-start;
  }
  
  .search-container {
    width: 95%;
    max-height: 85vh;
  }
  
  .search-content {
    max-height: 60vh;
  }
  
  .search-filters {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
  
  .search-hint {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* Animations */
@keyframes search-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.search-loading .search-icon {
  animation: search-pulse 1.5s ease-in-out infinite;
}
