/* =========================
   GLOBAL
========================= */

* {
  box-sizing: border-box;
}

body {
  background-color: #121212;
  color: #ffffff;
  line-height: 1.6;
  font-family: tahoma, sans-serif;
  padding: 24px;
  margin: 0;
}

/* =========================
   TYPOGRAPHY
========================= */

h1 {
  color: #1ed760;
  font-size: 2.25rem;
}

h2 {
  color: #1ed760;
  font-size: 1.5rem;
}

.note {
  color: #b3b3b3;
  font-size: 14px;
}

/* =========================
   MAIN LAYOUT
========================= */

header,
main,
footer {
  max-width: 900px;
  margin: 0 auto;
}

header {
  text-align: center;
}

section {
  background-color: #212121;
  border: 1px solid #315842;
  border-left: 4px solid #1ed760;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 24px;
}

/* =========================
   NAVIGATION
========================= */

nav ul {
  list-style: none;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

nav a {
  color: #ffffff;
  text-decoration: none;
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid #383838;
  border-radius: 999px;
  background-color: #282828;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

nav a:hover {
  color: #1ed760;
  text-decoration: none;
  border-color: #1ed760;
  background-color: #333333;
}

nav a:focus-visible {
  outline: 2px solid #1ed760;
  outline-offset: 3px;
}

/* =========================
   IMAGES & FIGURES
========================= */

figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  margin-top: 40px;
}

figure img {
  max-width: 100%;
  height: auto;
  border-radius: 15px;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

figure img:hover {
  transform: translateY(-8px) scale(1.05);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.35);
}

/* =========================
   HIGHLIGHT
========================= */

.highlight {
  background-color: #2a2a2a;
  color: #ffffff;
  padding: 12px;
  border-radius: 8px;
}

.note.highlight {
  border: 1px solid #315842;
  border-left: 3px solid #1ed760;
}

/* =========================
   ABOUT PAGE
========================= */


/* =========================
   STUDY PLAN PAGE
========================= */

/*
   จัด Header ให้อยู่กึ่งกลางหน้า
   และให้ H1 ชิดซ้ายตรงแนวกับ Section
   ใช้เฉพาะหน้า table.html
*/


/* =========================
   TABLE
========================= */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}

th,
td {
  border: 1px solid #383838;
  padding: 10px;
  text-align: left;
}

/* หัวตารางและชื่อวิชา */
th {
  background-color: #2a2a2a;
  color: #ffffff;
}

/* หัวคอลัมน์ */
thead th {
  color: #1ed760;
}

/* รายละเอียดงาน */
td {
  background-color: #212121;
  color: #ffffff;
}

/* เปลี่ยนพื้นหลังเมื่อ Hover */
tr:hover td {
  background-color: #2b2b2b;
}

/* ชื่อตาราง */
caption {
  background-color: #2a2a2a;
  color: #ffffff;
  border: 1px solid #383838;
  border-bottom: 0;
  padding: 12px;
  font-size: 18px;
  text-align: left;
}

/* รองรับตารางบนหน้าจอขนาดเล็ก */
.table-scroll {
  overflow-x: auto;
}

.table-scroll table {
  min-width: 600px;
}

/* =========================
   FORM
========================= */

input[type="text"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #535353;
  border-radius: 8px;
  background-color: #181818;
  color: #ffffff;
  font: inherit;
}

input[type="text"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  outline: 2px solid #1ed760;
  outline-offset: 3px;
  border-color: #1ed760;
}

/* =========================
   BUTTON
========================= */

button[type="submit"] {
  background-color: #1ed760;
  color: #000000;
  border: 2px solid #1ed760;
  border-radius: 999px;
  padding: 0.5em 1em;
  font: inherit;
  font-weight: bold;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

button[type="submit"]:hover {
  background-color: #1fdf64;
  border-color: #1fdf64;
  transform: translateY(-2px);
}

button[type="submit"]:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

/* =========================
   CARDS / GRID
========================= */

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-bottom: 24px;
}

