:root {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #e0e7ff;
  --bg-primary: #0a0e27;
  --bg-secondary: #1a1f3a;
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-cyan: #06b6d4;
  --text-primary: #e0e7ff;
  --text-secondary: #a5b4fc;
  --glass-bg: rgba(30, 41, 59, 0.4);
  --glass-border: rgba(139, 92, 246, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0f172a 100%);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(6, 182, 212, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px 18px;
  flex: 1;
  width: 100%;
  position: relative;
  z-index: 1;
}

header {
  text-align: center;
  margin-bottom: 24px;
  padding: 20px 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
  opacity: 0.8;
}

.breadcrumb a:hover {
  color: var(--text-primary);
  opacity: 1;
  text-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.breadcrumb .separator {
  opacity: 0.5;
  margin: 0 4px;
}

.breadcrumb .current {
  color: var(--text-primary);
  font-weight: 600;
}

header h1 {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #e0e7ff 0%, #a5b4fc 50%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px rgba(139, 92, 246, 0.5);
  letter-spacing: -0.02em;
}

.search-panel,
.results-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  margin-bottom: 12px;
  transition: all 0.3s ease;
}

.search-panel:hover,
.results-panel:hover {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(139, 92, 246, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.search-panel label {
  display: block;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 14px 16px;
  font-size: 1rem;
  resize: vertical;
  transition: all 0.3s ease;
  background: rgba(15, 23, 42, 0.5);
  color: var(--text-primary);
  font-family: inherit;
}

textarea::placeholder {
  color: rgba(165, 180, 252, 0.5);
}

textarea:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 
    0 0 0 3px rgba(139, 92, 246, 0.2),
    0 0 20px rgba(139, 92, 246, 0.3);
  background: rgba(15, 23, 42, 0.7);
}

#search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 
    0 4px 15px rgba(99, 102, 241, 0.4),
    0 0 20px rgba(139, 92, 246, 0.2);
  position: relative;
  overflow: hidden;
}

#search-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

#search-btn:hover::before {
  left: 100%;
}

#download-pdf-btn.print-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 12px 24px;
  border: 1px solid rgba(139, 92, 246, 0.5);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(99, 102, 241, 0.2) 100%);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 
    0 4px 15px rgba(139, 92, 246, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

#download-pdf-btn.print-btn:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: rgba(139, 92, 246, 0.8);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(99, 102, 241, 0.3) 100%);
  box-shadow: 
    0 8px 25px rgba(139, 92, 246, 0.4),
    0 0 30px rgba(139, 92, 246, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

#download-pdf-btn.print-btn:active {
  transform: translateY(0) scale(0.98);
}

#download-pdf-btn.print-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.print-icon {
  font-size: 1.1rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.search-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

#search-btn:disabled {
  background: rgba(99, 102, 241, 0.3);
  cursor: not-allowed;
  box-shadow: none;
}

#search-btn:not(:disabled):hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 8px 25px rgba(99, 102, 241, 0.5),
    0 0 30px rgba(139, 92, 246, 0.4);
}

.hint {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  opacity: 0.8;
}

.results-panel {
  max-height: 82vh;
  min-height: 500px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.results-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.5) transparent;
}

.results-list::-webkit-scrollbar {
  width: 8px;
}

.results-list::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 10px;
}

.results-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.6) 0%, rgba(99, 102, 241, 0.6) 100%);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.results-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.8) 0%, rgba(99, 102, 241, 0.8) 100%);
  background-clip: padding-box;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.panel-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #e0e7ff 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#results-count {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 4px 12px;
  background: rgba(139, 92, 246, 0.15);
  border-radius: 8px;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.result-card {
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 16px;
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(10px);
  position: relative;
  transition: all 0.3s ease;
  width: 100%;
  overflow: visible;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.result-card:hover {
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(15, 23, 42, 0.6);
  transform: translateX(4px);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.2),
    0 0 15px rgba(139, 92, 246, 0.2);
}

.result-meta {
  display: flex;
  gap: 8px;
  font-size: 0.85rem;
  color: #6b778c;
  margin-bottom: 8px;
}

