/* ============================================
   Upsonar Blog — Styles matching upsonar.io
   Light theme: bg #F2F2F2, text #0D0D0D
   Brand: #023059, #B4C0D9, #BF1111, #14b8a6
   ============================================ */

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

:root {
  --bg: #F2F2F2;
  --bg-card: #fafafa;
  --bg-muted: #ebebeb;
  --text: #0D0D0D;
  --text-muted: #666666;
  --primary: #023059;
  --primary-hover: #034078;
  --secondary: #B4C0D9;
  --border: #d4dae3;
  --success: #14b8a6;
  --destructive: #BF1111;
  --radius: 0.5rem;
  --font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

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

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

/* Tailwind "container" equivalent — responsive max-widths matching frontend */
.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 640px)  { .container { max-width: 640px; } }
@media (min-width: 768px)  { .container { max-width: 768px; } }
@media (min-width: 1024px) { .container { max-width: 1024px; } }
@media (min-width: 1280px) { .container { max-width: 1280px; } }
@media (min-width: 1536px) { .container { max-width: 1536px; } }

/* ============================================
   Red accent line (matches Layout.tsx: h-1 bg-destructive)
   ============================================ */
.accent-line {
  height: 4px;
  background: var(--destructive);
}

/* ============================================
   Header
   ============================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: rgba(242, 242, 242, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
@supports (backdrop-filter: blur(8px)) {
  .header { background: rgba(242, 242, 242, 0.60); }
}

.header-inner {
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
  height: 4rem; /* h-16 = 64px */
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/* Same responsive max-widths as .container (Tailwind default) */
@media (min-width: 640px)  { .header-inner { max-width: 640px; } }
@media (min-width: 768px)  { .header-inner { max-width: 768px; } }
@media (min-width: 1024px) { .header-inner { max-width: 1024px; } }
@media (min-width: 1280px) { .header-inner { max-width: 1280px; } }
@media (min-width: 1536px) { .header-inner { max-width: 1536px; } }

.header-left { display: flex; align-items: center; gap: 2rem; /* gap-8 = 32px */ }
.header-right { display: flex; align-items: center; gap: 0.75rem; }

.logo {
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
@media (min-width: 768px) { .logo { font-size: 1.5rem; line-height: 2rem; } }

.desktop-nav { display: flex; gap: 0.25rem; }

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover {
  color: var(--text);
  background: var(--secondary);
  text-decoration: none;
}
.nav-link-active {
  color: var(--text);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: var(--bg);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary:hover { background: rgba(2, 48, 89, 0.9); text-decoration: none; }
.btn-primary svg { flex-shrink: 0; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--bg-muted); text-decoration: none; }

/* Dropdown navigation */
.nav-dropdown { position: relative; }

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  height: 2.25rem;
  background: var(--bg);
  border: none;
  border-radius: 0.375rem;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.nav-dropdown:hover > .nav-dropdown-trigger {
  background: var(--secondary);
  color: var(--text);
}

.trigger-icon { width: 1rem; height: 1rem; margin-right: 0.375rem; flex-shrink: 0; }

.dropdown-arrow { position: relative; top: 1px; margin-left: 0.25rem; transition: transform 0.3s; flex-shrink: 0; }
.nav-dropdown:hover .dropdown-arrow { transform: rotate(180deg); }

.nav-dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  min-width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  padding: 0.5rem;
  z-index: 100;
}
.nav-dropdown-wide { min-width: 520px; }
.nav-dropdown:hover .nav-dropdown-content { display: block; }

.dropdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
}

.dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.375rem;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s;
}
.dropdown-item:hover { background: var(--bg-muted); text-decoration: none; }

.dropdown-item-simple {
  display: block;
  padding: 0.75rem;
  border-radius: 0.375rem;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s;
}
.dropdown-item-simple:hover { background: var(--bg-muted); text-decoration: none; }

.dropdown-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dropdown-icon-sm { width: 2rem; height: 2rem; }

.dropdown-item-title {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
}
.dropdown-item-desc {
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.badge-unique {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  background: rgba(20,184,166,0.1);
  color: #14b8a6;
  border-radius: 0.25rem;
  font-size: 0.625rem;
  font-weight: 600;
  vertical-align: middle;
  margin-left: 0.375rem;
}

.dropdown-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
}
.dropdown-footer a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
}
.dropdown-footer a:hover { text-decoration: underline; }

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

