/* =========================================
   1. IMPORTS & FONTS
   ========================================= */
/* ฟอนต์ภาษาไทย Kanit */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600&display=swap');

/* ไอคอน Font Awesome (แก้ปัญหาไอคอนไม่โชว์) */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

/* =========================================
   2. VARIABLES (THEME COLORS)
   ========================================= */
:root {
    /* สีหลัก (ชมพู-แดง) */
    --primary: #e91e63;
    --primary-dark: #c2185b;
    --primary-gradient: linear-gradient(135deg, #e91e63, #c2185b);
    
    /* สีพื้นหลังและข้อความ */
    --bg-color: #f8f9fa;
    --white: #ffffff;
    --text-dark: #333333;
    --text-light: #888888;
    
    /* เอฟเฟกต์ */
    --shadow: 0 4px 20px rgba(0,0,0,0.05);
    --radius: 16px;
}

/* =========================================
   3. GLOBAL STYLES
   ========================================= */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Kanit', sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    color: var(--text-dark);
    /* เว้นที่ด้านล่างกันเนื้อหาทับกับเมนูบาร์ */
    padding-bottom: 90px; 
    /* ป้องกันสีไฮไลท์เวลาแตะปุ่มในมือถือ */
    -webkit-tap-highlight-color: transparent;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Container จำกัดความกว้างเหมือนแอพมือถือ */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* =========================================
   4. UI COMPONENTS (Card, Button, Input)
   ========================================= */

/* การ์ดสีขาว มุมมน มีเงา */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border: none;
    position: relative;
}

/* ปุ่มกด (Button) */
.btn {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-family: 'Kanit', sans-serif;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    transition: transform 0.1s, box-shadow 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
}

.btn-outline {
    border: 1px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-secondary {
    background: #eee;
    color: #555;
}

/* ฟอร์ม (Inputs) */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea,
input[type="file"] {
    width: 100%;
    padding: 14px;
    margin-bottom: 15px;
    border: 1px solid #eee;
    background: #f9f9f9;
    border-radius: 12px;
    font-family: 'Kanit', sans-serif;
    font-size: 14px;
    outline: none;
    transition: 0.3s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

/* =========================================
   5. NAVIGATION BAR (Sticky Bottom)
   ========================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--white);
    display: flex;
    justify-content: space-around;
    padding: 10px 0 15px 0; /* เพิ่ม padding ล่างเผื่อ iPhone รุ่นใหม่ */
    box-shadow: 0 -5px 20px rgba(0,0,0,0.05);
    border-radius: 20px 20px 0 0;
    z-index: 1000;
}

.nav-item {
    text-align: center;
    color: #999;
    text-decoration: none;
    font-size: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 20%;
    transition: 0.2s;
}

.nav-item i {
    font-size: 20px;
    margin-bottom: 2px;
    transition: 0.2s;
}

/* สถานะ Active (เมนูที่เลือกอยู่) */
.nav-item.active {
    color: var(--primary);
    font-weight: 500;
}

.nav-item.active i {
    transform: translateY(-3px);
}

/* =========================================
   6. PAGE HEADERS & TYPOGRAPHY
   ========================================= */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    color: var(--text-dark);
}

h3, h4 { margin-top: 0; color: var(--text-dark); }
small { color: var(--text-light); }

/* =========================================
   7. SPECIFIC COMPONENTS (Tree, Wallet, etc.)
   ========================================= */

/* สำหรับหน้า Tree View */
.tree-wrapper {
    overflow-x: auto;
    padding: 20px 10px;
    text-align: center;
    white-space: nowrap;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
.tree-wrapper::-webkit-scrollbar {
    display: none;
}
.tree-node {
    display: inline-block;
    padding: 10px 15px;
    margin: 5px;
    background: white;
    border-radius: 12px;
    border: 1px solid #eee;
    box-shadow: var(--shadow);
    min-width: 80px;
}

/* สำหรับหน้า Wallet (กล่องยอดเงิน) */
.balance-box {
    background: var(--primary-gradient);
    color: white;
    padding: 30px 20px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(233, 30, 99, 0.3);
    margin-bottom: 25px;
}
.balance-val {
    font-size: 36px;
    font-weight: 600;
    margin: 10px 0;
}

/* Helper Classes */
.text-center { text-align: center; }
.text-success { color: #4caf50; }
.text-danger { color: #f44336; }
.mb-10 { margin-bottom: 10px; }
.mt-10 { margin-top: 10px; }