/* --- ตั้งค่าพื้นฐาน --- */
:root {
    --primary-color: #ff5722;
    --text-dark: #333;
    --text-light: #777;
    --bg-light: #f5f6fa;
}
body {
    font-family: 'Prompt', sans-serif;
    margin: 0;
    background-color: var(--bg-light);
    color: var(--text-dark);
    scroll-behavior: smooth;
}
a { text-decoration: none; color: inherit; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; box-sizing: border-box; }

/* --- แถบนำทาง (Navbar) --- */
nav {
    background-color: white;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo { font-size: 24px; font-weight: 700; color: var(--primary-color); }
.menu { display: flex; gap: 20px; align-items: center; }
.menu a { font-weight: 500; transition: color 0.3s; }
.menu a:hover { color: var(--primary-color); }

/* --- ส่วนหัว (Hero & Search) --- */
.hero {
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('https://images.unsplash.com/photo-1504674900247-0877df9cc836?ixlib=rb-1.2.1&auto=format&fit=crop&w=1920&q=80') center/cover;
    color: white;
    text-align: center;
    padding: 80px 20px;
}
.hero h1 { font-size: 36px; margin-bottom: 10px; }
.hero p { font-size: 18px; margin-bottom: 30px; font-weight: 300; }

.search-box {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 50px;
    overflow: hidden;
    padding: 5px;
}
.search-box input {
    flex: 1;
    padding: 15px 25px;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: 'Prompt', sans-serif;
}
.search-box button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0 30px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 16px;
    font-family: 'Prompt', sans-serif;
    font-weight: 600;
}

/* --- หมวดหมู่อาหาร (Categories) --- */
.categories {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: -25px auto 30px;
    flex-wrap: wrap;
}
.cat-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 12px 25px;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    font-family: 'Prompt', sans-serif;
    font-weight: 500;
    transition: all 0.2s;
}
.cat-btn.active, .cat-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* --- หัวข้อ Section --- */
.section-title {
    font-size: 24px;
    border-left: 5px solid var(--primary-color);
    padding-left: 15px;
    margin: 40px 0 20px;
}

/* --- การ์ดร้านอาหาร (Restaurant Grid) --- */
.restaurant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 60px;
}
.res-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: relative;
}
.res-card img { width: 100%; height: 200px; object-fit: cover; }
.rating-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: #ffd700;
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 14px;
}
.res-info { padding: 20px; }
.res-info .type { color: var(--primary-color); font-size: 13px; font-weight: 600; }
.res-info h3 { margin: 5px 0 10px; font-size: 18px; }
.res-info p { margin: 0; color: var(--text-light); font-size: 14px; line-height: 1.5; }
.no-result { grid-column: 1 / -1; text-align: center; padding: 40px; color: var(--text-light); }

/* --- ส่วน About & Social --- */
.about-section {
    background-color: white;
    padding: 60px 20px;
    text-align: center;
    border-top: 1px solid #eaeaea;
}
.about-section h2 { margin-top: 0; color: var(--text-dark); }
.about-section p { color: var(--text-light); max-width: 600px; margin: 0 auto 30px; line-height: 1.6; }
.social-links { display: flex; justify-content: center; gap: 20px; }
.social-btn { display: inline-flex; align-items: center; justify-content: center; width: 50px; height: 50px; border-radius: 50%; color: white; font-size: 24px; transition: transform 0.3s; }
.social-btn:hover { transform: translateY(-5px); }
.btn-facebook { background-color: #1877F2; }
.btn-instagram { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.btn-tiktok { background-color: #000000; }

footer {
    background-color: #2d3436;
    color: #b2bec3;
    text-align: center;
    padding: 20px;
    font-size: 14px;
}


/* =========================================================================
   📱 โหมดสำหรับมือถือและแท็บเล็ต (Responsive Media Queries) 
   ========================================================================= */
@media screen and (max-width: 768px) {
    /* 1. จัด Navbar ใหม่ให้ไม่เบียดกัน */
    .nav-content { flex-direction: column; gap: 12px; }
    .menu { flex-wrap: wrap; justify-content: center; gap: 15px; }

    /* 2. จัด Hero Section ให้ขนาดเล็กลง */
    .hero { padding: 40px 15px; }
    .hero h1 { font-size: 24px; }
    .hero p { font-size: 15px; margin-bottom: 20px; }

    /* 3. จัดช่องค้นหาและตัวกรองให้เป็นแนวตั้ง เรียงลงมาสวยๆ */
    .search-box { 
        flex-direction: column; 
        border-radius: 12px; 
        padding: 10px; 
        background: transparent;
    }
    .search-box input { border-radius: 8px; margin-bottom: 10px; width: 100%; box-sizing: border-box; }
    .search-box button { border-radius: 8px; width: 100%; padding: 12px; }
    
    .advanced-filters { flex-direction: column; width: 100%; }
    .advanced-filters input, .advanced-filters select, .advanced-filters button {
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 10px;
    }

    /* 4. ปรับตารางร้านอาหารให้แสดง 1 คอลัมน์แบบเต็มจอ */
    .restaurant-grid { grid-template-columns: 1fr; gap: 15px; margin-bottom: 40px; }

    /* 5. หน้า Detail: จัดโครงสร้างใหม่ให้อ่านง่าย */
    .detail-container { 
        margin: 20px 10px; 
        padding: 20px; 
    }
    .detail-img { height: 250px; } /* ลดความสูงรูปปกลงบนมือถือ */
    .detail-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .detail-title { font-size: 24px; }
    .detail-sidebar { margin-top: 20px; }

    /* 6. หน้า Admin & Login: ลดขอบและ Padding ให้พอดีจอ */
    .admin-container, .login-container { margin: 20px 15px; padding: 20px; }
    table, thead, tbody, th, td, tr { display: block; }
    thead tr { position: absolute; top: -9999px; left: -9999px; } /* ซ่อนหัวตารางบนมือถือ */
    tr { margin-bottom: 15px; border: 1px solid #ccc; border-radius: 8px; padding: 10px; }
    td { border: none; position: relative; padding-left: 50%; border-bottom: 1px solid #eee; }
    td:last-child { border-bottom: none; text-align: center; padding-left: 0; }
    /* ใส่หัวข้อจำลองให้ตารางแอดมินบนมือถือ */
    td:nth-of-type(1):before { content: "ชื่อร้าน:"; font-weight: bold; position: absolute; left: 10px; }
    td:nth-of-type(2):before { content: "หมวดหมู่:"; font-weight: bold; position: absolute; left: 10px; }
    td:nth-of-type(3):before { content: "ราคา:"; font-weight: bold; position: absolute; left: 10px; }
    .action-btns { justify-content: center; margin-top: 10px; }
}