/* ========================================
   CSS Variables & Root Styles
   ======================================== */

:root {
  /* Light theme colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-card: #ffffff;
  --bg-hover: #f1f3f5;

  --text-primary: #1a1a1a;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;

  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  --border-color: #e9ecef;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /* Typography */
  --font-primary: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  --font-heading: "SF Pro Display", -apple-system, BlinkMacSystemFont,
    sans-serif;

  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* ========================================
   Reset & Base Styles
   ======================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color var(--transition-base),
    color var(--transition-base);
}

/* ========================================
   Typography
   ======================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--spacing-sm);
}

h1 {
  font-size: 2.5rem;
}
h2 {
  font-size: 2rem;
}
h3 {
  font-size: 1.75rem;
}
h4 {
  font-size: 1.5rem;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-secondary);
}

/* ========================================
   Layout
   ======================================== */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--spacing-lg);
  }
}

/* ========================================
   Header
   ======================================== */

.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing-lg) 0;
  transition: all var(--transition-base);
}

.header-content {
  text-align: center;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-xs);
}

.logo-icon {
  width: 40px;
  height: 40px;
  stroke: var(--accent-primary);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

.logo h1,
.logo-text {
  font-size: 2rem;
  margin: 0;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.tagline {
  color: var(--text-secondary);
  font-size: 1rem;
  margin: 0;
}

.header-description {
  position: relative;
  margin-top: var(--spacing-sm);
}

.toggle-description {
  display: none;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-secondary);
  border-radius: 50%;
  cursor: pointer;
  margin: 0 auto var(--spacing-xs);
  transition: all var(--transition-base);
  align-items: center;
  justify-content: center;
}

.toggle-description:hover {
  background: var(--accent-primary);
}

.toggle-description:hover .chevron-icon {
  stroke: white;
}

.chevron-icon {
  width: 20px;
  height: 20px;
  stroke: var(--text-secondary);
  transition: transform var(--transition-base), stroke var(--transition-base);
}

.toggle-description[aria-expanded="false"] .chevron-icon {
  transform: rotate(-90deg);
}

.description-content {
  max-height: 500px;
  overflow: hidden;
  transition: max-height var(--transition-slow), opacity var(--transition-base);
  opacity: 1;
}

.description-content.collapsed {
  max-height: 0;
  opacity: 0;
}

.description-content p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.7;
  text-align: center;
  margin: 0;
  padding: 0 var(--spacing-md);
}

/* ========================================
   Search Section
   ======================================== */

.search-section {
  padding: var(--spacing-xl) 0;
  background: var(--bg-secondary);
}

.search-wrapper {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  stroke: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 1rem 3.5rem 1rem 3.5rem;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all var(--transition-base);
  outline: none;
  box-shadow: var(--shadow-sm);
}

.search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.search-clear {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.search-clear.active {
  display: flex;
}

.search-clear svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-muted);
}

.search-clear:hover {
  background: var(--bg-hover);
}

/* ========================================
   Filter Section
   ======================================== */

.filter-section {
  padding: var(--spacing-lg) 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.filter-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  gap: var(--spacing-xs);
  overflow-x: auto;
  overflow-y: hidden;
  padding: var(--spacing-xs) 0;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
}

.filter-tabs::-webkit-scrollbar {
  height: 4px;
}

.filter-tabs::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.filter-tabs::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: var(--radius-sm);
}

.filter-tab {
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--transition-base);
  flex-shrink: 0;
  scroll-snap-align: start;
}

.filter-tab:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-2px);
}

.filter-tab.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: white;
  box-shadow: var(--shadow-md);
}

/* ========================================
   Main Content
   ======================================== */

.main-content {
  padding: var(--spacing-xl) 0;
  min-height: 60vh;
}

.stats-bar {
  display: flex;
  gap: var(--spacing-sm);
  flex-shrink: 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  min-width: 70px;
  border: 1px solid var(--border-color);
  transition: all var(--transition-base);
}

.stat-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.stat-number {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 0.25rem;
}

/* ========================================
   Sites Grid
   ======================================== */

.sites-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
  animation: fadeIn 0.5s ease;
}

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

@media (min-width: 480px) {
  .sites-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (min-width: 768px) {
  .sites-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-lg);
  }
}

/* ========================================
   No Results
   ======================================== */