.snippet {
  margin: 0;
  line-height: 1.6;
  color: var(--text-primary);
  font-size: 0.95rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  display: block;
  width: 100%;
  max-width: 100%;
}

.snippet mark {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.4) 0%, rgba(245, 158, 11, 0.4) 100%);
  padding: 2px 4px;
  border-radius: 4px;
  color: #fef08a;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

.empty-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 60px 20px;
  opacity: 0.7;
  font-size: 1rem;
}

.error-state {
  color: #fca5a5;
  text-align: center;
  padding: 20px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 16px;
  background: rgba(239, 68, 68, 0.1);
  backdrop-filter: blur(10px);
}

@media print {
  body {
    background: #ffffff;
  }

  body::before {
    display: none;
  }

  .search-panel {
    display: none;
  }

  header {
    text-align: left;
    margin-bottom: 12px;
  }

  .breadcrumb {
    display: none;
  }

  header h1 {
    -webkit-text-fill-color: #000;
    background: none;
    color: #000;
  }

  .results-panel {
    max-height: none;
    box-shadow: none;
    border-radius: 0;
    background: #fff;
    border: none;
  }

  .results-list {
    max-height: none;
    overflow: visible;
  }

  .result-card {
    border: none;
    padding: 4px 0;
    background: #fff;
  }

  .snippet {
    color: #000;
  }

  .snippet mark {
    background: #fef08a;
    color: #000;
    box-shadow: none;
  }

  footer {
    display: none;
  }

  .token-modal {
    display: none !important;
  }
}

footer {
  text-align: center;
  padding: 20px 16px;
  margin-top: auto;
  color: var(--text-secondary);
  font-size: 0.875rem;
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  opacity: 0.7;
  position: relative;
  z-index: 1;
}

footer p {
  margin: 0;
  word-wrap: break-word;
}

.tutorial-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  margin-bottom: 12px;
}

.tutorial-content {
  color: var(--text-primary);
  line-height: 1.8;
}

.tutorial-content h2 {
  margin-top: 32px;
  margin-bottom: 16px;
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #e0e7ff 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tutorial-content h2:first-child {
  margin-top: 0;
}

.tutorial-content p {
  margin: 12px 0;
  color: var(--text-secondary);
}

.tutorial-steps {
  margin: 16px 0;
  padding-left: 24px;
  color: var(--text-secondary);
}

.tutorial-steps li {
  margin: 12px 0;
  line-height: 1.7;
}

.telegram-link {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
  border-bottom: 1px solid transparent;
}

.telegram-link:hover {
  color: #22d3ee;
  border-bottom-color: #22d3ee;
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

/* Responsive footer for mobile devices */
@media (max-width: 768px) {
  footer {
    padding: 16px 12px;
    font-size: 0.8125rem;
  }
}

@media (max-width: 480px) {
  footer {
    padding: 12px 8px;
    font-size: 0.75rem;
  }
}

/* Token Modal Styles */
.token-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 39, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.token-modal-content {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 32px;
  max-width: 400px;
  width: 100%;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(139, 92, 246, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: modalSlideIn 0.3s ease;
  position: relative;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.token-modal-content h2 {
  margin: 0 0 12px;
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #e0e7ff 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.token-modal-content p {
  margin: 0 0 24px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

#token-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#token-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
  font-family: "Courier New", monospace;
  transition: all 0.3s ease;
}

#token-input:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 
    0 0 0 3px rgba(139, 92, 246, 0.2),
    0 0 20px rgba(139, 92, 246, 0.3);
  background: rgba(15, 23, 42, 0.8);
}

#token-submit-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 
    0 4px 15px rgba(99, 102, 241, 0.4),
    0 0 20px rgba(139, 92, 246, 0.2);
}

#token-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 8px 25px rgba(99, 102, 241, 0.5),
    0 0 30px rgba(139, 92, 246, 0.4);
}

#token-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.token-error {
  color: #fca5a5;
  font-size: 0.875rem;
  min-height: 20px;
  text-align: center;
}

.token-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 50%;
  color: var(--text-primary);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.token-close-btn:hover {
  background: rgba(139, 92, 246, 0.4);
  border-color: rgba(139, 92, 246, 0.6);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

