/* =============================================================
   THE PULSE — PREMIUM DESIGN SYSTEM (FINAL & STABLE)
   Modern, Clean, and High-Performance
   ============================================================= */

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

:root {
  --color-primary: #2563EB;
  --color-primary-dark: #1D4ED8;
  --color-primary-light: #EFF6FF;
  --color-secondary: #7C3AED;
  --color-secondary-light: #F5F3FF;
  --color-accent: #059669;
  --color-bg: #FFFFFF;
  --color-bg-soft: #F8FAFC;
  --color-bg-gray: #F1F5F9;
  --color-border: #E2E8F0;
  --color-text: #1E293B;
  --color-text-muted: #64748B;
  --color-text-light: #94A3B8;
  --color-heading: #0F172A;

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Merriweather', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;

  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --radius-md: 12px;
  --radius-full: 9999px;

  /* Badge Colors */
  --badge-tech-bg: #EFF6FF;
  --badge-tech-text: #2563EB;
  --badge-movies-bg: #F5F3FF;
  --badge-movies-text: #7C3AED;
  --badge-reviews-bg: #ECFDF5;
  --badge-reviews-text: #059669;
  --badge-news-bg: #FFF7ED;
  --badge-news-text: #D97706;
  --badge-premium-bg: #FEF3C7;
  --badge-premium-text: #92400E;

  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --header-height: 80px;
  --sidebar-width: 340px;

  /* Theme Specific Base */
  --header-bg: rgba(255, 255, 255, 0.9);
  --card-bg: #FFFFFF;
  --glass-bg: rgba(255, 255, 255, 0.8);
}

/* Dark Mode Variables */
[data-theme="dark"] {
  --color-bg: #0F172A;
  --color-bg-soft: #1E293B;
  --color-bg-gray: #334155;
  --color-border: #334155;
  --color-text: #F8FAFC;
  --color-text-muted: #94A3B8;
  --color-text-light: #64748B;
  --color-heading: #FFFFFF;

  --color-primary-light: rgba(37, 99, 235, 0.15);

  --header-bg: rgba(15, 23, 42, 0.9);
  --card-bg: #1E293B;
  --glass-bg: rgba(15, 23, 42, 0.8);

  /* Dark Badge Overrides */
  --badge-tech-bg: rgba(37, 99, 235, 0.2);
  --badge-tech-text: #60A5FA;
  --badge-movies-bg: rgba(124, 58, 237, 0.2);
  --badge-movies-text: #A78BFA;
  --badge-reviews-bg: rgba(5, 150, 105, 0.2);
  --badge-reviews-text: #34D399;
  --badge-news-bg: rgba(217, 119, 6, 0.2);
  --badge-news-text: #FBBF24;
  --badge-premium-bg: rgba(245, 158, 11, 0.2);
  --badge-premium-text: #FDE68A;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-heading);
  font-weight: 800;
  line-height: 1.2;
}

/* Desktop Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1100;
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.logo-text span {
  color: var(--color-primary);
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-links a {
  padding: 8px 16px;
  font-weight: 600;
  color: var(--color-text-muted);
  border-radius: 8px;
}

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

.header-search {
  position: relative;
  flex: 1;
  max-width: 280px;
}

.header-search input {
  width: 100%;
  padding: 12px 18px 12px 42px;
  font-family: inherit;
  font-size: .95rem;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  background: var(--color-bg-gray);
  outline: none;
}

.header-search .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-light);
  display: flex;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Theme Toggle */
.theme-toggle-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-bg-gray);
  border: 1px solid var(--color-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: 300ms;
}

.theme-toggle-btn:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.sun-icon,
.moon-icon {
  position: absolute;
  transition: 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .sun-icon {
  transform: translateY(40px);
  opacity: 0;
}

[data-theme="light"] .moon-icon {
  transform: translateY(0);
  opacity: 1;
  color: #1E293B;
}

[data-theme="dark"] .sun-icon {
  transform: translateY(0);
  opacity: 1;
  color: #FBBF24;
}

[data-theme="dark"] .moon-icon {
  transform: translateY(-40px);
  opacity: 0;
}

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  background: linear-gradient(to right, var(--color-primary), var(--color-secondary));
  z-index: 2000;
  transition: width 100ms linear;
}

