/* style.css */
:root {
    --primary-color: #2F6D38;
    /* Xanh lá thẫm tựa núi rừng */
    --secondary-color: #D4AF37;
    /* Vàng ánh kim */
    --text-dark: #333333;
    --text-light: #666666;
    --bg-light: #F9F9F9;
    --white: #FFFFFF;
    --danger: #E53935;

    --border-radius: 12px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

    --transition: all 0.3s ease;
}

body {
    background-color: var(--white); /* Đổi toàn bộ nền ngoài thành Trắng */
    color: var(--text-dark);
}

.main-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    background-color: transparent; /* Đồng bộ hoàn toàn với màu nền của body */
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: var(--white);
    border-bottom: 1px solid #EEEEEE;
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
}

.logo-nav {
    display: flex;
    align-items: center;
    gap: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo img {
    height: 40px;
    object-fit: contain;
}

.logo span {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.2rem;
}

nav ul {
    display: flex;
    gap: 25px;
}

nav a {
    font-weight: 500;
    color: var(--text-dark);
    transition: var(--transition);
}

nav a:hover,
nav a.active {
    color: var(--primary-color);
}

.search-cart {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-bar {
    position: relative;
}

.search-bar input {
    padding: 10px 15px;
    padding-right: 40px;
    border-radius: 20px;
    border: 1px solid #DDD;
    width: 250px;
    transition: var(--transition);
}

.search-bar input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(47, 109, 56, 0.1);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    cursor: pointer;
}

.cart-icon {
    position: relative;
    cursor: pointer;
    font-size: 1.5rem;
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -8px;
    background-color: var(--danger);
    color: var(--white);
    font-size: 0.75rem;
    font-weight: bold;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Hero Section */
.hero {
    position: relative;
    width: 100%;
    /* Bắt buộc dùng đơn vị tĩnh px (hoặc rem) để khi Ctrl+Scroll, browser sẽ scale px to ra/nhỏ đi vật lý trên màn hình */
    padding: 250px 20px;
    background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.5)), url('../img/hero-banner.png');
    /* Tạm mượn ảnh núi non để mockup */
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
}

.hero h1 {
    font-size: 4rem;
    font-weight: 800;
    text-transform: uppercase;
    text-shadow: 2px 4px 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
    color: var(--secondary-color);
}

/* Sponsors */
.sponsors {
    padding: 40px 0;
    background-color: var(--white);
    text-align: center;
}

.sponsors h3 {
    color: var(--text-light);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

.sponsor-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 40px;
}

.sponsor-logos img {
    height: 40px; /* Khống chế chiều cao đồng bộ cho mọi logo */
    object-fit: contain;
    transition: var(--transition);
}

.sponsor-logos img:hover {
    transform: scale(1.1); /* Hơi phóng to lên một chút khi hover cho đẹp */
}

/* Products Section */
.products-section {
    padding: 60px 0;
    background-color: var(--bg-light);
}

.section-title {
    text-align: center;
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 40px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
}

/* Category Tabs */
.category-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 25px;
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover,
.tab-btn.active {
    background: var(--primary-color);
    color: var(--white);
}

/* Thẻ ẩn khi lọc */
.product-card.hidden {
    display: none !important;
}

/* News Section */
.news-section {
    padding: 60px 0;
    background-color: var(--white);
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.news-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.news-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.news-content {
    padding: 20px;
}

.news-content h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    line-height: 1.4;
}

