/* ฐานสำหรับหน้าเว็บทั้งหมด */
body {
    font-family: 'Mitr', sans-serif;
    background-color: #1e1e1e;
    color: #ffffff;
    margin: 0;
    padding: 0;
    display: flex;
    height: 100vh;
    flex-direction: column;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    background-color: #2c2c2c;
    width: 250px;
    padding: 20px;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.5);
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    transform: translateX(-100%); /* ซ่อน Sidebar เริ่มต้น */
    transition: transform 0.4s ease; /* เพิ่ม Animation */
    z-index: 1000;
    border-right: 2px solid #00ff99; /* เพิ่มขอบขวาสีเขียว */
    display: flex;
    flex-direction: column;
}

/* แสดง Sidebar เมื่อมีคลาส active */
.sidebar.active {
    transform: translateX(0);
}

/* ลิงก์ใน Sidebar */
.sidebar a {
    display: block;
    color: #ffffff;
    padding: 15px 20px;
    text-decoration: none;
    border-radius: 5px; /* เพิ่มความโค้งมนให้ลิงก์ */
    transition: background-color 0.3s, color 0.3s, transform 0.2s; /* เพิ่มเอฟเฟกต์การเปลี่ยนแปลง */
    font-size: 1.1rem;
}

.sidebar a:hover {
    background-color: #00ff99; /* เปลี่ยนสีเมื่อชี้ */
    color: #000;
    transform: scale(1.05); /* ขยายเล็กน้อยเมื่อชี้ */
}

/* ปุ่ม Toggle */
.toggle-btn {
    position: fixed;
    left: 20px;
    top: 20px;
    width: 40px;
    height: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    z-index: 1100; /* อยู่เหนือ Sidebar และ Overlay */
    transition: transform 0.4s ease;
}

.toggle-btn.active {
    /* ไม่เลื่อนปุ่ม toggle ทางด้านขวา แต่หมุนแทน */
    transform: rotate(90deg);
}

.toggle-btn span {
    width: 100%;
    height: 4px;
    background-color: #ffffff;
    border-radius: 2px;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.toggle-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
    background-color: #00ff99;
}

.toggle-btn.active span:nth-child(2) {
    opacity: 0;
}

.toggle-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
    background-color: #00ff99;
}

/* Overlay เมื่อ Sidebar เปิด */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
    z-index: 900;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* เนื้อหาหลัก */
.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin-left: 0;
    transition: margin-left 0.4s ease;
}

/* ปรับปรุง Container ต่างๆ */
.container, .paragon-container, .calculation-container {
    background-color: #2c2c2c;
    border-radius: 10px;
    padding: 30px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.paragon-container h1, .calculation-container h1 {
    text-align: center;
    color: #00ff99;
    margin-bottom: 20px;
}

.paragon-container label, .calculation-container label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
}

.paragon-container input, .calculation-container input {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: none;
    border-radius: 5px;
    background-color: #3d3d3d;
    color: #ffffff;
    font-size: 16px;
}

.paragon-container .button-group, .calculation-container .button-group {
    display: flex;
    gap: 10px;
}

.paragon-container button, .calculation-container button {
    flex: 1;
    padding: 12px;
    background-color: #00ff99;
    border: none;
    border-radius: 5px;
    color: #000;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.paragon-container button:hover, .calculation-container button:hover {
    background-color: #00e68a;
}

.paragon-container .reset-button, .calculation-container .reset-button {
    background-color: #ff4d4d;
    color: #fff;
}

.paragon-container .reset-button:hover, .calculation-container .reset-button:hover {
    background-color: #e60000;
}

.paragon-container .result, .calculation-container .result {
    margin-top: 20px;
    background-color: #1e1e1e;
    padding: 20px;
    border-radius: 10px;
    color: #00ff99;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* ปรับแต่งสำหรับหน้าจอมือถือ */
@media (max-width: 768px) {
    /* Sidebar ปรับให้เต็มหน้าจอความกว้าง 80% */
    .sidebar {
        width: 80%;
        max-width: 300px;
    }

    /* ปรับปุ่ม Toggle ให้อยู่บนซ้ายสุด */
    .toggle-btn {
        left: 15px;
        top: 15px;
    }

    /* เนื้อหาหลักไม่เปลี่ยน */
    .main-content {
        margin-left: 0;
    }

    /* ปรับ Sidebar ให้ Slide-In จากซ้ายบนมือถือ */
    .sidebar {
        transform: translateX(-100%); /* ซ่อน Sidebar */
    }

    .sidebar.active {
        transform: translateX(0); /* แสดง Sidebar */
    }
}

/* สไตล์สำหรับหน้า 404 */
.error-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh; /* ให้เต็มความสูงของหน้าจอ */
    text-align: center; /* จัดข้อความให้อยู่กลาง */
    background-color: #1e1e1e; /* พื้นหลังเหมือนหน้าเว็บหลัก */
    color: #ffffff; /* ข้อความสีขาว */
}

.error-page h1 {
    font-size: 3rem; /* ขนาดตัวอักษรใหญ่สำหรับหัวข้อ */
    color: #ff4d4d; /* สีแดงสำหรับ 404 */
}

.error-page p {
    font-size: 1.2rem; /* ขนาดตัวอักษรสำหรับข้อความ */
    margin: 10px 0; /* ช่องว่างระหว่างพารากราฟ */
}

.error-page a {
    color: #00ff99; /* สีเขียวสำหรับลิงก์ */
    text-decoration: none; /* ไม่มีขีดเส้นใต้ */
    margin-top: 20px; /* ช่องว่างด้านบน */
    font-weight: bold; /* หนักตัวหนา */
}

.error-page a:hover {
    text-decoration: underline; /* ขีดเส้นใต้เมื่อชี้ */
}

/* ปรับ CSS สำหรับลิงก์ในเนื้อหา */
a {
    color: #99FF00; /* สีฟ้า */
    text-decoration: none; /* ไม่มีขีดเส้นใต้ */
    font-weight: bold; /* ทำให้ตัวหนา */
    padding: 5px 10px; /* เพิ่มระยะห่างรอบ ๆ ลิงก์ */
    border-radius: 5px; /* ทำให้มุมลิงก์มน */
    transition: background-color 0.3s, color 0.3s; /* เพิ่มการเคลื่อนไหว */
}

a:hover {
    background-color: #339900; /* สีพื้นหลังเมื่อ hover */
    color: #66FF00; /* สีตัวอักษรเมื่อ hover */
}