/* User UI */
#user-section,
#mobile-user-section {
  display: none;
}

body.user-logged-in #user-section,
body.user-logged-in #mobile-user-section {
  display: flex !important;
}

body.user-logged-in #auth-btn,
body.user-logged-in #mobile-auth-btn {
  display: none !important;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 100px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--color-primary-light);
  transition: 200ms;
}

.user-profile:hover .user-avatar {
  border-color: var(--color-primary);
  transform: scale(1.05);
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name {
  font-weight: 700;
  font-size: .85rem;
  color: var(--color-heading);
}

.logout-link {
  font-size: .7rem;
  color: var(--color-text-muted);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  padding: 0;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  font-weight: 700;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  transition: 200ms;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Mobile Menu */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  z-index: 1200;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-heading);
  border-radius: 2px;
  transition: 300ms;
}

.hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-nav {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  background: var(--color-bg);
  z-index: 1150;
  padding: 100px 30px 50px;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
  transform: translateX(100%);
  transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-nav.open {
  transform: translateX(0);
}

.mobile-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 12px;
  background: var(--color-bg-soft);
}

.mobile-nav .user-profile {
  margin-bottom: 16px;
  background: #fff;
}

/* ===================== HERO SECTION ==================== */
.hero {
  padding: 80px 0;
  background: radial-gradient(circle at top right, rgba(124, 58, 237, 0.05), transparent),
    radial-gradient(circle at bottom left, rgba(37, 99, 235, 0.05), transparent);
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 64px;
  align-items: center;
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: .85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--color-primary);
  margin-bottom: 24px;
}

.hero-label::before {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--color-primary);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  letter-spacing: -0.04em;
  margin-bottom: 24px;
}

.hero-title span {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 1.2rem;
  color: var(--color-text-muted);
  margin-bottom: 40px;
  max-width: 540px;
}

.hero-stats {
  display: flex;
  gap: 48px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--color-border);
}

.hero-stat-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-heading);
  line-height: 1;
}

.hero-stat-label {
  font-size: .85rem;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 4px;
}

.hero-featured-card {
  background: var(--card-bg);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.15);
  transform: rotate(2deg);
  transition: 500ms cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.hero-featured-card:hover {
  transform: rotate(0) translateY(-10px);
}

.hero-featured-card img {
  height: 320px;
  width: 100%;
  object-fit: cover;
}

.hero-card-body {
  padding: 32px;
}

/* ===================== CATEGORY NAV ==================== */
.cat-nav {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: var(--header-height);
  z-index: 900;
  padding: 12px 0;
}

@media (max-width: 768px) {
  .cat-nav {
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    padding: 12px 10px;
  }
}

.cat-nav-inner {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.cat-nav-inner::-webkit-scrollbar {
  display: none;
}

.cat-btn {
  padding: 10px 24px;
  border-radius: 100px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-weight: 700;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: 200ms;
}

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

.cat-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* ===================== BADGES & TAGS ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-tech {
  background: var(--badge-tech-bg);
  color: var(--badge-tech-text);
}

.badge-movies {
  background: var(--badge-movies-bg);
  color: var(--badge-movies-text);
}

.badge-reviews {
  background: var(--badge-reviews-bg);
  color: var(--badge-reviews-text);
}

.badge-news {
  background: var(--badge-news-bg);
  color: var(--badge-news-text);
}

.tag-chip {
  display: inline-flex;
  padding: 4px 10px;
  margin: 4px;
  background: var(--color-bg-gray);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: 200ms;
}

.tag-chip:hover {
  background: var(--color-heading);
  color: var(--color-bg);
  transform: translateY(-2px);
}

.post-card-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Grid & Cards */
.main-layout {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: 48px;
  padding: 48px 0;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

.post-card {
  background: var(--card-bg);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  overflow: hidden;
  transition: 300ms;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.badge-news {
  background: var(--badge-news-bg);
  color: var(--badge-news-text);
  border: 1px solid rgba(217, 119, 6, 0.1);
}

.post-card-image {
  position: relative;
  overflow: hidden;
}

.post-card-image img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

.post-card:hover .post-card-image img {
  transform: scale(1.05);
}

.post-card-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card-meta {
  display: flex;
  gap: 12px;
  font-size: .85rem;
  color: var(--color-text-light);
  margin-bottom: 12px;
}

.post-card-title {
  font-size: 1.25rem;
  margin-bottom: 12px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 64px;
}

.page-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg);
  font-weight: 700;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: 200ms;
}

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

.page-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.page-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Post Detail */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .95rem;
  color: var(--color-text-muted);
  margin-bottom: 24px;
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

.post-main-title {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  margin-bottom: 24px;
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

/* Post Header Meta */
.post-header {
  max-width: 820px;
  margin: 0 auto 32px;
}

.post-meta-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--color-text-muted);
}

