/**
 * Tidsen OTOP AI - Main Stylesheet
 *
 * @version 1.0
 * @author Your Name
 */

/* --- 1. Google Fonts & Root Variables --- */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;700&display=swap');

:root {
    --text-dark: #2c2c2c;
    --background-light: #f8f5f0;
    --primary-gold: #c09553;
    --secondary-brown: #a8763e;
    --font-main: 'Sarabun', sans-serif;
    --border-radius-main: 12px;
    --box-shadow-light: 0 4px 20px rgba(0, 0, 0, 0.05);
    --box-shadow-heavy: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* --- 2. General & Layout --- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--background-light);
    color: var(--text-dark);
    margin: 0;
    font-weight: 400;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 50px;
    color: var(--secondary-brown);
}

.text-content {
    max-width: 800px;
    margin: 0 auto;
}

/* --- 3. Header & Navigation --- */
.site-header {
    background-color: white;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--box-shadow-light);
    border-bottom: 1px solid #eee;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8em;
    font-weight: 700;
    text-decoration: none;
    color: var(--secondary-brown);
}

.main-nav a {
    color: var(--text-dark);
    text-decoration: none;
    margin-left: 30px;
    font-weight: 500;
    position: relative;
    transition: color 0.3s;
}

.main-nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--primary-gold);
    transition: width 0.3s ease;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--primary-gold);
}
.main-nav a:hover::after,
.main-nav a.active::after {
    width: 100%;
}

.hamburger-menu { display: none; } /* Hide on desktop */

/* --- 4. Hero Section --- */
.hero {
    background: linear-gradient(rgba(44, 44, 44, 0.6), rgba(44, 44, 44, 0.6)), url('assets/img/hero-bg.jpg') center center/cover no-repeat;
    padding: 120px 0;
    text-align: center;
    color: white;
}

.hero-content { max-width: 800px; margin: 0 auto; }
.hero h1 { font-size: 3.5rem; margin: 0 0 10px 0; font-weight: 700; }
.hero p { font-size: 1.3rem; font-weight: 300; opacity: 0.9; }

/* --- 5. Chat Interface --- */
.chat-wrapper {
    margin-top: -80px; /* Pulls the chat up */
    position: relative;
    z-index: 10;
    padding-bottom: 80px;
}

.chat-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: var(--border-radius-main);
    box-shadow: var(--box-shadow-heavy);
    overflow: hidden;
    height: 65vh;
    display: flex;
    flex-direction: column;
}

#chat-box { flex-grow: 1; padding: 20px; overflow-y: auto; }
.message { display: flex; margin-bottom: 15px; max-width: 85%; }
.message.user { margin-left: auto; flex-direction: row-reverse; }
.message.ai { margin-right: auto; }

.message .bubble {
    padding: 12px 18px;
    border-radius: 20px;
    line-height: 1.6;
    word-wrap: break-word;
}
.message.user .bubble { background-color: var(--primary-gold); color: white; border-bottom-right-radius: 5px; }
.message.ai .bubble { background-color: #f1f0f0; border-bottom-left-radius: 5px; }

.typing-bubble span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #ccc;
    border-radius: 50%;
    margin: 0 1px;
    animation: bounce 1.4s infinite ease-in-out both;
}
.typing-bubble span:nth-child(2) { animation-delay: -0.16s; }
.typing-bubble span:nth-child(3) { animation-delay: -0.32s; }

@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

#chat-form { display: flex; padding: 15px; border-top: 1px solid #eee; background: #fff; }
#user-input {
    flex-grow: 1;
    border: 1px solid #ddd;
    padding: 12px 20px;
    font-size: 1em;
    border-radius: 50px;
    font-family: var(--font-main);
}
#user-input:focus { outline: none; border-color: var(--primary-gold); }
#chat-form button {
    background: var(--primary-gold);
    border: none;
    color: white;
    font-weight: bold;
    border-radius: 50px;
    padding: 12px 25px;
    margin-left: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
}
#chat-form button:hover { background-color: var(--secondary-brown); }

/* --- 6. Product/Store Cards --- */
/* For chat */
.product-cards-container {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 5px;
    margin-top: 10px;
    scrollbar-width: thin;
}
.product-card {
    border: 1px solid #eee;
    border-radius: 8px;
    min-width: 180px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}
.product-card:hover { transform: translateY(-5px); box-shadow: var(--box-shadow-light); }
.product-card img { width: 100%; height: 110px; object-fit: cover; border-radius: 8px 8px 0 0; display: block; }
.product-card-info { padding: 10px; }
.product-card h4 { margin: 0 0 5px 0; font-size: 0.9em; font-weight: 500; }
.product-card p { margin: 0; font-size: 0.8em; color: #777; }

/* For grid pages */
.content-section { padding: 80px 0; }
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}
.item-card {
    background: white;
    border-radius: var(--border-radius-main);
    box-shadow: var(--box-shadow-light);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}
.item-card:hover { transform: translateY(-5px); box-shadow: var(--box-shadow-heavy); }
.item-card-image {
    height: 200px;
    background-size: cover;
    background-position: center;
}
.item-card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.item-card h3 { margin: 0 0 10px 0; font-weight: 700; }
.item-card p { margin: 0 0 15px 0; color: #666; flex-grow: 1; }
.item-card .price { font-weight: 500; color: var(--primary-gold); }

.button-details {
    display: inline-block;
    background-color: var(--primary-gold);
    color: white !important;
    padding: 10px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 500;
    text-align: center;
    transition: background-color 0.3s;
}
.button-details:hover { background-color: var(--secondary-brown); }

/* --- 7. Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}
.modal-content {
    background: white;
    border-radius: var(--border-radius-main);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    display: flex;
    box-shadow: var(--box-shadow-heavy);
}
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #ccc;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 20px;
    cursor: pointer;
    line-height: 30px;
    text-align: center;
}
.modal-gallery { flex: 1 1 50%; background: #f0f0f0; }
.modal-gallery img { width: 100%; height: auto; display: block; }
.modal-info { flex: 1 1 50%; padding: 40px; }
.modal-info h2 { margin-top: 0; font-size: 2rem; }
.modal-price { font-size: 1.5rem; color: var(--primary-gold); font-weight: 700; margin-bottom: 20px; }
.modal-description h4, .modal-store-info h4 { margin-bottom: 10px; border-bottom: 2px solid var(--primary-gold); padding-bottom: 5px; display: inline-block; }

/* --- 8. Footer --- */
.site-footer {
    background-color: #333;
    color: rgba(255,255,255,0.7);
    padding: 30px 0;
    text-align: center;
    font-size: 0.9em;
}

/* --- 9. Responsive Design --- */
@media (max-width: 768px) {
    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--secondary-brown);
        flex-direction: column;
        display: none; /* Hide by default */
    }
    .main-nav.active { display: flex; } /* Show when active */
    .main-nav a { margin: 0; padding: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); }
    .hamburger-menu {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 30px;
        height: 25px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
    }
    .hamburger-menu span {
        width: 30px;
        height: 3px;
        background: var(--text-dark);
        border-radius: 5px;
        transition: all 0.3s linear;
    }
    .hero h1 { font-size: 2.5rem; }
    .modal-content { flex-direction: column; }
}