/* =========================================
   1. VARIABLES & THEME SETUP
   ========================================= */
:root {
  /* Color Palette - Premium Modern */
  --primary: #6366f1; /* Indigo 500 */
  --primary-hover: #4f46e5;
  --secondary: #ec4899; /* Pink 500 */
  --accent: #8b5cf6; /* Violet 500 */

  /* Light Mode Utils */
  --bg-body: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.4);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-light: rgba(255, 255, 255, 0.5);
  --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 20px 40px -10px rgba(99, 102, 241, 0.2);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary), var(--secondary));
  --gradient-bg: radial-gradient(circle at top left, #e0e7ff, #f3e8ff, #fce7f3);
}

[data-theme="dark"] {
  /* Dark Mode Utils */
  --bg-body: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-glass: rgba(30, 41, 59, 0.4);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-light: rgba(255, 255, 255, 0.1);
  --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
  --shadow-hover: 0 20px 40px -10px rgba(99, 102, 241, 0.4);

  /* Gradients Dark */
  --gradient-bg: radial-gradient(circle at top left, #1e1b4b, #1e293b, #171717);
}

/* =========================================
   2. RESET & BASE STYLES
   ========================================= */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg-body);
  background-image: var(--gradient-bg);
  background-attachment: fixed;
  background-size: cover;
  color: var(--text-main);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}
ul {
  list-style: none;
}
button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* =========================================
   3. UTILITIES & GLASSMORPHISM
   ========================================= */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: 1.5rem;
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-weight: 600;
  box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.5);
}

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* =========================================
   4. LAYOUT COMPONENTS
   ========================================= */
/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 0;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-item {
  color: var(--text-muted);
  font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
  color: var(--primary);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-light);
  color: var(--text-main);
}

.theme-toggle:hover {
  background: var(--primary);
  color: white;
}

/* Footer */
footer {
  margin-top: auto;
  padding: 3rem 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
  text-align: center;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
  text-align: left;
}

.footer-col h3 {
  margin-bottom: 1rem;
  color: var(--text-main);
}

.footer-col a {
  display: block;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

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

/* =========================================
   5. ANIMATIONS
   ========================================= */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-glass) 25%,
    var(--border-light) 50%,
    var(--bg-glass) 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 0.5rem;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .nav-links {
    display: none; /* Todo: Implement mobile menu toggle */
  }
  .hero h1 {
    font-size: 2.5rem;
  }
}

/* Ads */
.ad-container {
    width: 100%;
    margin: 2rem 0;
    text-align: center;
    overflow: hidden;
}
.ad-slot {
    display: inline-block;
    width: 100%;
    max-width: 728px;
    height: 90px;
    background: rgba(0,0,0,0.02);
    border: 1px dashed var(--border-light);
    border-radius: 0.5rem;
    line-height: 90px;
    color: var(--text-muted);
    font-size: 0.8rem;
}
@media (max-width: 768px) {
    .ad-slot { height: 250px; max-width: 300px; line-height: 250px; }
}

/* Print Styles */
@media print {
    header, footer, .actions, .ad-container, .promo { display: none !important; }
    body { background: white; color: black; }
    .glass-card { box-shadow: none; border: 1px solid #ccc; }
}

/* =========================================
   6. SEARCH RESULTS (Added Step 297)
   ========================================= */
.search-results-dropdown {
    display: none;
    position: absolute;
    top: 115%;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
    max-height: 0; /* Animate height */
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

[data-theme="dark"] .search-results-dropdown {
    background: rgba(30, 41, 59, 0.9);
}

.search-results-dropdown.active {
    display: block;
    max-height: 400px;
    opacity: 1;
    transform: translateY(0);
}

.search-result-item {
    display: block;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s, padding-left 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(99, 102, 241, 0.1); /* Primary tint */
    padding-left: 1.5rem; /* Slight nudge */
    color: var(--primary);
}

.search-result-title {
    font-weight: 600;
    font-size: 1rem;
}

.search-result-category {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 99px;
    background: var(--bg-glass);
    color: var(--text-muted);
    border: 1px solid var(--border-light);
}
