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

/* Color Variables & Theme System */
:root {
  /* Light Theme variables (default) */
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --primary-brand: #dc2626; /* News Red */
  --primary-hover: #b91c1c;
  --primary-light: #fef2f2;
  --accent: #2563eb; /* Alert blue */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-serif: 'Merriweather', Georgia, serif;
  --font-sans: 'Inter', system-ui, sans-serif;
  --sidebar-width: 320px;
}

[data-theme="dark"] {
  /* Dark Theme overrides */
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --primary-brand: #f87171;
  --primary-hover: #ef4444;
  --primary-light: #451a1a;
  --accent: #3b82f6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  transition: var(--transition-smooth);
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: 100%;
}

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

/* Layout Utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header & Navigation Styles */
.header-wrapper {
  background-color: var(--card-bg);
  border-bottom: 3px solid var(--primary-brand);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.logo-link {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 28px;
  color: var(--primary-brand);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.5px;
}

.logo-sub {
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-weight: 400;
}

.search-theme-control {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-box {
  position: relative;
}

.search-input {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px 8px 36px;
  border-radius: 20px;
  font-size: 14px;
  width: 220px;
  transition: var(--transition-smooth);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-brand);
  width: 280px;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.theme-toggle-btn:hover {
  background-color: var(--bg-color);
  color: var(--primary-brand);
  border-color: var(--primary-brand);
}

.nav-bar {
  display: flex;
  overflow-x: auto;
  white-space: nowrap;
  padding: 8px 0;
  scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.nav-bar::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari */
}

.nav-link {
  font-weight: 600;
  font-size: 15px;
  padding: 8px 16px;
  color: var(--text-main);
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}

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

.sticky-home {
  position: sticky;
  left: 0;
  z-index: 10;
  background-color: var(--card-bg);
}
.sticky-home.active {
  background-color: var(--primary-light);
}
.sticky-home::after {
  content: '';
  position: absolute;
  right: -10px;
  top: 0;
  bottom: 0;
  width: 10px;
  background: linear-gradient(to right, rgba(255,255,255,0.95), transparent);
  pointer-events: none;
}
[data-theme="dark"] .sticky-home::after {
  background: linear-gradient(to right, rgba(30,41,59,0.95), transparent);
}

/* Breaking News Ticker */
.breaking-ticker {
  background-color: var(--primary-brand);
  color: #ffffff;
  display: flex;
  align-items: center;
  height: 40px;
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
}

.breaking-label {
  background-color: #7f1d1d;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  z-index: 2;
  white-space: nowrap;
  animation: pulse-red 2s infinite;
}

.ticker-content-wrapper {
  overflow: hidden;
  flex-grow: 1;
  display: flex;
  align-items: center;
}

.ticker-items {
  display: inline-flex;
  white-space: nowrap;
  animation: ticker-slide 25s linear infinite;
}

.ticker-item {
  padding: 0 24px;
  color: #ffffff;
  border-right: 1px solid rgba(255, 255, 255, 0.3);
  transition: opacity 0.2s;
}

.ticker-item:hover {
  opacity: 0.8;
}

/* Main Layout Split */
.main-layout {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: 30px;
  padding: 24px 0 60px 0;
}

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

/* News Featured Grid */
.news-featured-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
  margin-bottom: 30px;
}

@media (max-width: 768px) {
  .news-featured-grid {
    grid-template-columns: 1fr;
  }
}

/* Hero Featured Card */
.hero-card {
  background-color: var(--card-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
}

.hero-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.hero-img-wrap {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.cat-pill {
  position: absolute;
  top: 16px;
  left: 16px;
  background-color: var(--primary-brand);
  color: #ffffff;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.hero-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-main);
  line-height: 1.35;
}

.hero-excerpt {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-top: auto;
}

/* Sub-featured stack */
.sub-featured-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.list-card {
  background-color: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: grid;
  grid-template-columns: 100px 1fr;
  overflow: hidden;
  height: 100px;
  transition: var(--transition-smooth);
}

.list-card:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
  border-color: var(--primary-brand);
}

.list-img-wrap {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.list-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.list-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.list-title {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-main);
}

.list-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* Category Sections styling */
.section-header {
  border-bottom: 2px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 8px;
  margin-bottom: 20px;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  position: relative;
  color: var(--text-main);
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 60px;
  height: 2px;
  background-color: var(--primary-brand);
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

/* Standard news card */
.news-card {
  background-color: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
}

.news-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-brand);
}

.card-img-wrap {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background-color: #cbd5e1;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.news-card:hover .card-img {
  transform: scale(1.04);
}

.card-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.popular-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border-color);
}

