/* assets/css/main.css - Core Design System for BAAN Food */

:root {
    /* Brand Color Palette: Deep Forest Green + Warm Sand/Wood + Charcoal Black + Clean White */
    --color-primary: #183B28;        /* เขียวเข้ม Forest Deep */
    --color-primary-light: #245239;  /* เขียวเข้มสว่างขึ้นสำหรับ Hover */
    --color-primary-dark: #0F261A;   /* เขียวเข้มลึก */
    --color-primary-glow: rgba(24, 59, 40, 0.4);

    --color-accent: #C5A880;         /* น้ำตาลอ่อน / เอิร์ธโทน Warm Sand/Wood */
    --color-accent-light: #E0CEB5;   /* น้ำตาลอ่อนสว่าง */
    --color-accent-hover: #B59569;   /* น้ำตาลทองเข้ม */
    --color-accent-glow: rgba(197, 168, 128, 0.25);

    --color-bg-dark: #101211;        /* ดำชาร์โคลโทนธรรมชาติ */
    --color-bg-subtle: #161917;      /* ดำเฉดพื้นหลังชั้นใน */
    --color-surface: #1E2220;        /* พื้นหลังการ์ด / โมดอล */
    --color-surface-hover: #262B28;  /* พื้นหลังการ์ดเมื่อ Hover */
    --color-border: #2C332F;        /* เส้นขอบการ์ด */
    --color-border-focus: #C5A880;

    --color-text-main: #FFFFFF;      /* ข้อความหลัก สีขาวบริสุทธิ์ */
    --color-text-muted: #A3ACA6;     /* ข้อความรอง สีเทาอมเขียวอ่อน */
    --color-text-dim: #737D77;       /* ข้อความจาง */
    --color-cream: #FBF9F5;          /* สีครีมขาวนวล */

    --color-success: #2ECC71;
    --color-danger: #E74C3C;
    --color-warning: #F39C12;
    --color-star: #F5A623;

    /* Typography */
    --font-thai: 'Noto Sans Thai Looped', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-en: 'Outfit', 'Noto Sans Thai Looped', sans-serif;

    /* Elevation & Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(197, 168, 128, 0.2);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    background-color: var(--color-bg-dark);
    overflow-x: clip;
    max-width: 100%;
    width: 100%;
}

body {
    font-family: var(--font-thai);
    background-color: var(--color-bg-dark);
    color: var(--color-text-main);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
    max-width: 100%;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Typography styles */
h1, h2, h3, h4, h5, h6 {
    color: var(--color-text-main);
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: break-word;
    word-break: break-word;
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h4 { font-size: 1.25rem; }

p {
    color: var(--color-text-muted);
    font-size: 1rem;
    line-height: 1.7;
    overflow-wrap: break-word;
    word-break: break-word;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-fast);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button, input, textarea, select {
    font-family: inherit;
    font-size: 1rem;
    border: none;
    outline: none;
    box-sizing: border-box;
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

.container-narrow {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

.section {
    padding: 80px 0;
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
}

@media (max-width: 768px) {
    .section {
        padding: 40px 0;
    }
}

.section-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 48px auto;
    width: 100%;
    box-sizing: border-box;
}

.section-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(197, 168, 128, 0.12);
    border: 1px solid rgba(197, 168, 128, 0.3);
    color: var(--color-accent);
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
    text-transform: uppercase;
}

.section-title {
    margin-bottom: 14px;
    color: var(--color-text-main);
}

.section-subtitle {
    font-size: 1.05rem;
    color: var(--color-text-muted);
}

/* Grid Systems with minmax to prevent horizontal blowouts */
.grid {
    display: grid;
    gap: 24px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 992px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}

/* Flex utilities */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex-wrap { flex-wrap: wrap; }

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
}

.status-badge.open {
    background: rgba(229, 255, 125, 0.12);
    color: #e5ff7d;
    border: 1px solid rgba(229, 255, 125, 0.4);
    box-shadow: 0 0 12px rgba(229, 255, 125, 0.15);
}

.status-badge.open::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #e5ff7d;
    box-shadow: 0 0 8px #e5ff7d;
    animation: pulse-dot 1.8s infinite;
}

.status-badge.closed {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.4);
}

.status-badge.closed::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #e74c3c;
}

@keyframes pulse-dot {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(46, 204, 113, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

/* Star Ratings */
.star-rating {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.star {
    width: 18px;
    height: 18px;
}

.star.filled {
    fill: var(--color-star);
}

.star.empty {
    fill: var(--color-text-dim);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Page Speed & Core Web Vitals Optimizations */
html {
    scroll-behavior: smooth;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    content-visibility: auto;
}

/* Prevent Layout Shift (CLS) on interactive cards and images */
.hero-image-card img {
    aspect-ratio: 4/3;
    object-fit: cover;
    width: 100%;
}

.menu-card-img-wrap img {
    aspect-ratio: 16/10;
    object-fit: cover;
    width: 100%;
}

/* GPU Hardware Acceleration for smooth animations on mobile */
.btn, .menu-card, .review-item-card, .branch-distinct-card, .feature-card {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