.no-results {
  text-align: center;
  padding: var(--spacing-xl) 0;
  animation: fadeIn 0.5s ease;
}

.no-results svg {
  width: 80px;
  height: 80px;
  stroke: var(--text-muted);
  margin-bottom: var(--spacing-md);
}

.no-results h3 {
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
}

.no-results p {
  color: var(--text-secondary);
}

/* ========================================
   SEO Article Section
   ======================================== */

.seo-article {
  margin-top: 60px;
  padding: 40px;
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid var(--border-color);
}

.article-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
}

.article-header h1,
.article-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  flex: 1;
}

.toggle-article {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.toggle-article:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.toggle-article .chevron-icon {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.toggle-article[aria-expanded="false"] .chevron-icon {
  transform: rotate(-90deg);
}

.toggle-article[aria-expanded="false"] .toggle-text::after {
  content: "Read More";
}

.toggle-article[aria-expanded="true"] .toggle-text::after {
  content: "Read Less";
}

.toggle-text::after {
  content: "Read Less";
}

.article-content {
  line-height: 1.8;
  color: var(--text-secondary);
}

.article-content.collapsed {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease;
}

.article-content:not(.collapsed) {
  max-height: none;
  opacity: 1;
  transition: max-height 0.4s ease, opacity 0.3s ease;
}

.article-content h3 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 32px;
  margin-bottom: 16px;
}

.article-content h3:first-of-type {
  margin-top: 0;
}

.article-content p {
  font-size: 16px;
  margin-bottom: 20px;
  text-align: justify;
}

.article-content p:last-child {
  margin-bottom: 0;
}

/* ========================================
   Footer
   ======================================== */

.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: var(--spacing-xl) 0;
  margin-top: var(--spacing-xl);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

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

.footer-links {
  display: flex;
  gap: var(--spacing-md);
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--accent-primary);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
  .header {
    padding: var(--spacing-md) 0;
  }

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

  .tagline {
    font-size: 0.875rem;
  }

  .toggle-description {
    display: flex;
  }

  .description-content p {
    font-size: 0.875rem;
    padding: 0;
  }

  .search-section {
    padding: var(--spacing-md) 0;
  }

  .search-input {
    font-size: 14px;
    padding: 0.875rem 3rem 0.875rem 2.75rem;
  }

  .search-icon {
    width: 18px;
    height: 18px;
    left: 1rem;
  }

  .filter-section {
    padding: var(--spacing-md) 0;
    overflow: hidden;
  }

  .filter-tabs {
    gap: 0.5rem;
    padding: 0.5rem 0;
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    scrollbar-width: none;
  }

  .filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .filter-tab {
    padding: 0.625rem 1.25rem;
    font-size: 0.8125rem;
    border-radius: 10px;
  }

  .filter-tab:active {
    transform: scale(0.95);
  }

  .filter-tab:hover {
    transform: none;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  /* SEO Article Mobile */
  .seo-article {
    padding: 24px;
    margin-top: 40px;
  }

  .article-header {
    flex-direction: column;
    align-items: stretch;
  }

  .article-header h1,
  .article-header h2 {
    font-size: 22px;
  }

  .toggle-article {
    display: flex;
    justify-content: center;
  }

  .article-content h3 {
    font-size: 18px;
    margin-top: 24px;
    margin-bottom: 12px;
  }

  .article-content p {
    font-size: 14px;
    text-align: left;
  }
}

/* Tablet styles */
@media (max-width: 1024px) and (min-width: 769px) {
  .filter-tabs {
    gap: 0.5rem;
    padding: 0.5rem 0;
  }

  .filter-tab {
    padding: 0.625rem 1.25rem;
    font-size: 0.8125rem;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }

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

  .search-input {
    font-size: 13px;
    padding: 0.75rem 2.75rem 0.75rem 2.5rem;
  }

  .search-icon {
    width: 16px;
    height: 16px;
    left: 0.875rem;
  }

  .filter-section {
    padding: var(--spacing-sm) 0;
  }

  .filter-tabs {
    gap: 0.375rem;
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .filter-tab {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    border-radius: 8px;
  }

  .seo-article {
    padding: 1rem;
    margin-top: 2rem;
  }

  .article-header h1,
  .article-header h2 {
    font-size: 18px;
  }
}
