:root {
  --primary-blue: #004e8a;
  --bright-cyan: #00b5ff;
  --deep-ocean: #00264d;
  --text-dark: #003366;
  --text-light: #e0f7fa;
  --bg-body: #f0f7ff;
  --card-bg: #ffffff;
  --img-bg: #eef7ff;
  --meta-color: #607d8b;
  --title-color: #004e8a;
  --input-bg: #ffffff;
  --select-bg: #f0f7ff;
  --border-color: rgba(0, 78, 138, 0.1);
  --gradient-ocean: linear-gradient(135deg, #003366 0%, #005c97 50%, #00b5ff 100%);
  --shadow-card: 0 5px 15px rgba(0, 78, 138, 0.1);
  --shadow-hover: 0 15px 30px rgba(0, 78, 138, 0.25);
}
[data-theme="dark"] {
  --bg-body: #0a101a;
  --card-bg: #151f2e;
  --img-bg: #1e2a3d;
  --text-dark: #cce0ff;
  --meta-color: #8ba4b6;
  --title-color: #e0f7fa;
  --input-bg: #151f2e;
  --select-bg: #1e2a3d;
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow-card: 0 5px 15px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 15px 30px rgba(0, 181, 255, 0.15);
}
body {
  font-family: 'Kanit', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-dark);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}
.pub-hero {
  background: var(--gradient-ocean);
  color: white;
  padding-top: 160px;
  padding-bottom: 80px;
  position: relative;
  overflow: visible;
  box-shadow: 0 10px 30px rgba(0, 78, 138, 0.3);
}
.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
}
.hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.1);
  padding: 5px 15px;
  border-radius: 4px;
  font-size: 0.85rem;
  margin-bottom: 15px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--text-light);
}
.hero-title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 15px;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  line-height: 1.2;
}
.hero-subtitle {
  font-size: 1.1rem;
  font-weight: 300;
  opacity: 0.95;
  max-width: 700px;
  margin: 0 auto;
  color: var(--text-light);
  display: block;
}
.hero-line {
  width: 80px;
  height: 4px;
  background: var(--bright-cyan);
  margin: 25px auto 0;
  box-shadow: 0 0 10px rgba(0, 181, 255, 0.5);
}
.main-content-wrapper {
  flex: 1 0 auto;
  position: relative;
  z-index: 10;
  padding-top: 40px;
}
.breadcrumb-glass {
  display: inline-flex;
  align-items: center;
  background: var(--card-bg);
  padding: 10px 25px;
  border-radius: 50px;
  box-shadow: var(--shadow-card);
  font-size: 0.95rem;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}
.bc-item {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.bc-item:hover {
  color: var(--bright-cyan);
}
.bc-item.active {
  color: var(--meta-color);
  font-weight: 400;
}
.bc-sep {
  margin: 0 10px;
  color: var(--border-color);
  font-size: 0.8rem;
}
.search-glass {
  background: var(--input-bg);
  padding: 8px;
  border-radius: 50px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
}
.search-select {
  border: none;
  background-color: var(--select-bg);
  color: var(--primary-blue);
  border-radius: 40px !important;
  padding-left: 15px;
  padding-right: 35px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  min-width: 150px;
  transition: background-color 0.3s ease;
}
.search-select:focus {
  box-shadow: none;
}
[data-theme="dark"] .search-select option {
  background-color: var(--card-bg);
  color: var(--text-dark);
}
.search-input {
  border: none;
  box-shadow: none !important;
  padding-left: 15px;
  font-size: 0.95rem;
  color: var(--text-dark);
  background: transparent;
}
.search-input::placeholder {
  color: var(--meta-color);
  opacity: 0.7;
}
.btn-search {
  background: var(--primary-blue);
  color: white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  border: none;
  margin-right: 2px;
}
.btn-search:hover {
  background: var(--bright-cyan);
  color: white;
  transform: rotate(10deg);
}
@media (max-width: 768px) {
  .d-flex.flex-wrap.justify-content-between {
    flex-direction: column;
    align-items: stretch !important;
    gap: 15px;
  }
  .breadcrumb-glass, .search-glass {
    width: 100%;
    justify-content: center;
  }
  .search-select {
    flex: 1;
  }
}
.pub-card {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
}
.pub-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(0, 181, 255, 0.3);
}
.pub-img-box {
  position: relative;
  padding-top: 130%;
  background: var(--img-bg);
  overflow: hidden;
  transition: background-color 0.3s ease;
}
.pub-img-box img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.pub-card:hover .pub-img-box img {
  transform: scale(1.05);
}
.pub-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 51, 102, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.pub-card:hover .pub-overlay {
  opacity: 1;
}
.btn-read {
  background: white;
  color: var(--primary-blue);
  padding: 8px 25px;
  border-radius: 30px;
  text-decoration: none;
  font-weight: 600;
  transform: translateY(10px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.pub-card:hover .btn-read {
  transform: translateY(0);
}
.btn-read:hover {
  background: var(--bright-cyan);
  color: white;
}
.pub-body {
  padding: 1.25rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}
.pub-meta {
  font-size: 0.8rem;
  color: var(--meta-color);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  transition: color 0.3s ease;
}
.pub-meta i {
  color: var(--bright-cyan);
  margin-right: 5px;
}
.pub-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 15px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: auto;
  min-height: 4.2em;
  color: var(--title-color);
  transition: color 0.3s ease;
}
.pub-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  transition: border-color 0.3s ease;
}
.pub-cat {
  background: rgba(0, 181, 255, 0.1);
  color: var(--primary-blue);
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 500;
}
[data-theme="dark"] .pub-cat {
  background: rgba(0, 181, 255, 0.2);
  color: var(--bright-cyan);
}
.btn-download {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--primary-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.3s;
  border: 1px solid var(--border-color);
}
.btn-download:hover {
  background: var(--gradient-ocean);
  color: white;
  border-color: transparent;
  box-shadow: 0 5px 10px rgba(0, 78, 138, 0.3);
}
[data-theme="dark"] .btn-download:hover {
  box-shadow: 0 5px 10px rgba(0, 181, 255, 0.2);
}
.pagination-wrapper {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}
.pagination-wrapper a, .pagination-wrapper span {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: auto;
  min-width: 42px;
  height: 42px;
  padding: 0 16px;
  border-radius: 50px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.3s ease;
  background: var(--card-bg);
  color: var(--primary-blue);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
}
[data-theme="dark"] .pagination-wrapper a, [data-theme="dark"] .pagination-wrapper span.active {
  color: var(--bright-cyan);
}
.pagination-wrapper a:hover {
  background: var(--gradient-ocean);
  color: white !important;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 181, 255, 0.3);
}
.pagination-wrapper span.active {
  background: var(--primary-blue);
  color: white !important;
  border-color: var(--primary-blue);
  cursor: default;
  box-shadow: 0 4px 10px rgba(0, 78, 138, 0.4);
}
.pagination-wrapper span.pagination-dots {
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--primary-blue);
  min-width: 20px;
}
 .loading-overlay {
            position: absolute;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(255,255,255,0.7);
            backdrop-filter: blur(2px);
            z-index: 50;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            padding-top: 100px;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
            border-radius: 12px;
        }
        .loading-overlay.active {
            opacity: 1;
            pointer-events: all;
        }
        .spinner-custom {
            width: 3rem;
            height: 3rem;
            border: 4px solid rgba(0, 78, 138, 0.1);
            border-left-color: #00b5ff;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }
        @keyframes spin { 100% { transform: rotate(360deg); } }
        .content-container { position: relative; min-height: 300px; }