/* css/styles.css */
html {
    background-color: #000000;
}

body {
    font-family: 'Inter', 'Noto Sans Thai', sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    min-height: 100vh;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

details summary {
    list-style: none;
    position: relative;
    transition: all 0.2s ease;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary .arrow-icon {
    transition: transform 0.3s ease;
}

details[open] summary .arrow-icon {
    transform: rotate(180deg);
}

.timeline-item {
    position: relative;
    padding-left: 2.5rem;
    padding-bottom: 0.8rem; /* ลดระยะห่างด้านล่างลงให้ชิดกันมากขึ้น */
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 19px;
    top: 10px;
    bottom: -10px;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-dot {
    width: 16px;
    height: 16px;
    background-color: #2563eb; 
    border: 3px solid white;
    border-radius: 50%;
    position: absolute;
    left: 12px;
    top: 6px;
    z-index: 10;
    box-shadow: 0 0 0 1px #dbeafe;
    background-image: none;
    display: block;
    padding: 0;
}

.glass-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* --- Bento Box Glassmorphism (Apple-Style Soft Cards) --- */
.bento-box {
    background: rgba(255, 255, 255, 0.85); /* ทึบขึ้นนิดนึง เพื่อชดเชยการเบลอที่ลดลง */
    backdrop-filter: blur(4px); /* ลดการเบลอลง 3 เท่า เครื่องจะได้ไม่ค้าง */
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 1.75rem; 
    box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.05); /* ลดความฟุ้งของเงาลง */
    transition: all 0.3s ease;
    overflow: hidden;
    transform: translateZ(0); /* บังคับใช้ Hardware Acceleration ช่วยเรนเดอร์ให้ลื่นขึ้น */
}
.bento-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.08), 0 10px 15px -5px rgba(0, 0, 0, 0.04);
}
/* Micro-Interaction: ยุบตัวเวลากด */
.bento-box:active {
    transform: scale(0.98);
}
button, summary {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s;
}
button:active, summary:active {
    transform: scale(0.95);
}

@keyframes pulse-intense {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.15); filter: brightness(1.1); }
}

.animate-pulse-intense {
    animation: pulse-intense 2.5s ease-in-out infinite;
}

.loading-fade-out {
    opacity: 0;
    visibility: hidden;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}


@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes popIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Toast Animations */
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}
.toast-enter { animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.toast-exit { animation: slideOutRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

.animate-fade-in {
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ฉากหลังสีดำเบลอๆ (Backdrop) */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
}
.modal-backdrop.show {
    display: block;
    animation: fadeIn 0.3s ease-out forwards;
}

/* ตัวฟอร์ม Modal / Bottom Sheet */
.smart-modal {
    display: none;
}
.smart-modal.show {
    display: block;
    position: fixed;
    z-index: 1000;
    background: #ffffff;
    
    /* สไตล์สำหรับมือถือ (Bottom Sheet) */
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 1.5rem 1.5rem 0 0;
    padding: 1.5rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); /* รองรับจอมือถือที่มีขีดโฮมด้านล่าง */
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* สไตล์สำหรับจอคอม (Centered Popup) - ปรับความคมชัดระดับ 4K */
@media (min-width: 768px) {
    .smart-modal.show {
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        margin: auto;
        height: max-content;
        width: 100%;
        max-width: 28rem;
        border-radius: 1.5rem;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
        animation: popIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }
}


input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* สำหรับ Firefox */
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* --- [Fix] ทำให้กล่องวันที่และเนื้อหาข้างในเป็นกระจกใส --- */

/* 1. ตัวกล่องวันที่ - ปรับความโค้งให้เท่ากับ bento-box และสั่งตัดขอบที่แลบออกมา */
details.group {
    background: rgba(255, 255, 255, 0.8) !important; /* ปรับเป็นสีเกือบทึบ */
    /* ลบ backdrop-filter ทิ้ง เพื่อป้องกันบั๊กกระจกซ้อนกระจกที่ทำให้เลื่อนแล้วกระตุก */
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 1.75rem !important;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
    overflow: hidden !important;
}

/* 2. เมื่อกดกางออกมา (Open) ให้สว่างขึ้นนิดนึงเพื่อให้เห็นขอบเขต */
details[open].group {
    background: rgba(255, 255, 255, 0.8) !important; /* สว่างขึ้นตอนกาง */
    border: 1px solid rgba(255, 255, 255, 1);
}


/* --- [UX Fix] ลบแถบสีเหลี่ยมตอนจิ้ม (Tap Highlight) ขั้นเด็ดขาด --- */
* {
    -webkit-tap-highlight-color: transparent !important;
}

details, summary, button, a, [onclick] {
    outline: none !important;
    box-shadow: none !important;
}

/* ป้องกันจังหวะกดแล้วกล่อง details กระพริบสีเทาใน Safari */
details {
    -webkit-appearance: none;
}

/* ป้องกันการคลุมดำข้อความเวลาจิ้มรัวๆ บนแถบวันเดินทาง */
summary {
    user-select: none;
    -webkit-user-select: none;
}