.author-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.author-meta img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.post-content {
  background: var(--card-bg);
  padding: 50px;
  border-radius: 32px;
  border: 1px solid var(--color-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

.article-body {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 1.85;
  color: var(--color-text);
  max-width: 820px;
  margin: 0 auto;
}

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

.article-body h2 {
  font-size: 2rem;
  margin: 3.5rem 0 1.5rem;
  color: var(--color-heading);
  letter-spacing: -0.02em;
}

.article-body h3 {
  font-size: 1.6rem;
  margin: 3rem 0 1.2rem;
  color: var(--color-heading);
}

.article-body h4 {
  font-size: 1.25rem;
  margin: 2rem 0 1rem;
  color: var(--color-heading);
}

.article-body ul,
.article-body ol {
  margin-bottom: 2rem;
  padding-left: 1.5rem;
}

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

.article-body blockquote {
  margin: 3rem 0;
  padding: 24px 32px;
  background: var(--color-bg-soft);
  border-left: 5px solid var(--color-primary);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--color-heading);
  border-radius: 0 16px 16px 0;
  background-image: linear-gradient(to right, rgba(37, 99, 235, 0.03), transparent);
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 16px;
  margin: 3rem 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

.article-body figure {
  margin: 3rem 0;
}

.article-body figcaption {
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-top: 1rem;
}

.article-body pre {
  background: #0F172A;
  color: #F8FAFC;
  padding: 24px;
  border-radius: 16px;
  overflow-x: auto;
  margin: 2.5rem 0;
  font-family: 'Fira Code', monospace;
  font-size: 0.95rem;
  line-height: 1.6;
}

.article-body code:not(pre code) {
  background: var(--color-bg-gray);
  color: var(--color-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.95em;
}

.article-body strong {
  color: var(--color-heading);
  font-weight: 800;
}

.post-tags {
  margin: 60px auto;
  display: flex;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--color-border);
  padding-top: 32px;
  max-width: 820px;
}

.post-tag-label {
  font-weight: 800;
  color: var(--color-heading);
  font-size: 1rem;
}

/* Admin Actions */
.admin-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  padding: 16px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 16px;
}

.btn-edit {
  background: var(--color-bg-gray);
  color: var(--color-heading);
  font-size: .85rem;
  padding: 8px 16px;
}

.btn-delete {
  background: #FEF2F2;
  color: #DC2626;
  font-size: .85rem;
  padding: 8px 16px;
}

.btn-delete:hover {
  background: #DC2626;
  color: #fff;
}

.post-cover {
  max-width: 820px;
  margin: 32px auto 48px;
}

.post-cover img {
  width: 100%;
  aspect-ratio: 21 / 9;
  /* More cinematic, less vertically demanding */
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}

/* Share & Author Card */
.share-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 32px;
  background: var(--color-bg-soft);
  border-radius: 20px;
  margin: 4rem auto 0;
  max-width: 820px;
}

.share-label {
  font-weight: 800;
  color: var(--color-text-muted);
  margin-right: auto;
}