.popular-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.popular-item:first-child {
  padding-top: 0;
}

.popular-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0.5;
  line-height: 1;
  width: 24px;
  text-align: center;
}

.popular-item:nth-child(-n+3) .popular-num {
  color: var(--primary-brand);
  opacity: 0.8;
}

.popular-info {
  flex-grow: 1;
}

.popular-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.popular-title:hover {
  color: var(--primary-brand);
}

.popular-views {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Article Detail Page Layout */
.article-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 30px 20px 60px 20px;
}

.article-header {
  margin-bottom: 24px;
}

.article-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-main);
  margin-top: 12px;
  margin-bottom: 16px;
}

@media (max-width: 600px) {
  .article-title {
    font-size: 24px;
  }
}

.article-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  padding: 12px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.article-views {
  margin-left: auto;
  font-weight: 500;
}

.article-img-frame {
  margin-bottom: 30px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.article-body-content {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.85;
  color: var(--text-main);
}

/* CKEditor generated content - proper spacing */
.article-body-content p {
  margin-bottom: 1.1em;
  margin-top: 0;
}
.article-body-content p:empty,
.article-body-content p:has(br:only-child),
.article-body-content h1:empty,
.article-body-content h2:empty,
.article-body-content h3:empty {
  display: none;
}
.article-body-content h1,
.article-body-content h2,
.article-body-content h3,
.article-body-content h4 {
  font-family: var(--font-serif);
  margin-top: 1.4em;
  margin-bottom: 0.5em;
  line-height: 1.3;
  color: var(--text-main);
}
.article-body-content h1 { font-size: 24px; }
.article-body-content h2 { font-size: 20px; }
.article-body-content h3 { font-size: 18px; }
.article-body-content ul,
.article-body-content ol {
  padding-left: 24px;
  margin-bottom: 1em;
}
.article-body-content li {
  margin-bottom: 0.4em;
}
.article-body-content blockquote {
  border-left: 4px solid var(--primary-brand);
  margin: 1.2em 0;
  padding: 10px 16px;
  background: var(--primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
}
.article-body-content strong { font-weight: 700; }
.article-body-content em { font-style: italic; }
.article-body-content a {
  color: var(--accent);
  text-decoration: underline;
}
.article-body-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 1em 0;
}
/* CKEditor Highlight Markers */
.article-body-content mark,
.article-body-content .marker,
.article-body-content .marker-yellow {
  background-color: #ffff00 !important;
  color: #000000 !important;
}
.article-body-content .marker-green {
  background-color: #00ff00 !important;
  color: #000000 !important;
}
.article-body-content .marker-blue {
  background-color: #00ffff !important;
  color: #000000 !important;
}
/* Collapse excessive blank lines from br tags */
.article-body-content br + br {
  display: none;
}

/* Comments Styling */
.comments-section {
  margin-top: 50px;
  border-top: 2px solid var(--border-color);
  padding-top: 30px;
}

.comment-form {
  margin-bottom: 30px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: var(--radius-md);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-input, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  color: var(--text-main);
  transition: var(--transition-smooth);
}

.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary-brand);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.btn {
  background-color: var(--primary-brand);
  color: #ffffff;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: var(--border-color);
}

.btn-danger {
  background-color: #dc2626;
}

.btn-danger:hover {
  background-color: #b91c1c;
}

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

.comment-item {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-md);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}

.comment-author {
  font-weight: 600;
}

.comment-date {
  color: var(--text-muted);
}

.comment-body {
  font-size: 14px;
}

/* Admin Auth Panel */
.auth-panel {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.glass-auth-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 40px;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}

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

.auth-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

