/* =========================================
   1. VARIABLES & THEME SETUP
   ========================================= */
:root {
    /* Theme Colors: อิงจากโทน customer-upload (ชมพู-ขาว-พาสเทล) */
    --primary-color: #ff8fa3;       /* ชมพูหลัก */
    --secondary-color: #ffccd5;     /* ชมพูอ่อน */
    --accent-color: #fff0f3;        /* ขาวอมชมพู */
    --text-color: #594a4e;          /* สีน้ำตาลเข้ม (อ่านง่ายกว่าดำสนิท) */
    --white: #ffffff;
    --shadow-soft: 0 10px 25px rgba(255, 143, 163, 0.3); /* เงานุ่มๆ สีชมพู */
    
    /* Font Settings */
    /* YOUEDITHERE: ถ้าอยากเปลี่ยนฟอนต์ เปลี่ยน URL ใน index.html และชื่อตรงนี้ */
    --main-font: 'Mali', 'Kanit', sans-serif; 
}

/* =========================================
   2. RESET & MOBILE PROTECTION
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* ลบสีเทาเวลาแตะบนมือถือ */
}

html, body {
    width: 100%;
    height: 100%; /* ใช้ 100% เพื่อ fallback */
    height: 100dvh; /* ใช้ Dynamic Viewport Height สำหรับมือถือ */
    overflow: hidden; /* ห้าม scroll หน้าจอหลัก ป้องกันการเห็นขอบขาว */
    font-family: var(--main-font);
    background-color: var(--accent-color);
    color: var(--text-color);
    
    /* ป้องกันการเลือกข้อความ และการ Zoom */
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation; /* อนุญาตแค่คลิกกับเลื่อน ไม่ให้ Zoom */
    overscroll-behavior: none; /* ป้องกัน rubber-band effect (เด้งดึ๋ง) บน iOS */
}

/* ป้องกันการ Zoom เพิ่มเติม */
body {
    position: fixed; /* ล็อคหน้าจอไม่ให้ขยับ */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* =========================================
   3. CUSTOM CURSOR (PC Only)
   ========================================= */
/* .custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 25px;
    height: 25px;
    background-color: var(--primary-color);
    border: 2px solid var(--white);
    border-radius: 50%;
    pointer-events: none; 
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s, background-color 0.2s;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
} */

/* ซ่อน Custom Cursor บนอุปกรณ์จอสัมผัส (มือถือ/ไอแพด) */
@media (hover: none) and (pointer: coarse) {
    .custom-cursor {
        display: none;
    }
}

/* =========================================
   4. LAYOUT & UTILITIES
   ========================================= */
#app {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #fff0f3 0%, #ffccd5 100%); /* พื้นหลังไล่สี */
}

/* คลาสสำหรับซ่อนหน้า/element */
.hidden {
    display: none !important;
}

/* กล่องขาวนวล (Standard Container) */
.glass-box {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px); /* เอฟเฟกต์เบลอหลังกระจก */
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    padding: 20px;
    text-align: center;
    max-width: 90%;
    width: 400px; /* ขนาดมาตรฐานบน PC */
    position: relative;
    border: 2px solid #fff;
    -ms-overflow-style: none;  /* สำหรับ IE และ Edge เก่า */
    scrollbar-width: none;  /* สำหรับ Firefox */
    overflow-y: auto; /* บังคับให้ยังเลื่อนได้ */
}
.glass-box::-webkit-scrollbar {
    display: none; /* สำหรับ Chrome, Safari, Opera */
}

/* ปุ่มกดสไตล์ Valentine */
.btn-main {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 1.2rem;
    font-family: var(--main-font);
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(255, 143, 163, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 15px;
    outline: none;
}

/* Hover Effect (เฉพาะ PC) */
@media (hover: hover) {
    .btn-main:hover {
        transform: translateY(-3px) scale(1.05);
        box-shadow: 0 8px 20px rgba(255, 143, 163, 0.6);
    }
}

.btn-main:active {
    transform: translateY(1px) scale(0.95);
}

/* =========================================
   5. SPECIFIC MODULE STYLES (Placeholder)
   ========================================= */
/* ส่วนนี้จะเตรียมไว้ เดี๋ยวเราจะมาเติม Class แยกของแต่ละ Module ทีหลัง 
   เช่น .wheel-container, .gallery-grid เพื่อไม่ให้ไฟล์นี้รกเกินไป 
   แต่กำหนดโครงสร้างพื้นฐานไว้ก่อน */

/* หน้าแต่ละหน้า (Pages) */
.page-section {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    top: 0;
    left: 0;
    opacity: 0; /* ซ่อนไว้ก่อน รอ JS สั่ง animate */
    visibility: hidden;
    padding: 20px;
}

.page-section.active {
    opacity: 1;
    visibility: visible;
    z-index: 10;
}

/* ปุ่ม Back to Menu (มุมซ้ายบน) */
.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    z-index: 100;
    font-size: 1.2rem;
    color: var(--primary-color);
}

/* =========================================
   6. ANIMATION UTILITIES
   ========================================= */
/* Class สำหรับ Image Preload */
.preload-hidden {
    opacity: 0;
    transition: opacity 0.5s ease;
}
.preload-visible {
    opacity: 1;
}

/* Floating Animation (ให้ดูมีชีวิตชีวา) */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* --- PASSCODE STYLES --- */
.passcode-display {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}
.digit-box {
    width: 40px;
    height: 50px;
    background: #fff;
    border: 2px solid var(--secondary-color);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}
/* Class สำหรับตอนใส่เลขแล้ว */
.digit-box.filled {
    background: var(--accent-color);
    border-color: var(--primary-color);
}
/* Class ตอนใส่รหัสผิด (สั่น) */
.shake-box {
    animation: shake 0.5s;
}
@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 250px;
    margin: 0 auto;
}
.num-btn {
    padding: 15px;
    font-size: 1.2rem;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.2s;
    font-family: var(--main-font);
}
.num-btn:active {
    background: var(--secondary-color);
}
.action-btn {
    background: none;
    color: var(--primary-color);
}

/* --- MENU GRID STYLES --- */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 คอลัมน์ */
    gap: 15px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 5px;
}
.menu-item {
    background: var(--white);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.menu-item:active {
    transform: scale(0.95);
}
.menu-icon {
    font-size: 2rem;
    color: var(--primary-color);
}
.menu-label {
    font-size: 0.9rem;
    font-weight: bold;
}

/* --- RESPONSIVE MENU GRID --- */
@media (max-width: 600px) {
    .menu-grid {
        grid-template-columns: 1fr; /* เหลือ 1 คอลัมน์เต็มๆ */
        gap: 10px; /* ลดระยะห่างลงหน่อย */
        padding: 10px;
    }

    .menu-item {
        flex-direction: row; /* เปลี่ยนเป็นแนวนอน (icon ซ้าย, text ขวา) */
        align-items: center;
        padding: 15px 20px;
        text-align: left;
        gap: 20px;
    }

    .menu-icon {
        font-size: 1.5rem; /* ลดขนาดไอคอนนิดนึง */
    }

    .menu-label {
        font-size: 1rem; /* เพิ่มขนาดตัวหนังสือให้อ่านง่าย */
    }
}