/* ENGCE301 – Week 4 LAB Starter CSS
   นักศึกษาต้องแก้ไข/เติมตาม TODO ด้านล่าง
*/

/* ===== 0. Reset พื้นฐาน ===== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

.section {
  scroll-margin-top: 8rem; 
}

/* TODO: ลองปรับฟอนต์, สีพื้นหลัง, สีตัวอักษร ให้เข้ากับ Persona */
body {
  font-family: 'Kanit', 'Inter', system-ui, -apple-system, sans-serif;
  background-color: #050505;
  color: #e5e5e5;
  line-height: 1.6;
}

a {
  color: #00e1ff;
  text-decoration: none;
  transition: all 0.3s ease;
}

a:hover {
  text-decoration: underline;
  color: #c3ff00;
  filter: brightness(1.1);
  text-shadow: 0 0 5px rgba(195, 255, 0, 0.5);
}

/* ===== 1. Layout หลักของหน้า ===== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(18, 18, 18, 0.95);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo-area h1 {
  font-size: 1.8rem;
  color: #c3ff00;
  font-weight: 700;
  letter-spacing: -1px;
  text-transform: uppercase;
}

.logo-area .tagline {
  font-size: 0.9rem;
  color: #9ca3af;
}

.main-nav {
  display: flex;
  gap: 1rem;
}

.main-nav a {
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  font-size: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  background-color: transparent;
  transition: all 0.3s ease;
  /* TODO: ปรับสีปุ่มให้เข้ากับธีม persona ของคุณ */
}

.main-nav a:hover {
  background-color: rgba(195, 255, 0, 0.1);
  border-color: #c3ff00;
  color: #c3ff00;
  box-shadow: 0 0 15px rgba(195, 255, 0, 0.3);
  transform: translateY(-2px);
  text-decoration: none;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ===== 2. Section และ Card ===== */

.section {
  margin-top: 4rem;
}

.section-header {
  margin-bottom: 1.5rem;
  border-left: 4px solid #c3ff00;
  padding-left: 1rem;
}

.section-header h2 {
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
  color: #ffffff;
}

.section-subtitle {
  font-size: 0.95rem;
  color: #a3a3a3;
}

.cards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
  align-items: stretch;
}

.card {
  background: #121212;
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid #333;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease, border-color 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.card:hover {
  border-color: #c3ff00;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
  transform: translateY(-5px);
}

.card h3 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
  color: #c3ff00;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.5rem;
}

.card p,
.card li {
  font-size: 0.95rem;
  color: #d1d5db;
}

/* Tasks Section Layout */
.tasks-layout {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 2rem;
  align-items: start;
  margin-top: 1.5rem;
}

.tasks-list h3,
.tasks-table-wrapper h3 {
  color: #c3ff00;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.clean-list {
  list-style: none;
  padding: 0;
}

.clean-list li {
  padding: 0.8rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #e5e5e5;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
}

.clean-list li::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: #c3ff00;
  border-radius: 50%;
  margin-right: 10px;
}

.clean-list li:last-child {
  border-bottom: none;
}

.tasks-table-wrapper {
  background-color: #121212;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid #333;
}

.simple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.simple-table th {
  text-align: left;
  color: #c3ff00;
  padding: 0.5rem;
  border-bottom: 2px solid #333;
}

.simple-table td {
  padding: 0.8rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: #ccc;
}

.extra-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
  align-items: stretch;
}

/* ===== 3. Footer ===== */

.site-footer {
  border-top: 1px solid #333;
  padding: 3rem 2rem;
  text-align: center;
  font-size: 0.9rem;
  color: #6b7280;
  background-color: #050505;
  margin-top: 4rem;
}
/* ===== ปุ่ม Back to Top ===== */
.back-to-top {
    position: fixed;        /* สั่งให้ลอยอยู่กับที่ */
    bottom: 30px;           /* ห่างจากขอบล่าง */
    right: 30px;            /* ห่างจากขอบขวา */
    background-color: #c3ff00; /* สีเขียวธีม */
    color: #000;            /* ลูกศรสีดำ */
    width: 50px;
    height: 50px;
    border-radius: 50%;     /* ทำเป็นวงกลม */
    text-align: center;
    line-height: 50px;      /* จัดลูกศรให้อยู่กึ่งกลางแนวตั้ง */
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    z-index: 9999;          /* ให้ลอยอยู่เหนือทุกอย่าง */
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;  /* เอาขีดเส้นใต้ออก */
}

.back-to-top:hover {
    transform: translateY(-5px); /* ขยับขึ้นนิดนึงตอนชี้ */
    box-shadow: 0 0 15px rgba(195, 255, 0, 0.6); /* แสงฟุ้งๆ */
    color: #000; /* ย้ำสีดำตอน Hover */
}
/* ===== ปุ่ม Resume (Call to Action) ===== */
.btn-resume {
    background-color: transparent;
    border: 2px solid #c3ff00;
    color: #c3ff00 !important;
    padding: 0.4rem 1.2rem !important;
    border-radius: 99px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-resume:hover {
    background-color: #c3ff00 !important;
    color: #000000 !important;
    box-shadow: 0 0 15px rgba(195, 255, 0, 0.4);
    transform: translateY(-2px);
    text-decoration: none !important;
}

/* ซ่อนปุ่มบนมือถือจอเล็กมากๆ (เผื่อเกะกะ) */
@media (max-width: 480px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        line-height: 40px;
        font-size: 1.2rem;
    }
}

/* ===== 4. Responsive Design (Media Queries) ===== */

/* TODO: นักศึกษาต้องเติม/แก้เนื้อหาภายใน media query ให้เหมาะสม */
@media (max-width: 768px) {
  .site-header {
    position: relative;
    flex-direction: column;
    padding: 0;
    gap: 0;
  }
  .logo-area {
    width: 100%;
    padding: 1rem;
    background-color: #121212;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

  .logo-area h1 {
    font-size: 1.4rem;
    margin: 0;
  }

  .logo-area .tagline {
    display: none;
  }

  .main-nav {
    width: 100%;
    flex-direction: column;
    gap: 0;
    background-color: #050505;
  }
  .main-nav a {
    width: 100%;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 1rem;
    text-align: center;
    background-color: transparent;
  }

  /* ปรับปุ่ม Resume ให้เด่นในแนวตั้ง */
  .btn-resume {
    background-color: rgba(195, 255, 0, 0.05) !important;
    color: #c3ff00 !important;
    margin: 0 !important;
    border: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.05) !important;
  }
  
  /* Layout เนื้อหา */
  main {
    padding: 1rem;
  }
  
  .cards-row,
  .tasks-layout,
  .extra-layout {
    grid-template-columns: 1fr;
  }
  
  .card {
    height: auto;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 0.95rem; /* TODO: นักศึกษาปรับเองได้ ถ้ารู้สึกเล็ก/ใหญ่ไป */
  }

  .logo-area h1 {
    font-size: 1.4rem;
  }

  .section-header h2 {
    font-size: 1.3rem;
  }

  .main-nav {
    flex-direction: column;
    gap: 0.5rem;
  }

  .main-nav a {
    width: 100%;
    text-align: center;
  }

  /* TODO: เลือกว่าจะแสดง/ซ่อน element ใดบนจอเล็ก */
  .tasks-table-wrapper {
    overflow-x: auto;
  }
}