.news-date {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

.news-content p {
    font-size: 0.95rem;
    color: var(--text-dark);
    margin-bottom: 15px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-read-more {
    color: var(--secondary-color);
    font-weight: bold;
    text-decoration: none;
}

.btn-read-more:hover {
    text-decoration: underline;
}

/* About Section */
.about-section {
    padding: 60px 0;
    background-color: var(--bg-light);
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.about-text p {
    margin-bottom: 15px;
    line-height: 1.6;
    font-size: 1.05rem;
}

.about-img-box img {
    width: 100%;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
    .about-content {
        grid-template-columns: 1fr;
    }
}

.product-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid #EEE;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.product-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

.product-img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    margin-bottom: 15px;
    transition: var(--transition);
}

.product-card:hover .product-img {
    transform: scale(1.05);
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 44px;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.btn-add-cart {
    background-color: var(--white);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    transition: var(--transition);
    width: 100%;
}

.btn-add-cart:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

/* Thẻ Đặc Biệt (Tạo ảnh AI) */
.special-card {
    background: linear-gradient(135deg, #fcff4d);
    color: var(--white);
    border: none;
}

.special-card .product-title {
    color: var(--text-dark);
}

.special-card .product-price {
    color: var(--secondary-color);
}

.special-card .btn-add-cart {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--text-dark);
}

.special-card .btn-add-cart:hover {
    background-color: var(--white);
}

/* Chatbot Floating Icon */
.chat-widget-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: var(--transition);
    z-index: 1000;
}

.chat-widget-btn:hover {
    transform: scale(1.1);
    background-color: #23542b;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        padding: 15px;
        gap: 15px;
    }

    .search-cart {
        width: 100%;
        justify-content: space-between;
    }

    .search-bar input {
        width: 100%;
    }
}

/* SPA Pages (Ẩn hiện theo Menu) */
.page-section {
    display: none;
}

.page-section.active-page {
    display: block;
    animation: fadeInPage 0.4s ease;
}

@keyframes fadeInPage {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modals & Overlays */
.modal-overlay,
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.btn-secondary {
    background-color: #EEE;
    color: var(--text-dark);
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-secondary:hover {
    background-color: #DDD;
}

.text-center {
    text-align: center;
}

/* Cart Sidebar */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: var(--white);
    z-index: 1001;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    right: 0;
}

.cart-header {
    padding: 20px;
    border-bottom: 1px solid #EEE;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-cart {
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    border-bottom: 1px solid #EEE;
    padding-bottom: 15px;
}

.cart-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-footer {
    padding: 20px;
    border-top: 1px solid #EEE;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 20px;
}

.cart-total span:last-child {
    color: var(--danger);
}

.btn-checkout {
    width: 100%;
    padding: 12px;
    background-color: #007BFF; /* Đổi sang màu Xanh Dương (Blue) */
    color: white;
    font-weight: bold;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    transition: var(--transition);
}

.btn-checkout:hover {
    background-color: #0056b3; /* Xanh tối hơn lúc di chuột */
}

/* AI Avatar Creator */
.ai-workspace {
    margin-top: 20px;
}

.upload-area {
    border: 2px dashed #CCC;
    padding: 20px;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 15px;
    background: var(--bg-light);
}

.ai-preview {
    margin-top: 15px;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    min-height: 200px;
    background: #EEE;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-preview img {
    width: 100%;
    max-height: 50vh;
    object-fit: contain;
    display: block;
}

.ai-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border-left-color: var(--primary-color);
    animation: spin 1s linear infinite;
    margin: 0 auto 10px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.regen-count {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

.regen-count span {
    font-weight: bold;
    color: var(--primary-color);
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

.chat-header {
    background: var(--primary-color);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: var(--bg-light);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 0.95rem;
    word-wrap: break-word;
    /* Handle long text */
}

.chat-message.bot {
    background: #EAEAEA;
    color: var(--text-dark);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-message.user {
    background: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-footer {
    padding: 10px;
    border-top: 1px solid #EEE;
    display: flex;
    gap: 10px;
}

.chat-footer input {
    flex: 1;
    padding: 10px;
    border: 1px solid #CCC;
    border-radius: 20px;
}

.chat-footer button {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.chat-footer button:hover {
    background: #23542b;
}

/* Chatbot Floating Icon adjust to Right */
.chat-widget-btn {
    left: auto;
    right: 30px;
}