html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 0;
  color: #0f172a;
  background: #0b1220;
}

.page-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(99, 102, 241, 0.35), transparent 60%),
    radial-gradient(900px 600px at 90% 0%, rgba(16, 185, 129, 0.22), transparent 55%),
    radial-gradient(900px 600px at 50% 110%, rgba(56, 189, 248, 0.18), transparent 60%),
    linear-gradient(180deg, #0b1220, #0b1220);
}

.page-shell > .content-surface {
  flex: 1;
}

.content-surface {
  background: transparent;
}

/* ── Modern Header / Navbar ─────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1050;
}

.modern-nav {
  padding: 0.6rem 0;
  background: rgba(11, 18, 32, 0.72);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 280ms ease, box-shadow 280ms ease;
}

.modern-nav.scrolled {
  background: rgba(11, 18, 32, 0.92);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.35);
}

/* Brand */
.modern-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none !important;
  transition: opacity 160ms ease;
}

.modern-brand:hover {
  opacity: 0.85;
}

.brand-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 0.7rem;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 40%, #22d3ee 100%);
  color: #ffffff;
  flex-shrink: 0;
  box-shadow:
    0 2px 12px rgba(99, 102, 241, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.10) inset;
  overflow: hidden;
  transition: transform 260ms ease, box-shadow 260ms ease;
}

/* Shimmer sweep */
.brand-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(255, 255, 255, 0.25) 44%,
    rgba(255, 255, 255, 0.25) 46%,
    transparent 52%
  );
  background-size: 250% 100%;
  animation: brand-shimmer 3.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes brand-shimmer {
  0%, 100% { background-position: 200% 0; }
  50%      { background-position: -50% 0; }
}

.modern-brand:hover .brand-icon {
  transform: scale(1.06) rotate(-2deg);
  box-shadow:
    0 4px 20px rgba(99, 102, 241, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

.brand-icon svg {
  position: relative;
  z-index: 1;
}

.brand-text {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: rgba(255, 255, 255, 0.95) !important;
  background: linear-gradient(135deg, #e2e8f0, #ffffff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Mobile toggler */
.modern-toggler {
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.5rem;
  padding: 0.45rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  transition: border-color 160ms ease;
}

.modern-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.35);
  outline: none;
}

.toggler-bar {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.85);
  transition: transform 200ms ease, opacity 200ms ease;
}

/* Nav links */
.modern-nav-links {
  gap: 0.25rem;
}

.modern-nav-links .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem !important;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65) !important;
  letter-spacing: -0.005em;
  transition: color 160ms ease, background 160ms ease;
  white-space: nowrap;
  position: relative;
}

.modern-nav-links .nav-link:hover {
  color: rgba(255, 255, 255, 0.95) !important;
  background: rgba(255, 255, 255, 0.08);
}

.modern-nav-links .nav-link.active,
.modern-nav-links .nav-item .nav-link[aria-current="page"] {
  color: #ffffff !important;
  background: rgba(99, 102, 241, 0.20);
}

.nav-icon {
  opacity: 0.7;
  flex-shrink: 0;
  transition: opacity 160ms ease;
}

.modern-nav-links .nav-link:hover .nav-icon,
.modern-nav-links .nav-link.active .nav-icon {
  opacity: 1;
}

/* Auth section */
.nav-auth {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.auth-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #22d3ee);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0;
}

.user-greeting {
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.78) !important;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-nav-login {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82) !important;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
  white-space: nowrap;
}

.btn-nav-login:hover {
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
}

.btn-nav-signup {
  padding: 0.4rem 1.1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff !important;
  border: none;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
  white-space: nowrap;
}

.btn-nav-signup:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.45);
  filter: brightness(1.08);
  color: #ffffff !important;
}

.btn-nav-logout {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.70) !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
  white-space: nowrap;
}

.btn-nav-logout:hover {
  color: #f87171 !important;
  border-color: rgba(248, 113, 113, 0.40);
  background: rgba(248, 113, 113, 0.10);
}

/* Responsive nav */
@media (max-width: 991.98px) {
  .modern-nav-links {
    padding: 0.75rem 0;
    gap: 0.15rem;
  }

  .modern-nav-links .nav-link {
    padding: 0.55rem 0.85rem !important;
    border-radius: 0.65rem;
  }

  .nav-auth {
    padding: 0.75rem 0 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    gap: 0.5rem;
  }
}

.surface-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 1rem;
}

.surface-card .text-muted {
  color: rgba(15, 23, 42, 0.6) !important;
}

.btn-primary {
  background: linear-gradient(90deg, #6366f1, #22c55e);
  border: none;
}

.btn-primary:hover {
  filter: brightness(1.03);
}

.form-control {
  border-radius: 0.75rem;
  border-color: rgba(15, 23, 42, 0.12);
}

.form-control:focus {
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.18);
}

.hero-section {
  padding: 4.25rem 1rem 2.75rem;
  margin-bottom: 0.5rem;
}

.hero-content {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.hero-title {
  font-weight: 700;
  font-size: clamp(2.25rem, 4vw, 3rem);
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
  color: rgba(255, 255, 255, 0.95);
}

.hero-subtitle {
  color: rgba(226, 232, 240, 0.75);
  font-size: 1.05rem;
}

.gallery-section.container {
  max-width: 1140px;
}

.image-card {
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
  transition: transform 0.18s ease-out, box-shadow 0.18s ease-out;
}

.image-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
}

