/* ==========================================================================
   Fintech Authority - Premium Dark/Light Theme System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Color Palette - Modern Fintech Slate & Neon Accents */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: #1f293d;
  --bg-card-hover: #28354d;
  --glass-bg: rgba(17, 24, 39, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --accent-primary: #6366f1;
  --accent-hover: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  --accent-glow: rgba(99, 102, 241, 0.25);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --tag-bg: rgba(99, 102, 241, 0.12);
  --tag-text: #818cf8;
  --tag-border: rgba(99, 102, 241, 0.25);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.08);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --accent-primary: #4f46e5;
  --accent-hover: #4338ca;
  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #0891b2 100%);
  --accent-glow: rgba(79, 70, 229, 0.15);
  
  --border-color: rgba(0, 0, 0, 0.08);
  --tag-bg: rgba(79, 70, 229, 0.08);
  --tag-text: #4338ca;
  --tag-border: rgba(79, 70, 229, 0.2);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
}

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

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Decorative Background Glow */
.bg-glow {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1000px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(139, 92, 246, 0.05) 50%, transparent 80%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

/* Header Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  padding: 1rem 0;
  transition: var(--transition);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 4px 14px var(--accent-glow);
}

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

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  transform: scale(1.05);
}

/* Hero Section */
.hero {
  position: relative;
  padding: 4rem 0 2.5rem;
  z-index: 1;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--tag-text);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  letter-spacing: -0.03em;
}

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

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto 2.5rem;
}

/* Search Bar & Tag Filters */
.search-container {
  max-width: 640px;
  margin: 0 auto 2rem;
  position: relative;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  color: var(--text-muted);
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 1rem 1.25rem 1rem 3.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font-sans);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.tags-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 3rem;
}

.tag-btn {
  padding: 0.45rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.tag-btn:hover, .tag-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* Stats Bar */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 3rem;
  padding: 1.25rem 2rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  max-width: 700px;
  margin: 0 auto 3.5rem;
  backdrop-filter: blur(10px);
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Featured Article Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Article Cards Grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
}

.post-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: var(--shadow-md);
}

.post-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.post-card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.post-date, .post-readtime {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.post-card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.post-card:hover .post-card-title {
  color: var(--accent-primary);
}

.post-card-brief {
  font-size: 0.925rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}

.tag-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--tag-border);
  border-radius: var(--radius-sm);
}

/* Article Reader Page Styling */
.article-header {
  padding: 3rem 0 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 2rem;
}

.back-link:hover {
  color: var(--accent-primary);
  transform: translateX(-4px);
}

.article-title {
  font-family: var(--font-heading);
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1.25rem;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2.5rem;
}

.article-cover {
  width: 100%;
  max-height: 450px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-md);
}

.article-body {
  max-width: 800px;
  margin: 0 auto 4rem;
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.article-body h1, .article-body h2, .article-body h3, .article-body h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-primary);
  margin: 2.25rem 0 1rem;
  line-height: 1.3;
}

.article-body h1 { font-size: 2.2rem; }
.article-body h2 { font-size: 1.75rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.article-body h3 { font-size: 1.4rem; }
.article-body h4 { font-size: 1.15rem; }

.article-body p {
  margin-bottom: 1.5rem;
}

.article-body ul, .article-body ol {
  margin: 0 0 1.5rem 1.5rem;
}

.article-body li {
  margin-bottom: 0.5rem;
}

.article-body blockquote {
  border-left: 4px solid var(--accent-primary);
  padding: 1rem 1.5rem;
  background: var(--tag-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.75rem 0;
  font-style: italic;
  color: var(--text-secondary);
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background: var(--bg-card);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.article-body pre {
  background: #0d1117;
  color: #c9d1d9;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 1.75rem 0;
  border: 1px solid var(--border-color);
}

.article-body pre code {
  background: transparent;
  padding: 0;
  border: none;
  font-size: 0.9rem;
}

.article-body img {
  border-radius: var(--radius-md);
  margin: 2rem 0;
  box-shadow: var(--shadow-sm);
}

/* Footer */
footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: 2.5rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

/* Responsive queries */
@media (max-width: 768px) {
  .hero-title { font-size: 2.25rem; }
  .article-title { font-size: 2rem; }
  .stats-bar { flex-direction: column; gap: 1rem; }
  .posts-grid { grid-template-columns: 1fr; }
}