.cards > div {
  background-color: #282828;
  padding: 16px;
  border: 1px solid #315842;
  border-radius: 12px;
  text-align: center;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.cards > div:hover {
  background-color: #333333;
  border-color: #1ed760;
}

.cards > div:first-child {
  grid-column: 1 / span 2;
}

.cards > div:nth-child(3) {
  grid-column: 1 / -1;
}

/* =========================
   GF PAGE
========================= */


.gf-section h2,
.gf-section h3 {
  color: #ff0263;
  font-size: 1.5rem;
}

.gf-section {
  background-color: #212121;
  border: 1px solid #583040;
  border-left: 4px solid #ff0263;
}


/* =========================
   GF PHOTO GALLERY
========================= */

.gf-photo {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 80px;
}

.gf-photo figure {
  flex: 1;
  min-width: 0;
  max-width: 250px;
  margin: 0;
  text-align: center;
}

.gf-photo img {
  display: block;
  width: 100%;
}

.gf-photo figcaption {
  margin-bottom: 36px;
}

/* =========================
   PROGRESS
========================= */

.progress-container {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 24px;
  font-size: 1.25rem;
}

progress {
  accent-color: #1ed760;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 600px) {
  body {
    padding: 12px;
  }

  h1 {
    font-size: 1.75rem;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .cards > div:first-child,
  .cards > div:nth-child(3) {
    grid-column: 1 / -1;
  }

  .gf-photo {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  .gf-photo figure {
    flex: none;
    width: 100%;
    max-width: 250px;
  }
}

/* =========================
   SIDEBAR PRACTICE
========================= */

.app-layout {
  display: flex;
  min-height: 100vh;
  gap: 24px;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background-color: #181818;
  border: 1px solid #383838;
  border-radius: 16px;
  padding: 20px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.sidebar h2 {
  color: #1ed760;
  margin-top: 0;
}

.sidebar nav ul {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.sidebar nav a {
  display: block;
  background-color: #282828;
  border: 1px solid #383838;
  padding: 12px;
  border-radius: 10px;
}

.sidebar nav a:hover {
  background-color: #333333;
  border-color: #1ed760;
}

.main-content {
  flex: 1;
  min-width: 0;
}

.main-content header,
.main-content main {
  max-width: none;
}

/* Responsive */

@media (max-width: 700px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }
}

.sidebar nav a[aria-current="page"] {
  background-color: #214432;
  color: #1ed760;
  border-color: #1ed760;
  font-weight: bold;
}

/* SPA Sidebar */

.sidebar .menu-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  background-color: #282828;
  color: #ffffff;
  border: 1px solid #383838;
  border-radius: 10px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.sidebar .menu-btn:hover {
  background-color: #333333;
}

.sidebar .menu-btn.active {
  background-color: #214432;
  color: #1ed760;
  border-color: #1ed760;
}

.sidebar .menu-btn:focus-visible {
  outline: 2px solid #1ed760;
  outline-offset: 3px;
}

/* ป้องกัน CSS ของ section แสดงหน้าที่ถูกซ่อน */
.page-content[hidden] {
  display: none;
}

/* STUDY PLAN INSIDE SIDEBAR */

.study-content {
  background-color: transparent;
  border: none;
  padding: 0;
}

.study-content > h1 {
  color: #1ed760;
  margin-top: 0;
  margin-bottom: 24px;
  text-align: left;
}

.study-content > section {
  background-color: #212121;
  border: 1px solid #315842;
  border-left: 4px solid #1ed760;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}

.study-content .table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

/* =========================
   ABOUT KAMYUI INSIDE SIDEBAR
========================= */

/* กล่องหลักของหน้า About */
.aboutgf-content {
  background-color: transparent;
  border: none;
  padding: 0;
}

/* หัวข้อใหญ่ */
.aboutgf-content > h1 {
  color: #ff0263;
  text-align: left;
  margin-top: 0;
  margin-bottom: 32px;
}

/* Section เฉพาะหน้า About */
.aboutgf-content > .gf-section {
  background-color: #212121;
  border: 1px solid #583040;
  border-left: 4px solid #ff0263;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}

/* หัวข้อภายใน Section */
.aboutgf-content .gf-section h2,
.aboutgf-content .gf-section h3 {
  color: #ff0263;
}

/* รูปภาพ */
.aboutgf-content .gf-photo {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 36px;
  margin-bottom: 32px;
}

.aboutgf-content .gf-photo figure {
  flex: 1;
  min-width: 0;
  max-width: 250px;
  margin: 0;
  text-align: center;
}

/* Responsive */
@media (max-width: 700px) {
  .aboutgf-content .gf-photo {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  .aboutgf-content .gf-photo figure {
    flex: none;
    width: 100%;
    max-width: 250px;
  }
}

.sidebar .menu-btn[data-page="aboutgf"].active {
  background-color: #43202f;
  color: #ff0263;
  border-color: #ff0263;
}

/* =========================
   HOME INSIDE SIDEBAR
========================= */

.home-content {
  background-color: transparent;
  border: none;
  padding: 0;
}

.home-content > h1 {
  color: #1ed760;
  margin-top: 0;
  margin-bottom: 24px;
  text-align: left;
}

.home-content > section {
  background-color: #212121;
  border: 1px solid #315842;
  border-left: 4px solid #1ed760;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}

.home-content > h2 {
  color: #1ed760;
}

.home-quick-links ul {
  justify-content: flex-start;
  padding: 0;
  margin-bottom: 24px;
}

.home-profile {
  margin: 32px 0;
}

.home-footer {
  max-width: none;
  margin-top: 32px;
  color: #b3b3b3;
}

/* ป้องกันเนื้อหาล้นพื้นที่ Sidebar Layout */
.main-content {
  min-width: 0;
}

.home-content .progress-container {
  flex-wrap: wrap;
}

.home-content progress {
  max-width: 100%;
}

/* =========================
   MOBILE SIDEBAR DRAWER
========================= */

.menu-toggle {
  display: none;
}

.sidebar-overlay[hidden] {
  display: none;
}

@media (max-width: 700px) {
  .menu-toggle {
    display: block;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1002;

    width: 48px;
    height: 48px;
    border: 1px solid #383838;
    border-radius: 12px;

    background-color: #282828;
    color: #1ed760;
    font-size: 24px;
    cursor: pointer;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1001;

    width: min(280px, 85vw);
    height: 100dvh;
    overflow-y: auto;

    background-color: #181818;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-overlay:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.65);
  }

  .main-content {
    width: 100%;
    min-width: 0;
    padding-top: 60px;
  }
}


/* =========================
   FIXED DESKTOP SIDEBAR
   SLIDE IN / SLIDE OUT
========================= */

@media (min-width: 701px) {
  .app-layout {
    display: block;
    padding-top: 64px;
  }

  .app-layout > .sidebar {
    display: block;
    position: fixed;
    top: 88px;
    left: 24px;
    z-index: 100;

    width: 240px;
    height: calc(100dvh - 112px);
    overflow-y: auto;

    opacity: 1;
    visibility: visible;
    transform: translateX(0);

    transition:
      transform 0.3s ease,
      opacity 0.3s ease,
      visibility 0.3s ease;
  }

  /* เมื่อกดปิด Sidebar ให้สไลด์ออกด้านซ้าย */
  .app-layout > .sidebar.is-collapsed {
    transform: translateX(calc(-100% - 24px));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  /* เนื้อหาหลักขยับตาม Sidebar */
  .app-layout > .main-content {
    display: block;
    width: calc(100% - 264px);
    margin-left: 264px;
    max-width: none;
    min-width: 0;
    padding-top: 0;

    transition:
      margin-left 0.3s ease,
      width 0.3s ease;
  }

  /* ขยายเนื้อหาเมื่อ Sidebar ปิด */
  .app-layout:has(> .sidebar.is-collapsed) > .main-content {
    width: 100%;
    margin-left: 0;
  }

  .sidebar-overlay {
    display: none;
  }
}

/* SIDEBAR ICONS */

.sidebar .menu-btn {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar .menu-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar .menu-btn {
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.sidebar .menu-btn:hover {
  transform: translateX(3px);
}


/* =========================
   SPY NAVBAR - DESIGN 1
========================= */

.top-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  width: 100%;
  height: 100px;
  padding: 12px 24px;
  margin: 0;
  background: #121212;
  border: none;
  box-shadow: none;
  max-width: none;
  text-align: left;
}

.top-navbar-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  width: 100%;
  height: 74px;
  padding: 0 20px;
  background: #181818;
  border: 1px solid #383838;
  border-bottom: 2px solid #1ed760;
  border-radius: 18px;
}

/* LEFT: MENU + SPY */

.top-navbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-shrink: 0;
}

.top-navbar .menu-toggle {
  position: static;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  background: #212121;
  border: 1px solid #383838;
  border-radius: 12px;
  color: #1ed760;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.top-navbar .menu-toggle:hover {
  background: #282828;
  border-color: #1ed760;
}

.top-navbar .site-brand {
  position: static;
  display: flex;
  align-items: center;
  height: auto;
  color: #1ed760;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1;
}

/* CENTER: SEARCH */

.navbar-search {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  max-width: 650px;
  height: 46px;
  margin: 0 auto;
  padding: 0 14px;
  background: #282828;
  border: 1px solid #383838;
  border-radius: 999px;
}

.navbar-search:focus-within {
  border-color: #1ed760;
}

.navbar-search > svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #b3b3b3;
}

.navbar-search input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font: inherit;
}

.navbar-search input::placeholder {
  color: #b3b3b3;
}

.search-shortcut {
  flex-shrink: 0;
  padding: 3px 8px;
  color: #b3b3b3;
  border: 1px solid #484848;
  border-radius: 6px;
  font-size: 12px;
}

/* RIGHT: NOTIFICATION + PROFILE */

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
  margin-left: auto;
}

.notification-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: #ffffff;
  cursor: pointer;
}

.notification-btn:hover {
  background: #282828;
  color: #1ed760;
}

.notification-btn svg {
  width: 23px;
  height: 23px;
}

.top-navbar .profile-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: auto;
  height: 46px;
  padding: 0 14px;
  background: #212121;
  border: 1px solid #383838;
  border-radius: 999px;
  color: #ffffff;
  font: inherit;
  cursor: pointer;
}

.top-navbar .profile-btn:hover {
  border-color: #1ed760;
}

.top-navbar .profile-btn svg:first-child {
  width: 25px;
  height: 25px;
  color: #1ed760;
}

.top-navbar .profile-btn svg:last-child {
  width: 16px;
  height: 16px;
}

/* CONTENT SPACING */

body:has(> .top-navbar) {
  padding-top: 112px;
}

@media (min-width: 701px) {
  .app-layout {
    padding-top: 0;
  }

  .app-layout > .sidebar {
    top: 112px;
    height: calc(100dvh - 136px);
  }
}

/* TABLET */

@media (min-width: 701px) and (max-width: 950px) {
  .top-navbar-inner {
    gap: 14px;
    padding: 0 12px;
  }

  .top-navbar-left {
    gap: 12px;
  }

  .top-navbar .site-brand {
    font-size: 26px;
  }

  .search-shortcut {
    display: none;
  }

  .navbar-actions {
    gap: 8px;
  }
}

/* MOBILE */

@media (max-width: 700px) {
  .top-navbar {
    height: 80px;
    padding: 10px 12px;
  }

  .top-navbar-inner {
    height: 60px;
    padding: 0 12px;
    gap: 10px;
    border-radius: 14px;
  }

  .top-navbar-left {
    gap: 10px;
  }

  .top-navbar .menu-toggle {
    width: 38px;
    height: 38px;
    font-size: 22px;
  }

  .top-navbar .site-brand {
    font-size: 23px;
  }

  .navbar-search {
    display: none;
  }

  .navbar-actions {
    gap: 6px;
  }

  .notification-btn {
    width: 36px;
    height: 36px;
  }

  .top-navbar .profile-btn {
    width: 38px;
    height: 38px;
    padding: 0;
  }

  .top-navbar .profile-btn span,
  .top-navbar .profile-btn svg:last-child {
    display: none;
  }

  body:has(> .top-navbar) {
    padding-top: 92px;
  }

  .app-layout > .main-content {
    padding-top: 0;
  }
}


/* SIDEBAR MENU TITLE */

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 12px;

  color: #1ed760;
  font-size: 28px;
  font-weight: 700;
}

.sidebar-title svg {
  width: 27px;
  height: 27px;
  flex-shrink: 0;
  color: #1ed760;
}



/* ========================================
   HOME - PROFILE IMAGE
======================================== */

/* จัดรูปให้อยู่ตรงกลาง */
.home-profiles {
  display: flex;
  justify-content: center;
  margin: 32px 0;
}

/* กรอบรูป */
.home-profile {
  margin: 0;
  text-align: center;
  max-width: 100%;
}

/* รูปภาพ */
.home-profile img {
  display: block;
  width: auto;
  height: 300px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 12px;
}

/* คำบรรยาย */
.home-profile figcaption {
  margin-top: 10px;
  text-align: center;
}
