/*------Homepage------ */

/* ------MOBILE------ */
@media (max-width: 768px) {
  /* ปุ่มหลัก */
  .hp-button1 {
    gap: 3vw !important;
  }

  .hp-button1-box {
    width: 100px !important;
    height: 80px !important;
  }

  .hp-button1-main {
    font-size: 20px !important;
  }

  .hp-button1-name {
    display: none;
  }

  .hp-aboutus {
    margin-top: 5vw;
  }

  .hp-aboutus-box {
    padding-top: 1vw;
  }

  .card-list .card-item .card-link {
    height: 30em;
  }

  .news-header {
    padding: 3vw 6vw !important;
  }

  .news-header h2 {
    font-size: 20px;
  }

  .news-header a {
    font-size: 16px;
  }

  .card-wrapper {
    margin: 0 10px 25px;
  }

  .card-wrapper .swiper-slide-button {
    display: none;
  }
}

/* ------subject------ */

@media (max-width: 768px) {
  .carousel-wrapper,
  .carousel-inner img {
    height: auto;
  }

  /* ปรับปรุง Namebox (ส่วนชื่อหลักสูตร) */
  .namebox {
    flex-direction: column; /* เปลี่ยนจากแนวนอนเป็นแนวตั้ง */
    gap: 2.5em; /* เพิ่มระยะห่างระหว่างหัวข้อ */
    padding: 10vw !important; /* ปรับ Padding ให้พอดีกับหน้าจอ */
    width: 100%;
  }

  .namebox span {
    width: 100%; /* ให้ข้อความขยายเต็มความกว้าง */
  }

  .name1-underline h4,
  .name2-underline h4 {
    font-size: 22px; /* ลดขนาดหัวข้อลงให้พอเหมาะ */
    margin-bottom: 15px;
  }

  .namebox p,
  .namebox h5 {
    font-size: 16px; /* ปรับขนาดเนื้อหาให้เล็กลงเล็กน้อยเพื่อให้อ่านง่าย */
    line-height: 1.5;
  }

  /* overlay บนรูปภาพ */
  .overlay-main {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    justify-self: center;
    margin: 2vw;
    max-width: calc(100% - 2.4em);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  }

  /* วัตถุประสงค์ / เป้าหมายการเรียนรู้ */
  .วัตถุประสงค์ {
    flex-direction: column; /* จัดรูปไว้บน ข้อความไว้ล่าง */
    padding: 5vh 1.5em;
    gap: 2em;
  }

  .วัตถุประสงค์ img {
    width: 100%; /* รูปขยายเต็มความกว้าง */
    max-height: 35vh;
  }

  .วัตถุประสงค์-box {
    padding: 2.5vh 1.5em;
  }

  .วัตถุประสงค์-container h2 {
    width: fit-content;
  }

  /* แนวทางแต่ละชั้นปี */
  #section-4 {
    padding: 5vh 0;
  }

  .year-row,
  .year-row.reverse {
    flex-direction: column; /* เรียงเป็นแนวตั้งทั้งหมด */
    margin-bottom: 4vh;
  }

  .year-row img,
  .year-box {
    width: 100%; /* ให้ทั้งรูปและกล่องข้อความเต็มกว้าง */
    height: auto;
  }

  .year-box {
    padding: 2em 1.5em;
  }

  .card-plo,
  .card-list {
    justify-items: center !important;
  }

  .card-plo {
    height: 400px;
  }

  .subplo-hidden {
    height: auto;
  }

  .plo-modal-content {
    width: 95%;
    max-width: none;
    max-height: 85vh;
    padding: 2.5em 1.5em 1.5em;
    border-radius: 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }

  .plo-modal-close {
    position: absolute;
    font-size: 2em;
    top: 10px;
    right: 15px;
    z-index: 100;
    color: #000;
    line-height: 1;
    cursor: pointer;
  }

  .plo-modal-content::-webkit-scrollbar {
    width: 6px;
  }
  .plo-modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
  }

  .subplo-item h3 {
    font-size: 18px;
  }

  .swiper-button-next,
  .swiper-button-prev {
    display: none !important;
  }

  /* อาชีพอนาคต */
  #section-6.work {
    padding: 1vw;
  }

  .work h4,
  .work-box {
    padding: 0 5vw;
  }

  .work-box {
    width: 90%;
    justify-self: center;
  }

  /* papers */
  #section-7.papers {
    padding: 5vh 6vw;
  }
}

/* Myteam right sidebar */
@media (max-width: 768px) {
  .side-menu {
    position: fixed;
    top: 70px;
    right: 0;
    width: 220px;
    height: calc(100vh - 70px);
    padding: 1rem;
    overflow-y: auto;
    z-index: 1040;
  }

  .side-menu .nav-link {
    color: #fff;
    font-weight: bold;
    display: block;
    padding: 0.5rem 0;
  }

  .content-with-sidebar {
    margin-right: 240px;
  }

  .papers-box {
    width: 100%;
    height: 70px;
    margin-right: 0;
  }

  .papers-box a {
    font-size: 16px;
  }
}

