@import url('https://fonts.googleapis.com/css2?family=Kanit&display=swap');

body {
    font-family: 'Kanit', sans-serif;
    background: #fff;
    color: #2e2e2e;
    font-size: 14px; /* ลดขนาดฟอนต์หลัก */
}

.container {
    max-width: 1400px;
    width: 100%;
    margin: 30px auto;
    padding: 24px; /* ลด padding */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px; /* ลดมุมโค้ง */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
}

table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 12px; /* ลดมุมโค้ง */
    overflow: hidden;
    font-size: 0.85rem; /* ลดขนาดฟอนต์ในตาราง */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.06);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 16px; /* ลด margin */
    position: relative;
}

table::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0; right: 0;
    height: 2.5px; /* ลดเส้นบน */
    background: linear-gradient(90deg, #2e7d32, #c0a040, #1b5e20);
    border-radius: 12px 12px 0 0;
}

th, td {
    padding: 12px 16px; /* ลด padding */
    text-align: left;
    transition: all 0.3s ease;
}

th {
    font-weight: 600;
    font-size: 0.85rem; /* ลดฟอนต์หัวตาราง */
    letter-spacing: 0.25px;
    border-bottom: 2px solid rgba(46, 125, 50, 0.15);
    background: linear-gradient(135deg, rgba(46,125,50,0.08), rgba(192,160,64,0.08));
    color: #1b5e20;
    position: relative;
}

td {
    color: #2e2e2e;
    border-bottom: 1px solid rgba(46, 125, 50, 0.1);
    font-size: 0.85rem;
}

tr:hover {
    background: linear-gradient(135deg, rgba(46,125,50,0.05), rgba(192,160,64,0.05));
    transform: translateY(-0.8px);
}

tr:hover td {
    color: #0d1b0d;
}

tr:last-child td {
    border-bottom: none;
}

tr:last-child td:first-child {
    border-radius: 0 0 0 12px;
}

tr:last-child td:last-child {
    border-radius: 0 0 12px 0;
}

a.procu-read {
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
    padding: 6px 14px; /* ลด padding */
    color: white;
    border-radius: 36px; /* ลดมุม */
    text-decoration: none;
    font-size: 0.8rem; /* ลดขนาดฟอนต์ */
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(46, 125, 50, 0.3);
    position: relative;
    overflow: hidden;
    font-family: 'Kanit', sans-serif;
    margin-right: 6px;
}

a.procu-read::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s;
}

a.procu-read:hover::before {
    left: 100%;
}

