/* CSS Variables for Theme */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #0f1419;
  --bg-tertiary: #1a1f2e;
  --bg-card: #1e2433;
  --accent-primary: #00ff88;
  --accent-secondary: #00d4ff;
  --accent-tertiary: #8b5cf6;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-primary: rgba(0, 255, 136, 0.2);
  --border-secondary: rgba(255, 255, 255, 0.1);
  --shadow-primary: 0 0 20px rgba(0, 255, 136, 0.1);
  --shadow-secondary: 0 4px 12px rgba(0, 0, 0, 0.3);
  --glass-bg: rgba(0, 255, 136, 0.05);
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
}

/* Light theme variables */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-tertiary: #e2e8f0;
  --bg-card: #ffffff;
  --accent-primary: #059669;
  --accent-secondary: #0284c7;
  --accent-tertiary: #7c3aed;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-primary: rgba(5, 150, 105, 0.3);
  --border-secondary: rgba(0, 0, 0, 0.1);
  --shadow-primary: 0 0 20px rgba(5, 150, 105, 0.1);
  --glass-bg: rgba(5, 150, 105, 0.05);
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Matrix Background Animation */
.matrix-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 20% 50%, rgba(0, 255, 136, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(0, 212, 255, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
  animation: matrixPulse 6s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: -1;
}

@keyframes matrixPulse {
  0% {
    opacity: 0.3;
    transform: scale(1);
  }
  100% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

/* Header */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-primary);
  box-shadow: var(--shadow-secondary);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--bg-primary);
  box-shadow: var(--shadow-primary);
}

.logo-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}

.subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.version-badge {
  padding: 0.5rem 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--accent-primary);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--accent-primary);
  font-weight: 600;
}

/* Main Container */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 2rem;
  min-height: calc(100vh - 80px);
}

/* Panels */
.search-panel,
.results-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  box-shadow: var(--shadow-primary);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.panel-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
}

.panel-header h2,
.panel-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-actions {
  display: flex;
  gap: 0.5rem;
}

/* Form Styles */
.search-form {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.tooltip {
  width: 16px;
  height: 16px;
  background: var(--accent-secondary);
  color: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: help;
  position: relative;
}

.tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 1000;
  box-shadow: var(--shadow-secondary);
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  transition: all 0.3s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.2);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Custom Pickers */
.date-picker,
.location-picker {
  position: relative;
}

.date-picker input,
.location-picker input {
  cursor: pointer;
}

.date-dropdown,
.location-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 0.25rem;
  z-index: 1000;
  box-shadow: var(--shadow-secondary);
  display: none;
}

.date-dropdown.active,
.location-dropdown.active {
  display: block;
}

.date-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.input-group label {
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
}

.date-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.location-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.location-list {
  max-height: 150px;
  overflow-y: auto;
}

.location-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  background: var(--bg-secondary);
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.location-item:last-child {
  margin-bottom: 0;
}

/* Smart Features */
.smart-features {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border-secondary);
}

.feature-info {
  flex: 1;
}

.feature-info span {
  display: block;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.feature-info small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.proximity-indicator {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--accent-primary);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--accent-primary);
  font-weight: 500;
}

/* Switch Component */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  transition: 0.3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

input:checked + .slider:before {
  transform: translateX(26px);
  background-color: var(--bg-primary);
}

/* Grids */
.source-grid,
.filetype-grid,
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.875rem;
}

.checkbox-item:hover {
  border-color: var(--accent-primary);
  background: var(--glass-bg);
}

.checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-primary);
}

.custom-source {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Advanced Options */
.advanced-options {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-secondary);
}

.advanced-options.active {
  display: block;
}

.advanced-section {
  margin-bottom: 1.5rem;
}

.advanced-section h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-secondary);
  margin-bottom: 0.75rem;
}

/* Buttons */
.btn,
.btn-small,
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
}

.btn-icon {
  padding: 0.5rem;
  width: 36px;
  height: 36px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: var(--bg-primary);
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 255, 136, 0.3);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-secondary);
}

.btn-secondary:hover {
  border-color: var(--accent-primary);
  background: var(--glass-bg);
}

.btn-link {
  background: none;
  color: var(--accent-secondary);
  padding: 0;
  font-size: 0.75rem;
  text-decoration: underline;
}

.btn-link:hover {
  color: var(--accent-primary);
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-secondary);
}

/* Results Panel */
.dork-output {
  padding: 1.5rem;
}

.dork-preview {
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
  padding: 1rem;
  font-family: "Fira Code", monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.dork-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Templates */
.templates-section,
.history-section {
  padding: 1.5rem;
  border-top: 1px solid var(--border-secondary);
}

.templates-section h3,
.history-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.template-grid {
  display: grid;
  gap: 0.75rem;
}

.template-item {
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.template-item:hover {
  border-color: var(--accent-secondary);
  background: var(--glass-bg);
  transform: translateY(-2px);
}

.template-name {
  font-weight: 600;
  color: var(--accent-secondary);
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
}

.template-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* History */
.history-list {
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  padding: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-secondary);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.history-item:hover {
  border-color: var(--accent-primary);
  background: var(--glass-bg);
}

.history-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.history-query {
  font-size: 0.75rem;
  font-family: "Fira Code", monospace;
  word-break: break-all;
  line-height: 1.4;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-secondary);
}

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

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-body {
  padding: 1.5rem;
}

.help-section {
  margin-bottom: 2rem;
}

.help-section h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-secondary);
  margin-bottom: 1rem;
}

.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 6px;
}

kbd {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-secondary);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-family: inherit;
  margin: 0 0.125rem;
}

.help-section ul {
  list-style: none;
  padding: 0;
}

.help-section li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-secondary);
  position: relative;
  padding-left: 1.5rem;
}

.help-section li:before {
  content: "▶";
  position: absolute;
  left: 0;
  color: var(--accent-primary);
  font-size: 0.75rem;
}

.help-section li:last-child {
  border-bottom: none;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-secondary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 300px;
  animation: slideIn 0.3s ease;
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--error);
}

.toast.warning {
  border-color: var(--warning);
}

.toast.info {
  border-color: var(--info);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-secondary);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .main-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .header-content {
    padding: 1rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .source-grid,
  .filetype-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .main-container {
    padding: 1rem;
  }

  .logo-text h1 {
    font-size: 1.25rem;
  }

  .subtitle {
    display: none;
  }

  .form-actions {
    flex-direction: column;
  }

  .modal-content {
    width: 95%;
    margin: 1rem;
  }
}

/* Print Styles */
@media print {
  .header-actions,
  .panel-actions,
  .form-actions,
  .templates-section,
  .history-section {
    display: none;
  }

  .main-container {
    grid-template-columns: 1fr;
  }

  .dork-preview {
    border: 2px solid #000;
    background: #fff;
    color: #000;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --border-primary: rgba(0, 255, 136, 0.8);
    --border-secondary: rgba(255, 255, 255, 0.3);
    --text-secondary: #cbd5e1;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .matrix-bg {
    animation: none;
  }
}
