html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Accessibility: Keyboard Navigation */
.keyboard-navigation *:focus {
  outline: 2px solid #258cfb;
  outline-offset: 2px;
}

.keyboard-navigation button:focus,
.keyboard-navigation a:focus,
.keyboard-navigation input:focus,
.keyboard-navigation select:focus,
.keyboard-navigation textarea:focus {
  outline: 2px solid #258cfb;
  outline-offset: 2px;
}

/* Skip to main content link */
.skip-to-main {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 10000;
  border-radius: 0 0 4px 0;
}

.skip-to-main:focus {
  top: 0;
}

/* Dark Mode Support */
[data-theme="dark"] {
  color-scheme: dark;
}

[data-theme="dark"] body {
  background-color: #1a1a1a;
  color: #e0e0e0;
}

[data-theme="dark"] .navbar-light {
  background-color: #2d2d2d !important;
  border-color: #404040 !important;
}

[data-theme="dark"] .navbar-light .navbar-brand,
[data-theme="dark"] .navbar-light .nav-link {
  color: #e0e0e0 !important;
}

[data-theme="dark"] .card {
  background-color: #2d2d2d;
  border-color: #404040;
  color: #e0e0e0;
}

[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom {
  border-color: #404040 !important;
}

[data-theme="dark"] .text-dark {
  color: #e0e0e0 !important;
}

[data-theme="dark"] .text-muted {
  color: #a0a0a0 !important;
}

/* Reading Progress Bar */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--bs-primary, #0d6efd);
  z-index: 10000;
  transition: width 0.1s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Toast Notifications */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.toast-notification {
  animation: slideIn 0.3s ease;
}

/* Post Loader Spinner */
.post-loader-spinner {
  text-align: center;
  padding: 2rem;
}

/* Table of Contents */
.table-of-contents {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin: 2rem 0;
}

[data-theme="dark"] .table-of-contents {
  background: #2d2d2d;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-item {
  margin: 0.5rem 0;
}

.toc-item a {
  color: inherit;
  text-decoration: none;
  display: block;
  padding: 0.25rem 0;
  transition: color 0.2s ease;
}

.toc-item a:hover,
.toc-item a.active {
  /* Colors will be set by theme.css or layout inline styles to match header/footer */
  font-weight: 500;
  /* Remove Bootstrap primary color override */
  background-color: inherit;
}

.toc-h2 {
  font-weight: 600;
}

.toc-h3 {
  padding-left: 1rem;
  font-size: 0.9em;
}

/* Dark Mode Toggle Button */
[data-dark-mode-toggle] {
  border: none;
  background: transparent;
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-dark-mode-toggle]:hover {
  opacity: 0.7;
}

[data-dark-mode-toggle]:focus {
  outline: 2px solid #258cfb;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Post Cards */
.post-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid #e9ecef;
  overflow: hidden;
}

.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15) !important;
}

.post-card-image-wrapper {
  position: relative;
  overflow: hidden;
  background-color: #f8f9fa;
}

.post-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.post-card-title a {
  color: inherit;
  transition: color 0.2s ease;
}

.post-card-title a:hover {
  color: var(--bs-primary, #0d6efd);
}

.post-card-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.5em;
}

.post-card-meta {
  font-size: 0.875rem;
}

.post-card-meta a {
  transition: color 0.2s ease;
}

.post-card-meta a:hover {
  color: var(--bs-primary, #0d6efd) !important;
}

/* Featured Post Card */
.featured-post-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}

.featured-post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2) !important;
}

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

.featured-post-image {
  transition: transform 0.5s ease;
}

.featured-post-card:hover .featured-post-image {
  transform: scale(1.08);
}

.featured-post-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
  pointer-events: none;
}

.featured-post-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

.featured-post-title a {
  color: inherit;
  transition: color 0.2s ease;
}

