/* Variables */
:root {
  --primary-color: #005054;
  --secondary-color: #ffd600;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --bg-white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Kanit", sans-serif;
}

/* Container */
.container-lds {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}
.page-backgroud {
  background-color: #f8f9fa;
}

/* Grid Layout */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
  padding: 0 1rem;
}

/* Section Title */
.docs-section-title {
  margin-top: 5rem;
  margin-bottom: 2rem;
  width: 100%;
  height: 100px;
  text-align: center;
  position: relative;
  background-color: #005854;
  display: flex;
  justify-content: center;
  align-items: center;
}

.docs-section-title h2 {
  color: rgb(203, 219, 206);
  font-size: 2rem;
  font-weight: 500;
  display: inline-block;
  text-align: center;
  position: relative;
  padding: 0 2rem;
}

.docs-section-title h2::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  width: 50px;
  height: 50px;
  background-color: #bdeec4;
  opacity: 0.1;
  border-radius: 30% 70% 70% 30%/30% 30% 70% 70%;
  z-index: 1;
}

.docs-section-title h2::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #ffd600, transparent);
}

.docs-section-title h5 {
  position: absolute;
  right: 2rem;
  color: white;
  font-size: 1rem;
  font-weight: 500;
  transition: color 0.3s ease;
}

.docs-section-title h5:hover {
  color: var(--secondary-color);
}

/* Card */
.docs-card {
  background: var(--bg-white);
  border-radius: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  height: 250px;
}

.docs-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.docs-card-content {
  display: flex;
  height: 100%;
}

/* Card Text */
.docs-card-text {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

/* Card Image */
.docs-card-image {
  width: 30%;
  min-width: 120px;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.docs-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 1px solid #e5e7eb;
  transition: transform 0.3s ease;
}

.docs-card-image img:hover {
  transform: scale(1.05);
  cursor: pointer;
}

/* Blink Animation */
.docs-blink-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.docs-blink-wrapper i,
.docs-blink-text {
  color: #dc2626;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

.docs-card-category {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-color);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.docs-separator {
  color: var(--primary-color);
  margin: 0 0.25rem;
}

/* Card Title & Description */
.docs-card-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0.25rem 0;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
  overflow: hidden;
}

.docs-card-description {
  font-size: 0.5rem;
  color: var(--text-secondary);
  margin: 0.25rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
}

/* Card Footer */
.docs-card-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.docs-card-meta-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.docs-card-meta,
.docs-download-count {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #225779;
  font-size: 0.875rem;
}

/* Card Actions */
.docs-card-actions {
  display: flex;
  gap: 1rem;
}

.view-button {
  flex: 1;
  display: inline-flex;
  position: relative;
  width: 150px;
  height: 40px;
  cursor: pointer;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  border: 1px solid #17795e;
  background-color: #ffffff;
  transition: all 0.3s ease;
  /* overflow: hidden; */
}

.view-button,
.view-button__icon,
.view-button__text {
  transition: all 0.3s;
}

.view-button .view-button__text {
  transform: translateX(22px);
  color: #17795e;
  font-size: 0.875rem;
  font-weight: 500;
}

.view-button .view-button__icon {
  position: absolute;
  right: 39px;
  top: 0;
  height: 100%;
  width: 39px;
  background-color: #17795e;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateX(100%);
  transition: all 0.5s ease;
}

.view-button .svg {
  width: 20px;
  fill: #fff;
}

.view-button:hover .view-button__icon svg path {
  fill: #17795e;
}

.view-button:hover {
  background: #ffffff;
}

.view-button:hover .svg {
  fill: #17795e;
  /* เพิ่มบรรทัดนี้ */
}

.view-button:hover .view-button__text {
  color: transparent;
}

.view-button:hover .view-button__icon {
  background: #ffffff;
  width: calc(100% - 2rem);
  right: 1rem;
  transform: translateX(0);
  transition: all 0.5s ease;
}

.view-button:active .view-button__icon {
  background-color: #146c54;
}

.view-button:active {
  border: 1px solid #146c54;
}

@media (max-width: 992px) {
  .view-button {
    width: 120px;
    height: 36px;
    padding: 0.5rem 0.75rem;
  }

  .view-button .view-button__text {
    font-size: 0.75rem;
  }

  .view-button .view-button__icon {
    top: 0;
    right: 35px;
    width: 35px;
  }

  .view-button .svg {
    width: 18px;
  }
}

@media (max-width: 768px) {
  .view-button {
    width: 120px;
    height: 36px;
    padding: 0.5rem 0.75rem;
  }

  .view-button .view-button__text {
    font-size: 0.75rem;
  }

  .view-button .view-button__icon {
    top: 0;
    right: 35px;
    width: 35px;
  }

  .view-button .svg {
    width: 18px;
  }
}

@media (max-width: 576px) {
  .view-button {
    width: 100px;
    height: 32px;
    padding: 0.25rem 0.5rem;
  }

  .view-button .view-button__text {
    font-size: 0.65rem;
  }

  .view-button .view-button__icon {
    top: 0;
    right: 30px;
    width: 30px;
  }

  .view-button .svg {
    width: 16px;
  }
}

.doc-button {
  flex: 1;
  display: inline-flex;
  position: relative;
  width: 150px;
  height: 40px;
  cursor: pointer;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  border: 1px solid #17795e;
  background-color: #209978;
  transition: all 0.3s ease;
  /* overflow: hidden; */
}

.doc-button,
.doc-button__icon,
.doc-button__text {
  transition: all 0.3s;
}

.doc-button .doc-button__text {
  transform: translateX(22px);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
}

.doc-button .doc-button__icon {
  position: absolute;
  right: 39px;
  top: 0;
  height: 100%;
  width: 39px;
  background-color: #17795e;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateX(100%);
  transition: all 0.5s ease;
}

.doc-button .svg {
  width: 20px;
  fill: #fff;
}

.doc-button:hover {
  background: #17795e;
}

.doc-button:hover .doc-button__text {
  color: transparent;
}

.doc-button:hover .doc-button__icon {
  width: calc(100% - 2rem);
  right: 1rem;
  transform: translateX(0);
  transition: all 0.5s ease;
}

.doc-button:active .doc-button__icon {
  background-color: #146c54;
}

.doc-button:active {
  border: 1px solid #146c54;
}

@media (max-width: 992px) {
  .doc-button {
    width: 120px;
    height: 36px;
    padding: 0.5rem 0.75rem;
  }

  .doc-button .doc-button__text {
    font-size: 0.75rem;
  }

  .doc-button .doc-button__icon {
    top: 0;
    right: 35px;
    width: 35px;
  }

  .doc-button .svg {
    width: 18px;
  }
}

@media (max-width: 768px) {
  .doc-button {
    width: 120px;
    height: 36px;
    padding: 0.5rem 0.75rem;
  }

  .doc-button .doc-button__text {
    font-size: 0.75rem;
  }

  .doc-button .doc-button__icon {
    top: 0;
    right: 35px;
    width: 35px;
  }

  .doc-button .svg {
    width: 18px;
  }
}

@media (max-width: 576px) {
  .doc-button {
    width: 100px;
    height: 32px;
    padding: 0.25rem 0.5rem;
  }

  .doc-button .doc-button__text {
    font-size: 0.65rem;
  }

  .doc-button .doc-button__icon {
    top: 0;
    right: 30px;
    width: 30px;
  }

  .doc-button .svg {
    width: 16px;
  }
}

/* View All Button Container */
.docs-btn-container {
  text-align: center;
  margin-top: 40px;
}

/* Modal */
.docs-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  padding: 2rem;
  overflow: auto;
}

