/* Root Design Variables */
:root {
  --font-heading: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Harmonious Dark Palette */
  --bg-base: #07070c;
  --card-bg: rgba(14, 14, 22, 0.6);
  --card-border: rgba(255, 255, 255, 0.06);
  --card-shadow: rgba(0, 0, 0, 0.5);
  
  /* Colors */
  --color-primary: #0072ff;
  --color-primary-glow: rgba(0, 114, 255, 0.35);
  --color-success: #00e676;
  --color-error: #ff3d00;
  --color-warning: #ffb300;
  
  /* Text colors */
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --text-highlight: #ffffff;
}

/* Base Resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.65;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* Ambient Background Glows */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.12;
}

.bg-glow-1 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #00c6ff, #0072ff);
  top: -100px;
  right: -100px;
}

.bg-glow-2 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, #7928ca, #ff0080);
  bottom: -150px;
  left: -150px;
}

.bg-glow-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #00f2fe, #4facfe);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.04;
}

/* Container & General Layout */
.container {
  max-width: 850px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Typography & Headers */
h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.gradient-text {
  background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header {
  text-align: center;
  margin-bottom: 40px;
}

.logo-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 8px;
}

#logo-img {
  max-height: 42px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(0, 114, 255, 0.3));
}

.header h1 {
  font-size: 3.2rem;
  line-height: 1.1;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.15rem;
  font-weight: 300;
  margin-top: 6px;
}

/* Glassmorphism Card System */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 35px;
  box-shadow: 0 10px 40px 0 var(--card-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-icon {
  width: 26px;
  height: 26px;
  color: #00c6ff;
}

.card-header h2 {
  font-size: 1.45rem;
  font-weight: 600;
}

/* Inputs & Forms */
.input-group {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  margin-top: 8px;
}

input[type="text"] {
  flex: 1;
  background: rgba(10, 10, 15, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 18px 22px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 1.05rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 20px var(--color-primary-glow);
  background: rgba(15, 15, 25, 0.85);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  padding: 16px 28px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm {
  padding: 10px 18px;
  font-size: 0.9rem;
  border-radius: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(0, 114, 255, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0, 114, 255, 0.55);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

/* Guide box */
.guide-box {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 20px 24px;
}

.guide-box h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-highlight);
}

.guide-box h3 i {
  width: 18px;
  height: 18px;
  color: #00c6ff;
}

.guide-box ul {
  list-style: none;
}

.guide-box li {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  position: relative;
  padding-left: 20px;
  line-height: 1.6;
}

.guide-box li::before {
  content: "•";
  position: absolute;
  left: 6px;
  color: #00c6ff;
  font-weight: bold;
}

/* Search Results Panel */
.results-header-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.results-header-toolbar .card-header {
  margin-bottom: 0;
}

.badge {
  background: rgba(0, 114, 255, 0.2);
  color: #00c6ff;
  border: 1px solid rgba(0, 114, 255, 0.3);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: bold;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 550px;
  overflow-y: auto;
  padding-right: 8px;
}

.result-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(0, 114, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.result-info {
  flex: 1;
}

.result-title {
  font-size: 1.25rem;
  color: var(--text-highlight);
  margin-bottom: 6px;
}

.result-meta {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.result-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.result-meta .meta-item i {
  width: 14px;
  height: 14px;
}

.result-snippet {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Empty Search State */
.empty-results {
  text-align: center;
  padding: 50px 20px;
}

.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-results p {
  font-size: 1.2rem;
  color: var(--text-highlight);
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-results small {
  display: block;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto;
}

/* Log Screen */
.log-screen {
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 20px 24px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  height: 220px;
  overflow-y: auto;
}

.log-line {
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.log-line .timestamp {
  color: #666;
  font-weight: bold;
  flex-shrink: 0;
}

.text-info { color: #00c6ff; }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }
.text-muted { color: #555; }

/* Reader viewport styles */
.reader-panel {
  padding: 40px 50px;
}

.reader-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.toolbar-actions {
  display: flex;
  gap: 12px;
}

.article-header {
  margin-bottom: 24px;
}

#article-title {
  font-size: 2.3rem;
  line-height: 1.25;
  color: var(--text-highlight);
  margin-bottom: 12px;
}

.article-meta {
  display: flex;
  gap: 20px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-item i {
  width: 16px;
  height: 16px;
}

.divider {
  border: 0;
  height: 1px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.01));
  margin-bottom: 30px;
}

/* Article Body rendering */
.article-body {
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--text-main);
  letter-spacing: 0.01em;
}

.article-body p {
  margin-bottom: 24px;
  text-align: justify;
}

/* Animations */
.hidden {
  display: none !important;
}

.loader-pulse {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: var(--color-primary);
  animation: pulse 1.4s infinite ease-in-out;
}

@keyframes pulse {
  0% {
    transform: scale(0.8);
    box-shadow: 0 0 0 0 rgba(0, 114, 255, 0.7);
  }
  70% {
    transform: scale(1.15);
    box-shadow: 0 0 0 10px rgba(0, 114, 255, 0);
  }
  100% {
    transform: scale(0.8);
    box-shadow: 0 0 0 0 rgba(0, 114, 255, 0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.6s ease forwards;
}

.animate-slide-up {
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 40px;
}

/* Custom Scrollbar for list and logs */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.01);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 114, 255, 0.3);
}

/* Responsive elements */
@media (max-width: 650px) {
  .container {
    padding: 20px 10px;
  }
  .input-group {
    flex-direction: column;
  }
  .header h1 {
    font-size: 2.3rem;
  }
  .card {
    padding: 24px 20px;
  }
  .result-card {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .result-card button {
    width: 100%;
  }
  .reader-panel {
    padding: 24px 20px;
  }
  #article-title {
    font-size: 1.8rem;
  }
}