.share-btn {
  width: 44px;
  height: 44px;
  background: var(--color-bg-gray);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  color: var(--color-text);
  transition: 200ms;
}

.share-btn:hover {
  background: var(--color-primary);
  color: #fff;
  transform: translateY(-3px);
}

.author-card {
  display: flex;
  gap: 32px;
  padding: 48px;
  background: var(--card-bg);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  margin: 5rem auto 0;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  max-width: 820px;
}

.author-avatar-large {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 4px solid var(--color-bg-soft);
}

.author-details h3 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.author-socials {
  display: flex;
  gap: 16px;
  margin-top: 20px;
}

.author-socials a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-gray);
  color: var(--color-text);
  transition: 200ms;
}

.author-socials a:hover {
  background: var(--color-primary);
  color: #fff;
  transform: translateY(-2px);
}



/* Sidebar */
.sidebar-widget {
  background: var(--card-bg);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 32px;
}

.widget-title {
  font-size: 1.1rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-search {
  display: flex;
  gap: 8px;
}

.sidebar-search input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-soft);
  font-family: inherit;
  font-size: .9rem;
  outline: none;
  transition: all 200ms;
}

.sidebar-search input:focus {
  background: var(--color-bg);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.sidebar-search button {
  padding: 12px 20px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: 200ms;
}

.sidebar-search button:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
}

.cat-pill {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--color-bg-soft);
  border-radius: 12px;
  margin-bottom: 8px;
  font-weight: 700;
  cursor: pointer;
}

.cat-pill:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.cat-count {
  background: var(--color-bg-gray);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: .8rem;
}

/* Scroll To Top */
.scroll-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: 300ms;
  z-index: 1000;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top:hover {
  transform: translateY(-5px);
  background: var(--color-primary-dark);
}

/* Auth Modal */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.auth-card {
  background: var(--color-bg);
  padding: 56px;
  border-radius: 32px;
  width: 90%;
  max-width: 480px;
  position: relative;
  transform: translateY(30px) scale(0.95);
  transition: 500ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.15);
}

.auth-modal.active .auth-card {
  transform: translateY(0) scale(1);
}

.auth-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-bg-gray);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: 200ms;
}

.auth-close:hover {
  background: #FEE2E2;
  color: #EF4444;
  transform: rotate(90deg);
}

.auth-header {
  text-align: center;
  margin-bottom: 40px;
}

.auth-logo {
  width: 64px;
  height: 64px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 1.5rem;
}

.auth-header h2 {
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  color: var(--color-heading);
}

.auth-form .form-group {
  margin-bottom: 24px;
}

.auth-form label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--color-heading);
}

.auth-form input {
  width: 100%;
  padding: 14px 20px;
  border-radius: 12px;
  border: 1.5px solid var(--color-border);
  background: var(--color-bg-soft);
  font-family: inherit;
  font-size: 1rem;
  transition: 200ms;
}

.auth-form input:focus {
  background: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
  outline: none;
}

.auth-btn-full {
  width: 100%;
  padding: 16px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: 300ms;
  margin-top: 8px;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.2);
}

.auth-btn-full:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(37, 99, 235, 0.3);
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 24px 0;
  color: var(--color-text-light);
  font-size: 0.8rem;
  font-weight: 800;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--color-border);
}

.auth-divider span {
  padding: 0 16px;
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-heading);
  cursor: pointer;
  transition: 200ms;
}

.btn-google img {
  width: 20px;
  height: 20px;
}

.btn-google:hover {
  background: var(--color-bg-gray);
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* ===================== PROFILE PAGE ==================== */
.profile-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 48px;
  padding: 64px 0;
}

.profile-sidebar-card {
  background: var(--card-bg);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 32px;
  position: sticky;
  top: calc(var(--header-height) + 32px);
  text-align: center;
}

.profile-avatar-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
}

.profile-avatar-large {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--color-primary-light);
}

.edit-avatar-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 4px solid var(--card-bg);
}

.profile-details h1 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.profile-user-email {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
  display: block;
}