.featured-post-title a:hover {
  color: var(--bs-primary, #0d6efd);
}

.featured-post-excerpt {
  font-size: 1.1rem;
  line-height: 1.6;
}

/* Category Section */
.category-section {
  margin-bottom: 3rem;
}

.section-heading {
  font-size: 1.75rem;
  font-weight: 700;
  color: #212529;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #212529;
}

/* Category Badge */
.category-badge {
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.category-badge:hover {
  transform: scale(1.05);
}

/* Post Card Tags */
.post-card-tags .badge {
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.post-card-tags .badge:hover {
  transform: scale(1.05);
  background-color: var(--bs-primary, #0d6efd) !important;
}

/* Dark Mode Support for Post Cards */
[data-theme="dark"] .post-card {
  background-color: #2d2d2d;
  border-color: #404040;
  color: #e0e0e0;
}

[data-theme="dark"] .post-card-image-wrapper {
  background-color: #1a1a1a;
}

[data-theme="dark"] .section-heading,
[data-theme="dark"] .section-title {
  color: #e0e0e0;
}

[data-theme="dark"] .post-card-title a,
[data-theme="dark"] .featured-post-title a {
  color: #e0e0e0;
}

[data-theme="dark"] .post-card-title a:hover,
[data-theme="dark"] .featured-post-title a:hover {
  color: #6ea8fe;
}

/* Post List Card */
.post-list-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid #e9ecef;
  overflow: hidden;
}

.post-list-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15) !important;
}

.post-list-image-wrapper {
  position: relative;
  overflow: hidden;
  background-color: #f8f9fa;
  height: 100%;
  min-height: 200px;
}

.post-list-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.post-list-title {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
}

.post-list-title a {
  color: inherit;
  transition: color 0.2s ease;
}

.post-list-title a:hover {
  color: var(--bs-primary, #0d6efd);
}

.post-list-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.5em;
}

.post-list-meta {
  font-size: 0.875rem;
}

.post-list-meta a {
  transition: color 0.2s ease;
}

.post-list-meta a:hover {
  color: var(--bs-primary, #0d6efd) !important;
}

/* Page Header */
.page-header {
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #e9ecef;
  margin-bottom: 2rem;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #212529;
  margin-bottom: 0.5rem;
}

.page-description {
  font-size: 1.1rem;
  color: #6c757d;
}

/* Pagination Enhancements */
.pagination {
  margin-top: 2rem;
}

.page-link {
  color: var(--bs-primary, #0d6efd);
  transition: all 0.2s ease;
}

.page-link:hover {
  background-color: var(--bs-primary, #0d6efd);
  color: white;
  transform: translateY(-2px);
}

.page-item.active .page-link {
  background-color: var(--bs-primary, #0d6efd);
  border-color: var(--bs-primary, #0d6efd);
}

.page-item.disabled .page-link {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Dark Mode Support for Post List */
[data-theme="dark"] .post-list-card {
  background-color: #2d2d2d;
  border-color: #404040;
  color: #e0e0e0;
}

[data-theme="dark"] .post-list-image-wrapper {
  background-color: #1a1a1a;
}

[data-theme="dark"] .page-header {
  border-bottom-color: #404040;
}

[data-theme="dark"] .page-title {
  color: #e0e0e0;
}

[data-theme="dark"] .post-list-title a {
  color: #e0e0e0;
}

[data-theme="dark"] .post-list-title a:hover {
  color: #6ea8fe;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .featured-post-title {
    font-size: 1.5rem;
  }
  
  .featured-post-excerpt {
    font-size: 1rem;
  }
  
  .section-heading,
  .section-title {
    font-size: 1.5rem;
  }
  
  .post-card-image {
    height: 180px;
  }
  
  .page-title {
    font-size: 2rem;
  }
  
  .post-list-title {
    font-size: 1.25rem;
  }
  
  .post-list-image-wrapper {
    min-height: 180px;
  }
  
  .post-list-card .row {
    flex-direction: column;
  }
  
  .post-list-card .col-md-4,
  .post-list-card .col-md-8 {
    width: 100%;
  }
}

/* Cookie Notification */
.cookie-notification {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 1050;
  background-color: #fff;
  border-top: 1px solid #dee2e6;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  padding: 1rem 0;
  display: none;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.cookie-notification-top {
  top: 0;
  border-top: none;
  border-bottom: 1px solid #dee2e6;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transform: translateY(-100%);
}

.cookie-notification-bottom {
  bottom: 0;
}

.cookie-notification-visible {
  opacity: 1;
  transform: translateY(0);
}

.cookie-notification-top.cookie-notification-visible {
  transform: translateY(0);
}

.cookie-notification-hidden {
  opacity: 0;
}

.cookie-notification-bottom.cookie-notification-hidden {
  transform: translateY(100%);
}

.cookie-notification-top.cookie-notification-hidden {
  transform: translateY(-100%);
}

.cookie-notification-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.cookie-notification-message {
  flex: 1;
  min-width: 250px;
}

.cookie-notification-message p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.cookie-notification-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cookie-notification-actions .btn {
  white-space: nowrap;
}

/* Dark mode support for cookie notification */
[data-theme="dark"] .cookie-notification {
  background-color: #2d2d2d;
  border-color: #404040;
  color: #e0e0e0;
}

[data-theme="dark"] .cookie-notification .btn-outline-secondary {
  border-color: #404040;
  color: #e0e0e0;
}

[data-theme="dark"] .cookie-notification .btn-outline-secondary:hover {
  background-color: #404040;
  border-color: #404040;
  color: #fff;
}

/* Responsive design */
@media (max-width: 768px) {
  .cookie-notification-content {
    flex-direction: column;
    align-items: stretch;
  }
  
  .cookie-notification-message {
    margin-bottom: 0.75rem;
  }
  
  .cookie-notification-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  
  .cookie-notification-actions .btn {
    flex: 1;
    min-width: 100px;
  }
}