.docs-modal.show {
  display: block;
}

.docs-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 80%;
  max-height: 80vh;
}

.docs-modal-content img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  height: auto;
  margin: 0 auto;
}

.docs-modal-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
  z-index: 1001;
}

.docs-modal-close:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

/* Responsive */
@media (max-width: 992px) {
  .docs-grid {
    padding: 0 0.5rem;
  }

  .docs-section-title h2 {
    font-size: 1.75rem;
  }
}

/* Section Title and View All Button */
.docs-btn-section {
  position: relative;
  text-align: center;
  margin-top: 40px;
  padding-bottom: 40px;
  width: 100%;
}

.docs-btn-section::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--secondary-color);
}

.docs-see-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.3s ease;
  margin-bottom: 40px;
}

.docs-see-all-btn:hover {
  background-color: #0d4d25;
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .docs-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding-top: 1rem;
  }

  .docs-section-title {
    height: 80px;
  }

  .docs-card {
    height: 220px;
  }

  .docs-section-title h2 {
    font-size: 1.5rem;
  }

  .docs-section-title h5 {
    right: 1rem;
    font-size: 0.875rem;
  }

  .docs-card-image {
    width: 25%;
    min-width: 100px;
  }

  .docs-card-title {
    font-size: 0.95rem;
  }

  .docs-card-category,
  .docs-card-meta,
  .docs-download-count,
  .docs-btn {
    font-size: 0.75rem;
  }

  .docs-btn {
    padding: 0.5rem 0.75rem;
  }

  .doc-button {
    width: 100%;
  }

  .docs-card-description {
    display: none;
  }
}

@media (max-width: 576px) {
  .docs-card-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .docs-card-meta-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }

  .docs-card {
    height: auto;
    min-height: 200px;
  }

  .docs-card-content {
    flex-direction: row;
    overflow: hidden;
  }

  .docs-card-image {
    width: 120px;
    min-width: 120px;
  }

  .docs-card-title {
    white-space: normal;
    -webkit-line-clamp: 2;
    max-height: 2.8em;
    line-clamp: 2;
  }

  .docs-btn {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  .container-lds {
    overflow-x: hidden;
    width: 100%;
  }

  .docs-section-title {
    height: 70px;
    padding: 0 1rem;
  }

  .docs-section-title h2 {
    font-size: 1.25rem;
    padding: 0 4rem 0 1rem;
    /* เพิ่มพื้นที่ด้านขวาสำหรับ "ดูทั้งหมด" */
  }

  .docs-section-title h5 {
    right: 1rem;
    font-size: 0.75rem;
  }
}

@media (max-width: 576px) {
  .docs-card-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .docs-card-meta-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }

  .docs-section-title {
    flex-direction: column;
    gap: 0.5rem;
    min-height: 60px;
  }

  .docs-section-title h5 {
    position: relative;
    right: 0;
  }
}