.profile-bio-text {
  font-size: 0.95rem;
  color: var(--color-text);
  margin-bottom: 32px;
  line-height: 1.6;
}

.profile-socials {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.profile-social-link {
  width: 40px;
  height: 40px;
  background: var(--color-bg-gray);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 200ms;
}

.profile-social-link:hover {
  background: var(--color-primary);
  color: #fff;
  transform: translateY(-2px);
}

.profile-content {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.dashboard-section {
  background: var(--card-bg);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: 40px;
}

.section-title {
  font-size: 1.25rem;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-edit-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.profile-edit-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-edit-form label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 4px;
}

.profile-edit-form input,
.profile-edit-form textarea {
  padding: 14px 18px;
  background: var(--color-bg-soft);
  border: 1.5px solid var(--color-border);
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--color-heading);
  transition: var(--transition-base);
  width: 100%;
}

.profile-edit-form input:hover,
.profile-edit-form textarea:hover {
  border-color: var(--color-text-light);
  background: var(--color-bg);
}

.profile-edit-form input:focus,
.profile-edit-form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-bg);
  box-shadow: 0 0 0 4px var(--color-primary-light);
  transform: translateY(-1px);
}

.profile-edit-form textarea {
  min-height: 140px;
  resize: vertical;
}

#save-profile-btn {
  margin-top: 12px;
  padding: 18px;
  justify-content: center;
}

.full-width {
  grid-column: span 2;
}

.user-posts-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.user-post-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px;
  background: var(--color-bg-gray);
  border-radius: 16px;
  transition: 200ms;
}

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

.user-post-thumb {
  width: 80px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
}

.user-post-info {
  flex: 1;
}

.user-post-title {
  font-weight: 700;
  font-size: 1rem;
  display: block;
}

.user-post-date {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

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

  .profile-sidebar-card {
    position: static;
  }
}

.auth-footer {
  text-align: center;
  margin-top: 32px;
}

.auth-footer button {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.auth-footer button span {
  color: var(--color-primary);
  font-weight: 800;
}

.auth-footer button:hover span {
  text-decoration: underline;
}

/* Filter Feedback Bar */
.filter-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--color-bg-soft);
  border: 1.5px solid var(--color-border);
  border-radius: 12px;
  font-size: 0.95rem;
}

.filter-status span strong {
  color: var(--color-primary);
}

.clear-filter-btn {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: 200ms;
}

.clear-filter-btn:hover {
  background: #FEE2E2;
  border-color: #FECACA;
  color: #EF4444;
}


/* Member Only / Gated Content */
.badge-premium {
  background: var(--badge-premium-bg);
  color: var(--badge-premium-text);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
}

.content-gate {
  position: relative;
  margin-top: -100px;
  padding-bottom: 50px;
}

.article-teaser {
  mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
  opacity: 0.8;
  pointer-events: none;
}

.gate-overlay {
  background: linear-gradient(to top, var(--color-bg) 60%, transparent);
  padding: 80px 20px;
  text-align: center;
  border-radius: 0 0 24px 24px;
}

.gate-card {
  background: var(--card-bg);
  max-width: 500px;
  margin: 0 auto;
  padding: 40px;
  border-radius: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--color-border);
}

.gate-icon {
  width: 60px;
  height: 60px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.gate-card h3 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  color: var(--color-heading);
}