a.procu-read:hover {
    background: linear-gradient(135deg, #1b5e20, #0d1b0d);
    transform: translateY(-1.5px);
    box-shadow: 0 6px 18px rgba(46, 125, 50, 0.4);
}

a.procu-read:active {
    transform: translateY(0);
}

a.procu-read.blue {
    background: linear-gradient(135deg, #c0a040, #8a6e1f);
    box-shadow: 0 3px 12px rgba(192,160,64,0.4);
}

a.procu-read.blue:hover {
    background: linear-gradient(135deg, #8a6e1f, #5c4712);
    box-shadow: 0 6px 18px rgba(192,160,64,0.5);
}

.doc-type {
    font-weight: 600;
    padding: 5px 10px; /* ลด padding */
    border-radius: 16px; /* ลดมุม */
    text-align: center;
    display: inline-block;
    font-size: 0.75rem; /* ลดขนาดฟอนต์ */
    color: white;
    box-shadow: 0 1.5px 6px rgba(0,0,0,0.08);
}

/* สีแต่ละประเภท */
.tag-blue    { background: linear-gradient(135deg, #2e7d32, #1b5e20); }
.tag-pink    { background: linear-gradient(135deg, #c0a040, #8a6e1f); }
.tag-green   { background: linear-gradient(135deg, #10b981, #059669); }
.tag-orange  { background: linear-gradient(135deg, #f97316, #ea580c); }
.tag-purple  { background: linear-gradient(135deg, #4caf50, #2e7d32); }
.tag-indigo  { background: linear-gradient(135deg, #2e7d32, #0d1b0d); }
.tag-sky     { background: linear-gradient(135deg, #1b5e20, #0d1b0d); }
.tag-teal    { background: linear-gradient(135deg, #3a9d80, #22735b); }
.tag-default { background: #94a3b8; color: white; }

.search-input {
    width: 100%;
    padding: 10px 14px 10px 36px; /* ลด padding */
    border-radius: 36px; /* ลดมุม */
    border: 2px solid rgba(46, 125, 50, 0.2);
    font-size: 0.9rem; /* ลดขนาดฟอนต์ */
    font-family: 'Kanit', sans-serif;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    color: #1b5e20;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    transition: 0.3s ease all;
}

.search-input:focus {
    outline: none;
    border-color: #2e7d32;
    box-shadow: 0 4px 16px rgba(46, 125, 50, 0.2);
}

.search-select {
    padding: 10px 16px; /* ลด padding */
    border-radius: 36px;
    border: 2px solid rgba(46, 125, 50, 0.2);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    font-size: 0.9rem;
    font-family: 'Kanit', sans-serif;
    color: #1b5e20;
    cursor: pointer;
    transition: 0.3s ease all;
    min-width: 160px; /* ลดขนาด */
}

.knowless-search {
  max-width: 800px;
  margin-bottom: 24px; /* ลด margin */
  display: flex;
  gap: 10px; /* ลดช่องว่าง */
  align-items: center;
  justify-content: flex-start;
}

.search-container {
  flex: 1 1 60%;
  min-width: 360px; /* ลดขนาด */
}

.search-select {
  flex: 1 1 35%;
  min-width: 110px; /* ลดขนาด */
}

.search-select:focus {
    outline: none;
    border-color: #2e7d32;
    box-shadow: 0 4px 16px rgba(46, 125, 50, 0.2);
}

.pagination {
  text-align: center;
  margin-top: 16px; /* ลด margin */
  user-select: none;
  font-family: 'Kanit', sans-serif;
}

.pagination button {
  margin: 0 4px; /* ลด margin */
  padding: 5px 10px; /* ลด padding */
  border-radius: 5px; /* ลดมุม */
  border: 1px solid #2e7d32;
  background: white;
  color: #2e7d32;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.3s, color 0.3s;
  font-size: 0.85rem; /* ลดขนาดฟอนต์ */
}

.pagination button:hover {
  background-color: #c0a040;
  color: white;
  border-color: #c0a040;
}

.pagination button.active {
  background-color: #2e7d32;
  color: white;
  border-color: #2e7d32;
  cursor: default;
}

/* Responsive */
@media (max-width: 768px) {
    .knowless-search {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container,
    .search-select {
        width: 100%;
    }
}

@media (max-width: 768px) {
    table {
        font-size: 0.8rem; /* ลดฟอนต์ */
        border-radius: 10px; /* ลดมุม */
    }

    th, td {
        padding: 10px 14px; /* ลด padding */
    }

    a.procu-read {
        padding: 5px 12px; /* ลด padding */
        font-size: 0.75rem; /* ลดฟอนต์ */
        margin-right: 4px;
        margin-bottom: 4px;
    }

    .status-badge {
        font-size: 0.7rem;
        padding: 2px 8px;
    }

    .category-tag {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
}

@media (max-width: 480px) {
    td:last-child {
        white-space: nowrap;
    }

    a.procu-read {
        display: block;
        margin-bottom: 6px;
        text-align: center;
    }
}

/* Table container for horizontal scroll on mobile */
.table-container {
    overflow-x: auto;
    border-radius: 12px; /* ลดมุม */
}

.table-container::-webkit-scrollbar {
    height: 7px; /* ลดขนาด scrollbar */
}

.table-container::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.1);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #2e7d32, #c0a040);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #1b5e20, #8a6e1f);
}
/* 🌙 Dark Mode */
body.dark-mode {
  background-color: #121212; /* เทา-ดำเข้ม */
  color: #e0e0e0;
}

/* Container */
body.dark-mode .container {
  background: rgba(30, 30, 30, 0.95);
  border: 1px solid rgba(192, 160, 64, 0.25);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

/* Table */
body.dark-mode table {
  background: rgba(30, 30, 30, 0.95);
  border: 1px solid rgba(192, 160, 64, 0.25);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

body.dark-mode table::before {
  background: linear-gradient(90deg, #2e7d32, #c0a040, #1b5e20);
}

body.dark-mode th {
  background: linear-gradient(135deg, rgba(46,125,50,0.15), rgba(192,160,64,0.15));
  color: #f1f1f1;
  border-bottom: 2px solid rgba(192,160,64,0.25);
}

body.dark-mode td {
  color: #e0e0e0;
  border-bottom: 1px solid rgba(192,160,64,0.15);
}

body.dark-mode tr:hover {
  background: linear-gradient(135deg, rgba(46,125,50,0.1), rgba(192,160,64,0.1));
}

body.dark-mode tr:hover td {
  color: #fff;
}

/* ปุ่ม action */
body.dark-mode a.procu-read {
  box-shadow: 0 3px 12px rgba(192, 160, 64, 0.25);
}

body.dark-mode a.procu-read:hover {
  background: linear-gradient(135deg, #1b5e20, #0d1b0d);
  box-shadow: 0 6px 18px rgba(192, 160, 64, 0.4);
}

body.dark-mode a.procu-read.blue {
  background: linear-gradient(135deg, #c0a040, #8a6e1f);
  box-shadow: 0 3px 12px rgba(192,160,64,0.4);
}

body.dark-mode a.procu-read.blue:hover {
  background: linear-gradient(135deg, #8a6e1f, #5c4712);
}

/* Badge */
body.dark-mode .doc-type {
  box-shadow: 0 1.5px 6px rgba(0,0,0,0.5);
}

/* Input / Select */
body.dark-mode .search-input {
  background: rgba(30, 30, 30, 0.9);
  border: 2px solid rgba(192, 160, 64, 0.3);
  color: #f1f1f1;
}

body.dark-mode .search-input:focus {
  border-color: #c0a040;
  box-shadow: 0 4px 16px rgba(192, 160, 64, 0.3);
}

body.dark-mode .search-select {
  background: rgba(30, 30, 30, 0.9);
  border: 2px solid rgba(192, 160, 64, 0.3);
  color: #f1f1f1;
}

body.dark-mode .search-select:focus {
  border-color: #c0a040;
  box-shadow: 0 4px 16px rgba(192, 160, 64, 0.3);
}

/* Pagination */
body.dark-mode .pagination button {
  border: 1px solid #c0a040;
  background: #1e1e1e;
  color: #f1f1f1;
}

body.dark-mode .pagination button:hover {
  background-color: #c0a040;
  color: #121212;
}

body.dark-mode .pagination button.active {
  background-color: #2e7d32;
  border-color: #2e7d32;
}

/* Scrollbar */
body.dark-mode .table-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .table-container::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #2e7d32, #c0a040);
}

body.dark-mode .table-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #1b5e20, #8a6e1f);
}

/* ✅ เพิ่ม Section ข่าวตามตัวอย่างของคุณ */
body.dark-mode .news-carousel-section {
  --news-bg: #1a1a1a;
  --news-color: #c0a040;
}

body.dark-mode .news-carousel-slide {
  background-color: rgba(26, 26, 26, 0.95);
  box-shadow: 0 15px 38px rgba(192, 160, 64, 0.25);
  color: #c0a040;
  filter: grayscale(10%);
  border-radius: 0 !important;
}

body.dark-mode .news-carousel-slide.active {
  box-shadow: 0 30px 60px rgba(192, 160, 64, 0.45);
  filter: none;
  border-radius: 0 !important;
}
