/* ============================================
   AI Credit & Banking News - Styles
   Newspaper-inspired design
   ============================================ */

/* CSS Variables */
:root {
  --primary: #1e3a8a;
  --primary-dark: #1e2f5c;
  --accent: #0d9488;
  --accent-light: #14b8a6;
  --background: #f9fafb;
  --surface: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --radius-lg: 12px;
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

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

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

/* Layout */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.logo-svg {
  height: 40px;
  width: auto;
}

/* Hide text fallback when SVG logo is present */
.logo-svg + .logo-fallback {
  display: none;
}

.logo-fallback {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  font-family: 'Inter', sans-serif;
}

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

.nav a {
  color: var(--text);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
}

.nav a:hover,
.nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Search */
.search-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-input {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  width: 200px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.search-btn {
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}

.search-btn:hover {
  background: var(--primary-dark);
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 4rem 1rem;
  text-align: center;
}

.hero h1 {
  color: white;
  margin-bottom: 1rem;
  font-size: 2.75rem;
}

.hero p {
  font-size: 1.25rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

/* Section Headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--primary);
}

.section-header h2 {
  font-size: 1.5rem;
}

.section-header a {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Main Content */
main {
  padding: 2rem 0;
}

.section {
  margin-bottom: 3rem;
}

/* Article Cards */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.article-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.article-card-image {
  height: 160px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.article-card-icon {
  font-size: 3rem;
  opacity: 0.3;
  color: white;
}

.article-card-content {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-light);
}

.article-card-category {
  background: var(--accent);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.article-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.article-card h3 a {
  color: var(--text);
}

.article-card h3 a:hover {
  color: var(--primary);
}

.article-card-summary {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.article-card-source {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.difficulty-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
  text-transform: capitalize;
}

.difficulty-badge.beginner {
  background: #dcfce7;
  color: #166534;
}

.difficulty-badge.intermediate {
  background: #fef3c7;
  color: #92400e;
}

.difficulty-badge.advanced {
  background: #fee2e2;
  color: #991b1b;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.tag {
  background: var(--background);
  color: var(--text-light);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

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

/* Categories Grid */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.category-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.category-card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.category-card h4 {
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.category-card-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Article Detail Page */
.article-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.article-header {
  margin-bottom: 2rem;
}

.article-header h1 {
  font-size: 2.25rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.article-content {
  font-size: 1.1rem;
  line-height: 1.8;
}

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

.read-original {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border-radius: var(--radius);
  font-weight: 500;
  transition: background 0.2s;
}

.read-original:hover {
  background: var(--primary-dark);
  color: white;
}

/* Category Page */
.category-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  padding: 3rem 1rem;
  margin-bottom: 2rem;
}

.category-header h1 {
  color: white;
  margin-bottom: 0.5rem;
}

.category-header p {
  opacity: 0.9;
  font-size: 1.1rem;
}

/* Search Results */
.search-header {
  background: var(--surface);
  padding: 2rem 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.search-header h1 {
  font-size: 1.5rem;
}

.search-header .query {
  color: var(--accent);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-light);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

/* Footer */
.footer {
  background: var(--text);
  color: white;
  padding: 3rem 1rem;
  margin-top: 4rem;
}

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

.footer h4 {
  color: white;
  margin-bottom: 1rem;
  font-size: 1rem;
}

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

.footer a:hover {
  color: white;
}

.footer-bottom {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
  }

  .search-form {
    flex: 1;
  }

  .search-input {
    width: 100%;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .articles-grid {
    grid-template-columns: 1fr;
  }

  .article-header h1 {
    font-size: 1.75rem;
  }
}

/* Utilities */
.text-center { text-align: center; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* ============================================
   Home Page Layout with Sidebar
   ============================================ */

.home-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

.main-content {
  min-width: 0; /* Prevent grid blowout */
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.sidebar-section h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--primary);
}

.sidebar-categories {
  list-style: none;
}

.sidebar-categories li {
  margin-bottom: 0.5rem;
}

.sidebar-categories a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  color: var(--text);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s;
}

.sidebar-categories a:hover {
  color: var(--accent);
}

.sidebar-categories .count {
  background: var(--background);
  color: var(--text-muted);
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.view-all-link {
  display: block;
  text-align: center;
  margin-top: 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
}

/* ============================================
   Subscribe Widget
   ============================================ */

.subscribe-widget {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  color: white;
}

.subscribe-widget h4 {
  color: white;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.subscribe-widget p {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.subscribe-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.subscribe-form input {
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  width: 100%;
}

.subscribe-form input:focus {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}

.subscribe-form button {
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.subscribe-form button:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}

.subscribe-note {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 0.75rem;
  margin-bottom: 0;
  text-align: center;
}

/* ============================================
   Editorial Featured Section
   ============================================ */

.editorial-featured {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
}

.editorial-label {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

.editorial-featured h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.editorial-excerpt {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-light);
  margin-bottom: 1.25rem;
}

.editorial-link {
  display: inline-block;
  font-weight: 600;
  color: var(--accent);
  transition: color 0.2s;
}

.editorial-link:hover {
  color: var(--primary);
}

/* ============================================
   Editorial Detail Page
   ============================================ */

.editorial-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.editorial-header {
  margin-bottom: 2.5rem;
  text-align: center;
}

.editorial-header h1 {
  font-size: 2.25rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.editorial-meta {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

.editorial-content {
  font-size: 1.1rem;
  line-height: 1.9;
}

.editorial-content p {
  margin-bottom: 1.5rem;
}

.editorial-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.editorial-cta {
  background: var(--background);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
}

.editorial-cta h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.editorial-cta p {
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

/* ============================================
   Inline Subscribe Form
   ============================================ */

.inline-subscribe {
  display: flex;
  gap: 0.75rem;
  max-width: 450px;
  margin: 0 auto;
}

.inline-subscribe input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.inline-subscribe input:focus {
  outline: none;
  border-color: var(--accent);
}

.inline-subscribe button {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.inline-subscribe button:hover {
  background: var(--primary);
}

/* ============================================
   Responsive - Sidebar Layout
   ============================================ */

@media (max-width: 900px) {
  .home-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: -1;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar > * {
    flex: 1;
    min-width: 280px;
  }

  .editorial-featured {
    padding: 1.5rem;
  }

  .editorial-featured h2 {
    font-size: 1.25rem;
  }
}

@media (max-width: 600px) {
  .inline-subscribe {
    flex-direction: column;
  }

  .inline-subscribe button {
    width: 100%;
  }

  .editorial-header h1 {
    font-size: 1.75rem;
  }

  .editorial-meta {
    flex-direction: column;
    gap: 0.25rem;
  }

  .sidebar {
    flex-direction: column;
  }

  .sidebar > * {
    min-width: 100%;
  }
}