.mobile-nav {
  display: none;
  flex-direction: column;
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.mobile-nav a {
  color: var(--text-muted);
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  font-size: 0.9375rem;
}
.mobile-nav a:hover { color: var(--text); }
.mobile-nav.open { display: flex; }

.mobile-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 1rem 0 0.5rem;
}
.mobile-section-label:first-child { padding-top: 0; }

.mobile-auth { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }
.mobile-auth .btn-primary { justify-content: center; }

@media (max-width: 1024px) {
  .desktop-nav, .header-right { display: none; }
  .mobile-toggle { display: block; }
}

/* ============================================
   Footer
   ============================================ */
.footer {
  border-top: 1px solid var(--border);
  background: #eaeaea;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: 2rem;
}

.footer-brand .logo { display: inline-block; margin-bottom: 1rem; }
.footer-tagline { color: var(--text-muted); font-size: 0.875rem; line-height: 1.6; }

.footer-col h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.75rem; }
.footer-col a {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 0.15s;
}
.footer-col a:hover { color: var(--text); }

.footer-bottom {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; gap: 0.5rem; text-align: center; }
}

/* ============================================
   Blog Hero (list page)
   ============================================ */
.blog-hero {
  padding: 4rem 0 2rem;
  text-align: center;
}
.blog-hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.blog-hero-subtitle {
  color: var(--text-muted);
  font-size: 1.125rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================
   Blog List (post cards)
   ============================================ */
.blog-list { padding: 2rem 0 4rem; }

.posts-grid {
  display: grid;
  gap: 1.5rem;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.post-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(2, 48, 89, 0.08);
}

.post-card-link {
  display: block;
  padding: 2rem;
  color: var(--text);
  text-decoration: none;
}
.post-card-link:hover { text-decoration: none; }

.post-card-title {
  font-size: 1.375rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.post-card-description {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.post-card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.post-categories { margin-bottom: 0.75rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.post-category {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  background: var(--secondary);
  color: var(--primary);
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.read-time::before { content: "·"; margin-right: 0; }

/* ============================================
   Single Post
   ============================================ */
.blog-post { padding: 2rem 0 4rem; }

.breadcrumb {
  margin-bottom: 2rem;
}
.breadcrumb a {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-decoration: none;
}
.breadcrumb a:hover { color: var(--text); }

.post-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.post-header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}
.post-subtitle {
  color: var(--text-muted);
  font-size: 1.125rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}
.post-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ============================================
   Prose (article content)
   ============================================ */
.prose h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  padding-top: 1rem;
  color: var(--text);
}
.prose h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  color: var(--text);
}
.prose {
  line-height: 1.7;
}
.prose p {
  margin-bottom: 1.25rem;
  color: var(--text-muted);
  line-height: 1.8;
}
.prose strong { color: var(--text); font-weight: 600; }

.prose ul, .prose ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
  color: var(--text-muted);
}
.prose li { margin-bottom: 0.375rem; }

.prose blockquote {
  border-left: 3px solid var(--primary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--bg-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.prose blockquote p { margin-bottom: 0; }

.prose code {
  background: var(--bg-muted);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
}

.prose pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
.prose pre code { background: none; padding: 0; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
}
.prose th, .prose td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.prose th {
  font-weight: 600;
  color: var(--text);
  background: var(--bg-muted);
}
.prose td { color: var(--text-muted); }

.prose a { color: var(--primary); }
.prose a:hover { text-decoration: underline; }

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ============================================
   Post CTA
   ============================================ */
.post-cta {
  margin-top: 3rem;
  padding: 2rem;
  background: rgba(2, 48, 89, 0.04);
  border: 1px solid rgba(2, 48, 89, 0.15);
  border-radius: var(--radius);
  text-align: center;
}
.post-cta h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.post-cta p {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
}
.post-cta-buttons {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ============================================
   Related Posts
   ============================================ */
.related-posts {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.related-posts h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}
.related-card {
  display: block;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.related-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(2, 48, 89, 0.08);
  text-decoration: none;
}
.related-card h4 { color: var(--text); font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.375rem; }
.related-card p { color: var(--text-muted); font-size: 0.8125rem; line-height: 1.5; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 640px) {
  .blog-hero h1 { font-size: 1.875rem; }
  .post-header h1 { font-size: 1.75rem; }
  .post-card-link { padding: 1.5rem; }
  .prose h2 { font-size: 1.25rem; }
}