/* news */

@media (max-width: 768px) {
  .navigation-tab {
    padding-top: 16vw;
  }

  .news-layout {
    margin-top: 0;
    flex-direction: column;
    padding: 4vw;
  }

  .filter-buttons {
    position: relative;
    top: 0;
    width: 100%;
    height: auto;
    padding: 5vw;
  }

  .filter-buttons h2 h4 {
    margin: 2vw 0;
  }

  .btn-group {
    justify-content: flex-start;
    gap: 10px;
  }

  .btn-group .btn {
    font-size: 14px;
    padding: 5px 15px;
  }

  .carousel-poster,
  .carousel-text {
    flex: none;
    width: 100%;
  }

  .carousel-text {
    padding: 4vw;
  }

  .card-container {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .card {
    min-height: auto;
    padding: 15px;
  }

  .card-link .card-title {
    font-size: 18px;
    margin-top: 10px;
  }

  .card-link .card-image {
    aspect-ratio: 16 / 9;
  }

  .news-tags {
    padding: 1vw;
  }

  .tags {
    font-size: 12px;
    padding: 5vw;
  }

  .Dates {
    margin-bottom: 1vw;
  }

  .card-title {
    font-size: 16px;
    margin: 1vw 0;
  }
}

/* news-page */
@media (max-width: 768px) {
  .layout {
    padding: 3vw 5vw;
  }

  .bg-head,
  .content-text {
    padding: 5vw;
    height: auto;
  }

  .content-head {
    font-size: 20px;
    line-height: 1.4;
  }

  .line-dark {
    width: 100px;
    margin: 2vw 0;
  }

  .banner {
    padding: 0;
    margin: 4vw 0;
  }

  .banner img {
    border-radius: 10px;
    width: 100%;
  }

  .content-text h5 {
    font-size: 16px;
    line-height: 1.6;
    word-break: break-word;
  }

  .container-pic {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

/* scholarship */
@media (max-width: 768px) {
  .scholarship-content {
    margin: 1vw;
    width: 100%;
  }

  .custom-schedule-table {
    width: 300px;
  }

  .table-responsive {
    width: 100%;
  }

  .scholarship-news {
    display: none;
  }
}

/* TABEE */
@media screen and (max-width: 768px) {
  .tabee-nav {
    display: none;
  }

  .tabee-head h3 {
    padding: 3vw;
  }

  .tabee-subplo-body,
  .tabee-history-box {
    margin-bottom: 3vw;
  }
}

/* history */
@media (max-width: 768px) {
  .history-layout {
    margin: 2vw 3vw;
  }

  .container-layout {
    flex-direction: column;
  }

  .history-container {
    flex-direction: column;
  }

  .history-heads-sidebar {
    flex: none;
    width: 100%;
    border-radius: 12px 12px 0 0;
    border-right: 1px solid #cacaca;
    border-bottom: none;
  }

  .details-card {
    border-radius: 0 0 12px 12px;
    border-top: 1px solid #cacaca;
    padding: 4vw;
  }

  .history-head1 h4 {
    font-size: 18px;
  }

  .history-head1 p {
    font-size: 16px;
  }

  .year-title {
    font-size: 18px;
  }

  .event-list {
    padding-left: 4vw;
  }
}

/* mayteam */
@media (max-width: 768px) {
  .nav-sidebar {
    position: fixed;
    top: 50%;
    transform: translateY(-50%) translateX(100%);
    float: none;
    margin-right: 0;
  }

  .nav-sidebar.active {
    transform: translateY(-50%) translateX(0);
  }

  .nav-toggle {
    display: flex;
    position: absolute;
    left: -40px;
    top: 0;
    width: 40px;
    height: 50px;
    background-color: #a72c32;
    color: white;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 10px 0 0 10px;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
  }

  .nav-box {
    width: 180px !important;
    border-radius: 0 0 0 10px !important;
  }
}

/* document */
@media (max-width: 768px) {
  .request-forms,
  .Internship-form,
  .form-body {
    width: 95%;
    padding: 1vw 2vw;
  }

  .form-head {
    font-size: 22px;
    text-align: center;
  }

  .form-container {
    flex-direction: column;
    align-items: flex-start;
    padding: 2vw;
    gap: 10px;
  }

  .form-link {
    align-self: flex-end;
    background: #f4f4f4;
    padding: 5px 15px;
    border-radius: 5px;
  }

  .Internship-form h4,
  .Internship-body {
    padding: 0 2vw;
  }

  .Internship-body ul {
    padding-left: 6vw;
  }

  .form-body {
    font-size: 16px;
  }

  .form-body img {
    max-width: 100%;
  }
}