/* Admin Dashboard Interface */
.admin-dashboard-container {
  padding: 30px 0;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-icon {
  background-color: var(--primary-light);
  color: var(--primary-brand);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
}

/* Dashboard Workspace split */
.admin-workspace {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 30px;
}

@media (max-width: 768px) {
  .admin-workspace {
    grid-template-columns: 1fr;
  }
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-nav-btn {
  background: none;
  border: none;
  color: var(--text-main);
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.admin-nav-btn:hover, .admin-nav-btn.active {
  background-color: var(--primary-light);
  color: var(--primary-brand);
}

.admin-content {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 30px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 600px) {
  .admin-content {
    padding: 16px;
  }
}

/* Admin Lists & Tables */
.admin-section-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.admin-table th, .admin-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}

.admin-table th {
  font-weight: 600;
  color: var(--text-muted);
}

.admin-table tr:hover {
  background-color: var(--bg-color);
}

.badge {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-breaking {
  background-color: #fee2e2;
  color: #dc2626;
}

.badge-standard {
  background-color: #e2e8f0;
  color: #475569;
}

.admin-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.action-btn-edit:hover {
  color: var(--accent);
  background-color: #dbeafe;
}

.action-btn-delete:hover {
  color: #dc2626;
  background-color: #fee2e2;
}

/* Category Config layout */
.category-manager-split {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 30px;
}

@media (max-width: 768px) {
  .category-manager-split {
    grid-template-columns: 1fr;
  }
}

/* Alerts and Notifications */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
}

.alert-error {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-success {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

/* Image input preview styling */
.img-preview-box {
  margin-top: 10px;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 16/10;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 13px;
}

.img-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Animations */
@keyframes ticker-slide {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-50%, 0, 0);
  }
}

@keyframes pulse-red {
  0% {
    background-color: #7f1d1d;
  }
  50% {
    background-color: #b91c1c;
  }
  100% {
    background-color: #7f1d1d;
  }
}

/* Custom Scrollbar for global layouts */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================
   COMPREHENSIVE RESPONSIVE STYLES
   Mobile First: 320px → 480px → 768px → 992px → 1200px
   ============================================ */

/* ---- FRONTEND: Header ---- */
@media (max-width: 768px) {
  .top-bar {
    padding: 8px 0;
    flex-wrap: wrap;
    gap: 8px;
  }
  .logo-link span[style*="font-size: 24px"] {
    font-size: 18px !important;
  }
  .logo-link img {
    height: 36px !important;
    width: 36px !important;
  }
  .search-theme-control {
    gap: 6px !important;
  }
  .search-input {
    width: 150px;
    font-size: 13px;
  }
  .search-input:focus {
    width: 180px;
  }
  /* Hide WhatsApp text on small screens */
  .search-theme-control a.btn span,
  .search-theme-control a[style*="25D366"] {
    font-size: 12px !important;
    padding: 5px 10px !important;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }
  .logo-link span[style*="font-size"] {
    font-size: 16px !important;
  }
  .search-input {
    width: 120px;
    font-size: 12px;
  }
  /* WhatsApp button - only show icon on very small screens */
  .search-theme-control a[style*="25D366"] {
    padding: 6px 8px !important;
    font-size: 11px !important;
  }
}

/* ---- FRONTEND: Nav Bar ---- */
@media (max-width: 768px) {
  .nav-bar {
    padding: 6px 0;
    gap: 2px;
  }
  .nav-link {
    font-size: 13px;
    padding: 6px 10px;
  }
}

/* ---- FRONTEND: Breaking Ticker ---- */
@media (max-width: 480px) {
  .breaking-ticker {
    font-size: 12px;
    height: 34px;
  }
  .breaking-label {
    padding: 0 10px;
    font-size: 11px;
  }
}

/* ---- FRONTEND: Main Layout ---- */
@media (max-width: 992px) {
  .main-layout {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 16px 0 40px 0;
  }
}

/* ---- FRONTEND: Featured Grid ---- */
@media (max-width: 768px) {
  .news-featured-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
  }
  .hero-title {
    font-size: 18px;
  }
  .hero-info {
    padding: 14px;
  }
}

/* ---- FRONTEND: News Grid Cards ---- */
@media (max-width: 600px) {
  .news-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
  }
  .card-title {
    font-size: 13px;
  }
  .card-info {
    padding: 10px;
  }
  .card-desc {
    display: none;
  }
}