.gate-card p {
  color: var(--color-text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* Newsletter Pop-up */
.newsletter-popup {
  position: fixed;
  bottom: 40px;
  right: 40px;
  width: 380px;
  background: var(--color-bg);
  padding: 32px;
  border-radius: 24px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
  z-index: 3000;
  transform: translateY(100px) scale(0.9);
  opacity: 0;
  visibility: hidden;
  transition: 600ms cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--color-border);
}

.newsletter-popup.active {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

.popup-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: var(--color-bg-gray);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: 200ms;
}

.popup-close:hover {
  background: #FEE2E2;
  color: #EF4444;
}

/* Manual Ad Zones */
.ad-zone {
  margin: 40px 0;
  text-align: center;
  background: var(--color-bg-soft);
  border: 1px dashed var(--color-border);
  border-radius: 12px;
  padding: 24px;
  position: relative;
}

.ad-zone::before {
  content: 'ADVERTISEMENT';
  position: absolute;
  top: -10px;
  left: 20px;
  background: var(--color-bg-gray);
  padding: 2px 8px;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  font-weight: 800;
  color: var(--color-text-muted);
  border-radius: 4px;
}

.ad-inline {
  display: block;
  max-width: 100%;
  background: var(--color-bg);
  border-radius: 8px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 0.85rem;
}

.ad-sidebar {
  min-height: 250px;
}

/* ===================== FOOTER ==================== */
.site-footer {
  background: #0F172A;
  color: rgba(148, 163, 184, 0.8);
  padding: 100px 0 50px;
  margin-top: 100px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 80px;
  margin-bottom: 80px;
}

.footer-brand .logo {
  margin-bottom: 24px;
}

.footer-brand .logo-text {
  color: #fff;
}

.footer-brand p {
  max-width: 360px;
  line-height: 1.8;
  color: #64748b;
}

.footer-col h4 {
  color: #fff;
  margin-bottom: 32px;
  font-size: 1.1rem;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-col a {
  color: #94A3B8;
  transition: 200ms;
}

.footer-col a:hover {
  color: #fff;
  padding-left: 5px;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .9rem;
}

/* ===================== ANIMATIONS ==================== */
@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.3);
    opacity: 0.5;
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }

  100% {
    background-position: 1000px 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
}

/* ===================== RESPONSIVE DESIGN ==================== */

/* Large Tablets & Narrow Laptops */
@media (max-width: 1200px) {
  .container {
    max-width: 95%;
  }

  .main-layout {
    gap: 32px;
  }
}

/* Tablets (Portrait) */
@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    margin-top: 64px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .sidebar-widget {
    margin-bottom: 0;
  }

  .sidebar-widget:last-child {
    grid-column: span 2;
  }
}

/* Mobile (Landscape & Large Phones) */
@media (max-width: 768px) {
  :root {
    --header-height: 70px;
  }

  .nav-links,
  .header-search,
  .site-header .user-profile {
    display: none;
  }

  .hamburger {
    display: flex;
  }

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

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

  .sidebar-widget:last-child {
    grid-column: span 1;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 48px;
  }

  .hero-content {
    order: 2;
  }

  .hero-featured-card {
    order: 1;
    transform: none;
    max-width: 500px;
    margin: 0 auto;
  }

  .hero-featured-card img {
    height: 250px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 48px;
    text-align: center;
  }

  .footer-brand p {
    margin: 0 auto;
  }

  .footer-col ul {
    align-items: center;
  }

  /* Post Detail Specifics on Mobile */
  .post-content {
    padding: 24px 0;
    border: none;
    box-shadow: none;
    background: transparent;
  }

  .post-cover {
    margin: 20px 0 32px;
  }

  .post-cover img {
    border-radius: 12px;
    aspect-ratio: 16 / 9;
  }

  .article-body {
    font-size: 1.15rem;
  }

  .author-card {
    flex-direction: column;
    text-align: center;
    padding: 32px 24px;
  }

  .author-avatar-large {
    width: 80px;
    height: 80px;
  }

  .share-bar {
    flex-wrap: wrap;
    justify-content: center;
    padding: 20px;
  }

  .share-label {
    width: 100%;
    margin-bottom: 12px;
    text-align: center;
  }
}

/* Small Mobile Phones (iPhone SE, etc.) */
@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .logo-text {
    font-size: 1.2rem;
  }

  .cat-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  .newsletter-popup {
    width: calc(100% - 32px);
    left: 16px;
    bottom: 16px;
    padding: 24px;
  }

  .auth-card {
    width: 95%;
    padding: 24px;
  }

  .post-main-title {
    font-size: 1.8rem;
  }

  .article-body blockquote {
    font-size: 1.15rem;
    padding: 20px;
  }

  .ad-zone {
    padding: 16px;
  }
}