@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

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

:root {
  --bg: #f0f4f8;
  --header-bg: rgba(255, 255, 255, 0.9);
  --card-bg: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --accent: #3b82f6;
  --radius: 16px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.06);

  /* Category colors */
  --cat-web: #3b82f6;
  --cat-data: #8b5cf6;
  --cat-cloud: #06b6d4;
  --cat-ui: #ec4899;
  --cat-mobile: #f59e0b;
  --cat-devops: #10b981;
  --cat-security: #ef4444;
  --cat-ml: #f97316;
  --cat-ai: #f97316;
  --cat-orm: #6366f1;
  --cat-testing: #14b8a6;
  --cat-build: #f59e0b;
  --cat-api: #0ea5e9;
  --cat-language: #7c3aed;
  --cat-reactive: #0891b2;
  --cat-ioc: #d97706;
  --cat-game: #dc2626;
  --cat-default: #6b7280;
}

body {
  font-family: "Inter", sans-serif;
  background: linear-gradient(135deg, #f0f4f8 0%, #e8eef5 100%);
  min-height: 100vh;
  color: var(--text-primary);
}

/* ── Header ───────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  height: 64px;
  width: 100%;
  padding: 0 24px;
  margin-bottom: 24px;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header .logo img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.box {
  display: flex;
  justify-content: center;
}

.box #searchbar {
  width: 100%;
  max-width: 360px;
}


/* ── Card Grid ────────────────────────────────────────── */
.poke-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 20px;
  padding: 0 24px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.cardContainer {
  perspective: 1000px;
}

/* ── Card ─────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  height: 290px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.45s ease, box-shadow 0.25s ease;
  cursor: pointer;
}

.cardContainer:hover .card {
  transform: rotateY(180deg);
  box-shadow: var(--shadow-lg);
}

/* Touch-screen: disable flip */
@media (hover: none) {
  .cardContainer:hover .card {
    transform: none;
    box-shadow: var(--shadow-md);
  }
  .back {
    visibility: hidden;
  }
}

/* Responsive card width on small screens */
@media screen and (max-width: 480px) {
  .poke-container {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 12px 32px;
    gap: 12px;
  }
}

/* ── Front & Back faces ───────────────────────────────── */
.front,
.back {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
}

.back {
  transform: rotateY(180deg);
  background: var(--card-bg);
  justify-content: flex-start;
  align-items: flex-start;
  padding: 14px 16px;
}

/* ── Front face content ───────────────────────────────── */
.img-container {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 10px;
}

.image {
  width: 64px;
  height: 64px;
  object-fit: contain;
  image-rendering: auto;
}

.number {
  margin-bottom: 4px;
}

.number span {
  background: #f3f4f6;
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.name {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  margin-bottom: 8px;
}

.category {
  margin-bottom: 6px;
}

.framework__category__bg {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cat-default);
}

.framework__category__bg img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

/* Category color map */
.framework__category__bg.web      { background: var(--cat-web); }
.framework__category__bg.data     { background: var(--cat-data); }
.framework__category__bg.cloud    { background: var(--cat-cloud); }
.framework__category__bg.ui       { background: var(--cat-ui); }
.framework__category__bg.mobile   { background: var(--cat-mobile); }
.framework__category__bg.devops   { background: var(--cat-devops); }
.framework__category__bg.security { background: var(--cat-security); }
.framework__category__bg.ml       { background: var(--cat-ml); }
.framework__category__bg.ai       { background: var(--cat-ai); }
.framework__category__bg.orm      { background: var(--cat-orm); }
.framework__category__bg.testing  { background: var(--cat-testing); }
.framework__category__bg.build    { background: var(--cat-build); }
.framework__category__bg.api      { background: var(--cat-api); }
.framework__category__bg.language { background: var(--cat-language); }
.framework__category__bg.reactive { background: var(--cat-reactive); }
.framework__category__bg.ioc      { background: var(--cat-ioc); }
.framework__category__bg.game     { background: var(--cat-game); }

.status-indicator {
  margin-top: 4px;
}

/* ── Back face content ────────────────────────────────── */
.framework-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.description p {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-item {
  display: flex;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.stat-item .label {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.stat-item .value {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.tag {
  background: #eff6ff;
  color: var(--accent);
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 0.62rem;
  font-weight: 500;
}

.links {
  margin-top: auto;
}

.repo-link {
  font-size: 0.72rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.repo-link:hover {
  text-decoration: underline;
}

/* ── Badge ────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.65rem;
}

.badge-active {
    background-color: #198754;
    color: #fff;
}

.badge-deprecated {
    background-color: #dc3545;
    color: #fff;
}

.badge-maintenance-only {
    background-color: #fd7e14;
    color: #fff;
}

.badge-outline {
    background-color: transparent;
    border: 1px solid #6c757d;
    color: #6c757d;
}

.badge-tag {
    font-size: 0.7rem;
    margin: 0.125rem;
}

/* ── Scroll buttons ───────────────────────────────────── */
#scrollToTopBtn,
#scrollToDownBtn {
  width: 44px;
  height: 44px;
  display: none;
  position: fixed;
  right: 20px;
  z-index: 99999;
  border: none;
  outline: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  font-size: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#scrollToTopBtn {
  top: 80px;
}

#scrollToDownBtn {
  bottom: 24px;
}

#scrollToTopBtn:hover,
#scrollToDownBtn:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

/* ── Loader ───────────────────────────────────────────── */
.lds-ring {
  margin-top: 30vh;
  display: none;
  position: relative;
  width: 80px;
  height: 80px;
  margin-inline: auto;
}

.lds-ring div {
  box-sizing: border-box;
  display: block;
  position: absolute;
  width: 64px;
  height: 64px;
  margin: 8px;
  border: 8px solid transparent;
  border-radius: 50%;
  animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  border-top-color: var(--accent);
}

.lds-ring div:nth-child(1) { animation-delay: -0.45s; }
.lds-ring div:nth-child(2) { animation-delay: -0.3s; }
.lds-ring div:nth-child(3) { animation-delay: -0.15s; }

@keyframes lds-ring {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.ring-active {
  display: block;
}

/* ── Search results list ──────────────────────────────── */
.search-results {
  max-width: 680px;
  margin: 0 auto;
  padding: 8px 24px 40px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--card-bg);
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.search-result-item:hover {
  box-shadow: var(--shadow-md);
  border-color: #e5e7eb;
  transform: translateX(4px);
}

.search-result-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
  background: #f3f4f6;
  padding: 4px;
  flex-shrink: 0;
}

.search-result-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  flex: 1;
}

.search-result-category {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.search-no-results {
  text-align: center;
  color: var(--text-secondary);
  padding: 4rem 0;
  font-size: 0.95rem;
}

/* ── Search bar ───────────────────────────────────────── */
#searchbar {
  border-radius: 12px;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  border: 1.5px solid #e5e7eb;
  padding: 6px 14px;
  font-family: "Inter", sans-serif;
  font-size: 0.95rem;
  outline: none;
  width: 100%;
  background: #fff;
}

#searchbar:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

::placeholder {
  color: var(--text-secondary);
  font-weight: 400;
}

/* ── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 8px;
}

/* ── Responsive header ────────────────────────────────── */
@media (max-width: 600px) {
  .header {
    padding: 0 12px;
  }
  .header-title {
    display: none;
  }
  .box #searchbar {
    max-width: 100%;
  }
}

/* ── Footer ───────────────────────────────────────────── */
.site-footer {
    background-color: #e0e0e0;
    padding: 2rem 1rem 1rem;
    margin-top: 3rem;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-info {
    flex: 1;
    min-width: 250px;
}

.footer-text {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.footer-text strong {
    color: #6c757d;
    font-weight: 600;
}

.footer-copyright {
    margin: 0;
    font-size: 0.875rem;
    color: #bdc3c7;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.footer-link {
    color: #bdc3c7;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s ease;
    padding: 0.25rem 0;
}

.footer-link:hover {
    color: #3498db;
    text-decoration: underline;
}

.footer-link:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
    border-radius: 2px;
}

.footer-separator {
    color: #7f8c8d;
    font-weight: bold;
    user-select: none;
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }

    .footer-info {
        min-width: auto;
    }

    .footer-links {
        justify-content: center;
    }
}

[data-theme="dark"] .site-footer {
    background-color: #1a1a1a;
    border-top-color: #4A90E2;
}

[data-theme="dark"] .footer-text {
    color: #f8f9fa;
}

[data-theme="dark"] .footer-text strong {
    color: #4A90E2;
}

[data-theme="dark"] .footer-copyright {
    color: #adb5bd;
}

[data-theme="dark"] .footer-link {
    color: #adb5bd;
}

[data-theme="dark"] .footer-link:hover {
    color: #4A90E2;
}

[data-theme="dark"] .footer-separator {
    color: #6c757d;
}
