/* ===================================
   🎨 PREMIUM NEWS PAGE STYLING
   Modern, Clean, Professional Design
   =================================== */

/* === Base Styles === */
:root {
  --primary-color: #4169e1;
  --secondary-color: #9400d3;
  --gradient-primary: linear-gradient(135deg, #4169e1, #9400d3);
  --gradient-light: linear-gradient(135deg, rgba(65, 105, 225, 0.1), rgba(148, 0, 211, 0.05));
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Mitr', sans-serif;
  background: linear-gradient(135deg, #f8f9ff 0%, #e8f0ff 100%);
  color: #2c3e50;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* === Navbar Styles === */
.nav-color {
  background: linear-gradient(to right, #4169e1, #9400d3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-brand {
  color: #fff !important;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition);
}

.navbar-brand:hover {
  transform: scale(1.05);
}

.navbar-logo {
  width: 36px;
  height: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.navbar-logo:hover {
  transform: scale(1.3);
  transition: scale 0.3s ease, transform 0.3s ease;
  filter: drop-shadow(0 8px 20px rgba(255, 255, 255, 0.5));
}

.navbar-nav .nav-link {
  color: #fff !important;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  position: relative;
  transition: var(--transition);
}

.navbar-nav .nav-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  width: 70%;
  height: 3px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
  color: #fff !important;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
}

.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after {
  transform: translateX(-50%) scaleX(1);
  opacity: 1;
}

/* Responsive: เส้นใต้อยู่ด้านซ้ายเมื่อเป็นแนวตั้ง */
@media (max-width: 991.98px) {
  .navbar-nav .nav-link::after {
    left: 18px;
    transform: translateX(0) scaleX(0);
    transform-origin: left;
    width: calc(100% - 36px);
  }

  .navbar-nav .nav-link:hover::after,
  .navbar-nav .nav-link.active::after {
    transform: translateX(0) scaleX(1);
  }
}

/* === Hero Banner === */
.hero-banner {
  background: linear-gradient(135deg,
    rgba(65, 105, 225, 0.95) 0%,
    rgba(148, 0, 211, 0.9) 100%),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.1)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,138.7C960,139,1056,117,1152,112C1248,107,1344,117,1392,122.7L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>');
  background-size: cover;
  background-position: center;
  padding: 60px 0;
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  animation: fadeInUp 0.6s ease-out;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 20px;
  line-height: 1.2;
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

.gradient-text {
  background: linear-gradient(90deg, #fff 0%, #e0e7ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

.hero-subtitle {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.6;
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

/* === Category Filters === */
.filter-section {
  padding: 30px 0;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 72px;
  z-index: 999;
}

.category-filters {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.category-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: #fff;
  border: 2px solid #e0e7ff;
  border-radius: 50px;
  font-weight: 600;
  color: #4169e1;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.category-btn:hover {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.category-btn.active {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-md);
}

.category-btn i {
  font-size: 16px;
}

/* === News Section === */
.news-section {
  padding: 60px 0;
}

.news-meta {
  background: #fff;
  padding: 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* === News Grid === */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

@media (max-width: 768px) {
  .news-grid {
    grid-template-columns: 1fr;
  }
}

/* === Modern News Card === */
.modern-news-card {
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.modern-news-card:hover {
  box-shadow: var(--shadow-lg);
}

.card-image-container {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
  background: linear-gradient(135deg, #e0e7ff, #f0f4ff);
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-news-card:hover .card-image {
  transform: scale(1.08);
}

.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.4) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modern-news-card:hover .image-overlay {
  opacity: 1;
}

.overlay-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4169e1;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
  transform: translateY(20px);
}

.modern-news-card:hover .overlay-btn {
  transform: translateY(0);
}

.overlay-btn:hover {
  background: #4169e1;
  color: #fff;
  transform: scale(1.1);
}

/* === Card Content === */
.card-content {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.category-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-copilot {
  background: linear-gradient(135deg, #0078d4, #00a4ef);
  color: #fff;
}

.badge-ai {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
}

.badge-microsoft {
  background: linear-gradient(135deg, #00a4ef, #0078d4);
  color: #fff;
}

.badge-default {
  background: #e0e7ff;
  color: #4169e1;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 12px;
  line-height: 1.4;
  max-height: 2.8em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
}

/* Fallback สำหรับเบราว์เซอร์ที่ไม่รองรับ */
@supports not (-webkit-line-clamp: 2) {
  .card-title {
    display: block;
    max-height: 2.8em;
  }
}

.card-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s ease;
}

.card-title a:hover {
  color: #4169e1;
}

.card-excerpt {
  font-size: 15px;
  color: #64748b;
  line-height: 1.7;
  margin-bottom: 20px;
  flex: 1;
  max-height: 5.1em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
}

/* Fallback สำหรับเบราว์เซอร์ที่ไม่รองรับ */
@supports not (-webkit-line-clamp: 3) {
  .card-excerpt {
    display: block;
    max-height: 5.1em;
  }
}

/* === Card Footer === */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid #e0e7ff;
  margin-top: auto;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  font-size: 14px;
}

.card-meta i {
  color: #4169e1;
}

.read-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4169e1;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: var(--transition);
}

.read-more-btn:hover {
  gap: 12px;
  color: #9400d3;
}

.read-more-btn i {
  transition: transform 0.3s ease;
}

.read-more-btn:hover i {
  transform: translateX(4px);
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.empty-icon {
  font-size: 80px;
  color: #cbd5e1;
  margin-bottom: 24px;
}

.empty-state h3 {
  font-size: 1.75rem;
  color: #1a202c;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 1rem;
  color: #64748b;
  margin-bottom: 24px;
}

/* === Pagination === */
.pagination-nav {
  margin-top: 60px;
}

.modern-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.modern-pagination .page-item {
  margin: 0;
}

.modern-pagination .page-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: #fff;
  border: 2px solid #e0e7ff;
  border-radius: var(--radius-sm);
  color: #4169e1;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  min-width: 44px;
  justify-content: center;
}

.modern-pagination .page-link:hover {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.modern-pagination .page-item.active .page-link {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-md);
}

.modern-pagination .page-item.disabled .page-link {
  background: #f8fafc;
  color: #cbd5e1;
  border-color: #e0e7ff;
  cursor: not-allowed;
}

/* === Scroll to Top Button === */
.scroll-top-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: var(--transition);
  z-index: 1000;
}

.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(65, 105, 225, 0.4);
}

/* === Animations === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Responsive Design === */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .category-btn {
    padding: 10px 18px;
    font-size: 14px;
  }

  .card-title {
    font-size: 1.1rem;
  }

  .modern-pagination .page-link span {
    display: none;
  }
}

/* === Detail Page Styles === */
.news-detail .hero {
  background: var(--gradient-light);
  border-radius: var(--radius-md);
  padding: 32px;
  margin-bottom: 24px;
}

.news-detail .news-body {
  background: #fff;
  padding: 32px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  line-height: 1.8;
}

.news-detail .news-body h2 {
  font-family: 'Mitr', sans-serif;
  font-weight: 700;
  color: #4169e1;
  margin-top: 32px;
  margin-bottom: 20px;
}

.news-detail .news-body img {
  max-width: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin: 24px 0;
}

.news-detail .news-gallery img {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  transition: var(--transition);
  cursor: pointer;
}

.news-detail .news-gallery img:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}