/* ==========================================================================
   RankCraft SEO & Web Utility Tools - Main Stylesheet
   Modern SaaS Theme | Lightweight | High Performance
   ========================================================================== */

:root {
  /* Brand Colors */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-rgb: 37, 99, 235;

  --secondary: #0f172a;
  --secondary-hover: #1e293b;
  --secondary-light: #f1f5f9;

  /* Accent Colors */
  --accent-cyan: #0284c7;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  --accent-purple: #7c3aed;

  /* Status Colors */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #3b82f6;
  --info-bg: #eff6ff;

  /* Neutral Surface Colors */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --border: #e2e8f0;
  --border-focus: #93c5fd;

  /* Text Colors */
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-inverse: #ffffff;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Layout & Sizing */
  --max-width: 1240px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  color: var(--primary-hover);
}

img, svg {
  vertical-align: middle;
  max-width: 100%;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.main-content {
  flex: 1 0 auto;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo {
  height: 38px;
  width: auto;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-link {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--secondary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
}

.nav-dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 0.5rem;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: var(--transition);
  z-index: 110;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
  border-radius: var(--radius-sm);
}

.dropdown-item:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-search-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
}

.header-search-btn:hover {
  background-color: #e2e8f0;
  color: var(--text-main);
  border-color: #cbd5e1;
}

.search-shortcut {
  font-size: 0.75rem;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-main);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  padding: 4.5rem 0 3.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--primary-light);
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-full);
  margin-bottom: 1.25rem;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--secondary);
  line-height: 1.15;
  margin-bottom: 1.25rem;
}

.hero-title span {
  background: linear-gradient(135deg, var(--primary) 0%, #0284c7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 2rem;
}

/* Hero Search Box */
.hero-search-wrapper {
  max-width: 640px;
  margin: 0 auto 1.5rem;
  position: relative;
}

.hero-search-box {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.375rem 0.5rem 0.375rem 1.25rem;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}

.hero-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15), var(--shadow-xl);
}

.hero-search-box input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text-main);
  padding: 0.5rem 0.5rem 0.5rem 0.5rem;
}

.hero-search-box input::placeholder {
  color: var(--text-light);
}

.hero-search-submit {
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  padding: 0.625rem 1.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.hero-search-submit:hover {
  background: var(--primary-hover);
}

.hero-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-top: 2rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stat-item strong {
  color: var(--secondary);
  font-weight: 700;
}

/* ==========================================================================
   Tool Categories & Grid
   ========================================================================== */
.section {
  padding: 4rem 0;
}

.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 2.5rem;
}

.section-tag {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  display: block;
}

.section-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--secondary);
  margin-bottom: 0.75rem;
}

.section-description {
  color: var(--text-muted);
  font-size: 1rem;
}

/* Category Filter Tabs */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}

.cat-tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.5rem 1.125rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.cat-tab-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.cat-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
  color: inherit;
}

.tool-card:hover {
  transform: translateY(-4px);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-xl);
}

.tool-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: var(--primary-light);
  color: var(--primary);
  flex-shrink: 0;
}

.tool-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.tool-badge.popular {
  background: #fef3c7;
  color: #b45309;
}

.tool-badge.new {
  background: #dcfce7;
  color: #15803d;
}

.tool-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 0.5rem;
}

.tool-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.tool-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
}

.tool-category-name {
  color: var(--text-light);
  font-weight: 500;
}

.tool-cta-link {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ==========================================================================
   Features Section
   ========================================================================== */
.features-section {
  background-color: #ffffff;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.feature-box {
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--bg-page);
  border: 1px solid var(--border);
}

.feature-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.feature-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 0.5rem;
}

.feature-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   FAQ Section
   ========================================================================== */
.faq-list {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}

.faq-question {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 1.25rem 1.5rem;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.faq-icon {
  transition: transform 0.3s ease;
  font-size: 1.25rem;
  color: var(--primary);
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.faq-item.active .faq-answer {
  max-height: 300px;
  padding: 0 1.5rem 1.25rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background-color: var(--secondary);
  color: #94a3b8;
  padding: 4.5rem 0 2rem;
  margin-top: auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3.5rem;
}

.footer-brand p {
  margin-top: 1rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  max-width: 320px;
}

.footer-heading {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-links a {
  color: #94a3b8;
  font-size: 0.875rem;
  transition: var(--transition);
}

.footer-links a:hover {
  color: #ffffff;
  padding-left: 4px;
}

.footer-bottom {
  border-top: 1px solid #334155;
  padding-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
}

.footer-bottom-links {
  display: flex;
  gap: 1.5rem;
}

.footer-bottom-links a {
  color: #94a3b8;
}

.footer-bottom-links a:hover {
  color: #ffffff;
}

/* ==========================================================================
   Search Modal
   ========================================================================== */
.search-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 1.5rem 2rem;
}

.search-modal-overlay.open {
  display: flex;
}

.search-modal-content {
  background: var(--bg-card);
  width: 100%;
  max-width: 640px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-search-header {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
}

.modal-search-header input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.125rem;
  color: var(--text-main);
  background: transparent;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.25rem;
}

.modal-search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

.search-result-item:hover, .search-result-item.selected {
  background-color: var(--primary-light);
}

.search-result-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  color: var(--primary);
  border: 1px solid var(--border);
}

.search-result-info {
  flex: 1;
}

.search-result-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--secondary);
}

.search-result-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.search-no-results {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}