.img-cover {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Footer v2 ── */
.site-footer-v2 {
  position: relative;
  padding: 0.85rem 1rem 0.7rem;
  text-align: center;
  background:
    radial-gradient(800px 120px at 50% 0%, rgba(15, 23, 42, 0.55), transparent 70%),
    rgba(2, 6, 23, 0.60);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sf2-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: rgba(148, 163, 184, 0.85);
  flex-wrap: wrap;
  justify-content: center;
}

.sf2-icon {
  color: rgba(148, 163, 184, 0.65);
}

.sf2-dot {
  color: rgba(148, 163, 184, 0.35);
  font-size: 0.6rem;
}

.sf2-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #22d3ee !important;
  text-decoration: none;
  font-weight: 600;
  transition: color 120ms ease;
}

.sf2-link:hover {
  color: #67e8f9 !important;
  text-decoration: none;
}

.sf2-link svg {
  color: inherit;
}

.sf2-glow {
  margin: 0.5rem auto 0;
  width: min(260px, 50%);
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #22d3ee, transparent);
  opacity: 0.35;
}

/* ── Search page: force all text, labels & inputs to white ── */
.search-app,
.search-app h1,
.search-app h2,
.search-app h3,
.search-app p,
.search-app div,
.search-app span,
.search-app label,
.search-app button,
.search-app input,
.search-app select,
.search-app textarea,
.search-app pre,
.search-app strong,
.search-app kbd {
  color: #ffffff !important;
}

/* ── PDF Extractor page: force all text, labels & inputs to white ── */
.pdf-app,
.pdf-app h1,
.pdf-app h2,
.pdf-app h3,
.pdf-app p,
.pdf-app div,
.pdf-app span,
.pdf-app label,
.pdf-app button,
.pdf-app input,
.pdf-app select,
.pdf-app textarea,
.pdf-app pre,
.pdf-app strong,
.pdf-app kbd,
.pdf-app li {
  color: #ffffff !important;
}

/* Keep native <option> items dark so they're readable in the OS dropdown */
.search-app select option {
  color: #0b1220 !important;
}

/* ── Method tabs (dynamically created by JS, so scoped CSS won't apply) ── */
.search-app .method-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.85rem 0;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.search-app .method-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(2, 6, 23, 0.65);
  color: #ffffff !important;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.search-app .method-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(99, 102, 241, 0.50);
  background: rgba(99, 102, 241, 0.18);
  color: #ffffff !important;
}

.search-app .method-tab.is-active {
  border-color: rgba(99, 102, 241, 0.80);
  background:
    radial-gradient(600px 180px at 50% 0%, rgba(99, 102, 241, 0.28), transparent 60%),
    rgba(2, 6, 23, 0.65);
  color: #ffffff !important;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.18) inset;
}

.search-app .method-tab__name {
  letter-spacing: -0.01em;
  color: #ffffff !important;
}

.search-app .method-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.8rem;
  font-weight: 800;
  color: #ffffff !important;
}

.search-app .method-tab.is-active .method-tab__count {
  background: rgba(99, 102, 241, 0.35);
}

/* ── Result cards (also dynamically created by JS) ── */
.search-app .results-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

@media (max-width: 1100px) {
  .search-app .results-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 860px) {
  .search-app .results-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 576px) {
  .search-app .results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.search-app .result-card {
  border-radius: 0.85rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.40);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.search-app .result-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.search-app .result-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: rgba(2, 6, 23, 0.50);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-app .result-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.search-app .result-gradient {
  position: absolute;
  inset: auto 0 0 0;
  height: 40%;
  background: linear-gradient(180deg, transparent, rgba(2, 6, 23, 0.70));
  pointer-events: none;
}

.search-app .result-score {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(2, 6, 23, 0.65);
  color: rgba(255, 255, 255, 0.95) !important;
  font-size: 0.72rem;
  font-weight: 800;
  backdrop-filter: blur(10px);
}

.search-app .result-body {
  padding: 0.5rem 0.6rem 0.6rem;
}

.search-app .result-title {
  font-weight: 750;
  font-size: 0.8rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-app .result-subtitle {
  color: rgba(255, 255, 255, 0.76) !important;
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-app .img-fail {
  position: absolute;
  inset: 0;
  padding: 0.6rem;
  display: grid;
  place-items: center;
  text-align: center;
  color: rgba(255, 255, 255, 0.76) !important;
  font-size: 0.8rem;
}

/* make result cards clickable */
.search-app .result-card {
  cursor: pointer;
}

/* ── Lightbox / full-screen image viewer ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lb-fadein 180ms ease;
}

@keyframes lb-fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-body {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 0.75rem;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.6);
  user-select: none;
}

.lightbox-info {
  margin-top: 1rem;
  text-align: center;
  color: #ffffff;
}

.lightbox-score {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.35);
  border: 1px solid rgba(99, 102, 241, 0.50);
  font-size: 0.9rem;
  font-weight: 800;
  color: #ffffff !important;
  margin-bottom: 0.5rem;
}

.lightbox-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff !important;
}

.lightbox-folder {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.65) !important;
  margin-top: 0.15rem;
}

.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  z-index: 10000;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.50);
  color: #ffffff !important;
  font-size: 1.6rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.lightbox-close:hover {
  background: rgba(248, 113, 113, 0.35);
  border-color: rgba(248, 113, 113, 0.55);
}

.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10000;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #ffffff !important;
  font-size: 1.8rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(99, 102, 241, 0.30);
  border-color: rgba(99, 102, 241, 0.55);
}

@media (max-width: 576px) {
  .lightbox-prev,
  .lightbox-next {
    width: 38px;
    height: 38px;
    font-size: 1.4rem;
  }
}