/* --- Import Font --- */
@import url('https://fonts.googleapis.com/css2?family=Itim&display=swap');

/* --- Global Variables (Theme) --- */
:root {
    --primary-color: #0099ff; /* สีฟ้าสดใส */
    --primary-hover: #0077cc;
    --secondary-color: #1abc9c; /* สีเขียว/เทอร์คอยซ์ */
    --bg-color: #f4f9ff; /* พื้นหลังสีฟ้าอ่อน */
    --surface-color: #ffffff; /* สีพื้นผิว (การ์ด) */
    --text-color: #333;
    --header-text: #1a3b5d;
}

/* --- Global Styles --- */
body {
    /* 1. ใช้ฟอนต์ Itim */
    font-family: 'Itim', sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    color: var(--text-color);
    font-size: 1.1rem; /* เพิ่มขนาดฟอนต์เล็กน้อย */
}

h1, h2 {
    color: var(--header-text);
}

textarea, input[type="number"], button {
    font-family: 'Itim', sans-serif; /* 1. ใช้ฟอนต์ Itim */
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px; /* ทำให้โค้งมนขึ้น */
    font-size: 1.1rem;
    box-sizing: border-box; 
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 25px; /* ทำให้ปุ่มโค้งมน */
    padding: 10px 20px;
}

button:hover {
    background-color: var(--primary-hover);
}

/* --- Layout --- */
header {
    background-color: var(--surface-color);
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap; 
    gap: 10px;
}

main#app-container {
    max-width: 900px;
    margin: 20px auto; 
    padding: 20px;
    background-color: var(--surface-color);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* --- Tab Switching Logic --- */
.tool-section {
    display: none;
    animation: fadeIn 0.5s; 
}
.tool-section.active {
    display: block;
}

.nav-button {
    background-color: #f0f4ff;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}
.nav-button.active {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

/* --- Styles for Team Generator --- */
#team-results-area {
    display: flex; /* ทำให้ทีมเรียงต่อกัน */
    flex-wrap: wrap; /* ถ้าล้นให้ขึ้นบรรทัดใหม่ */
    gap: 15px; /* เว้นระยะห่างระหว่างทีม */
    margin-top: 20px;
}
.team-box {
    flex-basis: 200px; /* ความกว้างเริ่มต้น */
    flex-grow: 1; /* ขยายให้เต็มพื้นที่ */
    background: #fafdff;
    border: 2px dashed var(--secondary-color);
    border-radius: 8px;
    padding: 10px 15px;
}
.team-box h3 {
    color: var(--secondary-color);
    margin-top: 5px;
    border-bottom: 1px solid #eee;
}
.team-box ul {
    padding-left: 20px;
    margin: 5px 0;
}


/* * =========================================
 * 3. Responsive Design
 * =========================================
*/
@media (max-width: 700px) {
    body {
        font-size: 1rem; /* ลดขนาดฟอนต์เล็กน้อยในมือถือ */
    }

    /* 1. ให้เมนูเรียงเป็นแนวตั้ง */
    nav {
        flex-direction: column;
    }
    .nav-button {
        width: 100%;
        box-sizing: border-box; /* ทำให้ 100% รวม padding */
    }

    /* 2. ลดระยะขอบของกล่องหลัก */
    main#app-container {
        margin: 10px;
        padding: 15px;
    }

    h1 {
        font-size: 1.8rem;
    }
}

/* Animation Fade In */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}