@media (max-width: 400px) {
  .news-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- FRONTEND: List Cards ---- */
@media (max-width: 480px) {
  .list-card {
    grid-template-columns: 80px 1fr;
    height: 80px;
  }
  .list-title {
    font-size: 12px;
  }
}

/* ---- FRONTEND: Article Detail Page ---- */
@media (max-width: 768px) {
  .article-container {
    padding: 16px 0 40px 0;
  }
  .article-title {
    font-size: 22px !important;
  }
  .article-body-content {
    font-size: 15px;
    line-height: 1.7;
  }
  /* Image slider on mobile: remove fixed height restriction, allow natural proportions */
  .post-img-slider {
    height: auto !important;
    max-height: none !important;
  }
  .post-img-slider img {
    /* Do NOT constrain height — let portrait images from mobile show fully */
    max-height: none !important;
    height: auto !important;
    width: 100% !important;
    object-fit: contain !important;
  }
}

@media (max-width: 480px) {
  .article-title {
    font-size: 18px !important;
  }
  .article-body-content {
    font-size: 14px;
  }
  /* Very small screens: images still show at full natural height */
  .post-img-slider {
    height: auto !important;
    max-height: none !important;
  }
  .post-img-slider img {
    max-height: none !important;
    height: auto !important;
    width: 100% !important;
  }
}

/* ---- FRONTEND: Sidebar ---- */
@media (max-width: 992px) {
  .sidebar-area {
    width: 100%;
  }
  .sidebar-section {
    margin-bottom: 16px;
  }
}

/* ---- FRONTEND: Section Headers ---- */
@media (max-width: 600px) {
  .section-title {
    font-size: 16px;
  }
  .section-header {
    margin-bottom: 14px;
  }
}

/* ---- FRONTEND: Footer ---- */
@media (max-width: 768px) {
  footer .container > div[style*="grid"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
  }
}
@media (max-width: 480px) {
  footer .container > div[style*="grid"] {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================
   ADMIN PANEL - RESPONSIVE
   ============================================ */

/* ---- ADMIN: Sidebar + Main Layout ---- */
@media (max-width: 900px) {
  /* Hide sidebar by default on mobile, toggle with button */
  .admin-layout {
    position: relative;
  }
  .admin-sidebar {
    position: fixed !important;
    left: -260px;
    top: 0;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }
  .admin-sidebar.sidebar-open {
    left: 0;
  }
  .admin-main {
    width: 100%;
  }
  /* Overlay when sidebar is open */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
  }
  .sidebar-overlay.active {
    display: block;
  }
  /* Mobile hamburger button */
  .admin-hamburger {
    display: flex !important;
  }
}

@media (min-width: 901px) {
  .admin-hamburger {
    display: none !important;
  }
  .sidebar-overlay {
    display: none !important;
  }
}

/* ---- ADMIN: Header ---- */
.admin-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: var(--text-main);
  font-size: 22px;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.admin-hamburger:hover {
  background: var(--hover-bg, rgba(0,0,0,0.06));
}

@media (max-width: 900px) {
  .admin-header {
    padding: 0 12px !important;
  }
  .admin-header h2 {
    font-size: 15px !important;
  }
  .admin-header .btn {
    font-size: 11px !important;
    padding: 5px 10px !important;
  }
}

/* ---- ADMIN: Content area ---- */
@media (max-width: 768px) {
  .admin-content {
    padding: 14px !important;
  }
}

/* ---- ADMIN: Forms ---- */
@media (max-width: 768px) {
  /* 2-column grids become 1-column */
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* Image upload fields stack */
  .form-group input[type="file"] {
    font-size: 13px;
  }
}

/* ---- CKEDITOR MOBILE FIXES ---- */
/* Allow text selection inside CKEditor iframe on mobile */
.cke_wysiwyg_frame,
.cke_wysiwyg_div {
  -webkit-user-select: text !important;
  user-select: text !important;
  touch-action: auto !important;
}

/* Make CKEditor toolbar buttons larger for touch */
@media (max-width: 768px) {
  .cke_contents {
    height: 220px !important;
    -webkit-overflow-scrolling: touch;
  }
  /* Toolbar buttons bigger for fingers */
  .cke_button {
    padding: 6px 8px !important;
  }
  .cke_toolbar {
    float: none !important;
  }
  /* Fix CKEditor container not clipping on mobile */
  .cke_editor, .cke {
    overflow: visible !important;
    touch-action: auto !important;
  }
  /* Ensure CKEditor popup/dialog sits on top */
  .cke_dialog_background_cover,
  .cke_dialog {
    z-index: 99999 !important;
    position: fixed !important;
  }
  /* Color picker panel fix */
  .cke_panel,
  .cke_colorblock {
    z-index: 99998 !important;
    position: fixed !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    max-width: 90vw !important;
    overflow-x: auto;
  }
}

@media (max-width: 480px) {
  /* Submit buttons full width on mobile */
  div[style*="margin-top: 30px"][style*="display: flex"] {
    flex-direction: column !important;
  }
  div[style*="margin-top: 30px"][style*="display: flex"] .btn,
  div[style*="margin-top: 30px"][style*="display: flex"] a.btn {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
  }
  .admin-content {
    padding: 10px !important;
  }
}

/* ---- ADMIN: Tables responsive ---- */
@media (max-width: 768px) {
  .admin-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .admin-table th,
  .admin-table td {
    padding: 8px 10px;
    font-size: 12px;
  }
  /* Card-style rows on very small screens */
}

@media (max-width: 520px) {
  /* Table becomes card list */
  .admin-table thead {
    display: none;
  }
  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td {
    display: block;
    width: 100%;
    white-space: normal;
  }
  .admin-table tr {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 4px 0;
    background: var(--card-bg);
  }
  .admin-table td {
    padding: 8px 12px;
    border-bottom: 1px dashed var(--border-color);
    font-size: 13px;
    text-align: right;
    position: relative;
    padding-left: 45%;
  }
  .admin-table td:last-child {
    border-bottom: none;
  }
  .admin-table td::before {
    content: attr(data-label);
    position: absolute;
    left: 12px;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    text-align: left;
    width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ---- ADMIN: Dashboard Stats ---- */
@media (max-width: 600px) {
  .dashboard-stats {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }
  .stat-card {
    padding: 14px !important;
    gap: 12px !important;
  }
  .stat-value {
    font-size: 20px !important;
  }
  .stat-icon {
    width: 40px !important;
    height: 40px !important;
    font-size: 16px !important;
  }
}

@media (max-width: 380px) {
  .dashboard-stats {
    grid-template-columns: 1fr !important;
  }
}

/* ---- ADMIN: Post Index - Image thumbnails ---- */
@media (max-width: 768px) {
  .admin-table td img {
    width: 40px !important;
    height: 40px !important;
  }
}

/* ---- ADMIN: Category manager split ---- */
@media (max-width: 768px) {
  .category-manager-split {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }
}

/* ---- GLOBAL: Touch-friendly buttons ---- */
@media (max-width: 900px) {
  .btn {
    min-height: 40px;
    padding: 10px 16px;
  }
  .action-btn {
    padding: 8px !important;
    font-size: 15px;
  }
  .admin-nav-item {
    padding: 14px 20px !important;
    font-size: 15px !important;
  }
}

/* ---- GLOBAL: Form inputs bigger on touch ---- */
@media (max-width: 900px) {
  .form-input,
  .form-textarea,
  input[type="text"],
  input[type="file"],
  input[type="email"],
  input[type="password"],
  select,
  textarea {
    min-height: 44px;
    font-size: 15px !important;
  }
  .form-label {
    font-size: 14px;
  }
}

/* ---- Max width container on tablets ---- */
@media (min-width: 768px) and (max-width: 992px) {
  .container {
    padding: 0 24px;
  }
  .main-layout {
    padding: 20px 0 40px 0;
  }
}

/* ============================================
   FOOTER STYLES
   ============================================ */
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.2fr;
  gap: 40px;
  padding: 44px 0 36px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-heading {
  font-weight: 700;
  font-size: 15px;
  color: var(--primary-brand);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-brand);
  display: inline-block;
  width: fit-content;
  margin-bottom: 2px;
}

.footer-link {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
  display: inline-block;
}
.footer-link:hover {
  color: var(--primary-brand);
  padding-left: 4px;
}

.footer-social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
  text-decoration: none;
  transition: transform 0.2s, opacity 0.2s;
  flex-shrink: 0;
}
.footer-social-icon:hover {
  transform: translateY(-3px);
  opacity: 0.85;
}

/* Footer responsive */
@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    padding: 32px 0 24px;
  }
}
@media (max-width: 560px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 0 20px;
  }
  .footer-social-icon {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }
}

