/* ========================================
   MEL Network Marketplace Styles
   Colors: #951117 (Primary Red), #27347C (Secondary Blue)
   ======================================== */

/* Import Kanit Font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #951117;
    --secondary-color: #27347C;
    --white: #ffffff;
    --light-gray: #f5f5f5;
    --gray: #666666;
    --dark: #333333;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 5px 20px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Kanit', sans-serif;
    background-color: var(--white);
    color: var(--dark);
    line-height: 1.6;
}

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

/* ========================================
   Header Styles
   ======================================== */
.header {
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    gap: 20px;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 24px;
    margin-bottom: 0;
}

.logo h1 i {
    color: var(--secondary-color);
}

.logo .tagline {
    color: var(--gray);
    font-size: 12px;
    margin-top: 2px;
}

.nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav a {
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    padding: 5px 0;
}

.nav a:hover,
.nav a.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-box {
    display: flex;
    border: 2px solid var(--light-gray);
    border-radius: 25px;
    overflow: hidden;
}

.search-box input {
    border: none;
    padding: 8px 15px;
    outline: none;
    width: 250px;
}

.search-box button {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 8px 15px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-box button:hover {
    background-color: #7a0e13;
}

.cart-icon {
    position: relative;
    color: var(--secondary-color);
    font-size: 24px;
    text-decoration: none;
}

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

.btn-login {
    background-color: var(--secondary-color);
    color: var(--white);
    padding: 8px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s;
}

.btn-login:hover {
    background-color: #1f2961;
}

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

.btn-logout {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-logout:hover {
    background-color: #7a0e13;
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 80px 0;
    text-align: center;
}

.hero-content h2 {
    font-size: 42px;
    margin-bottom: 20px;
}

.hero-content p {
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0.95;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    border: 2px solid transparent;
}

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

.btn-primary:hover {
    background-color: var(--light-gray);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background-color: transparent;
    color: var(--white);
    border-color: var(--white);
}

.btn-secondary:hover {
    background-color: var(--white);
    color: var(--secondary-color);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

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

/* ========================================
   Sections
   ======================================== */
.categories,
.featured-products,
.features {
    padding: 60px 0;
}

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

.text-center {
    text-align: center;
    margin-top: 40px;
}

/* ========================================
   Category Grid
   ======================================== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.category-card {
    background-color: var(--white);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    cursor: pointer;
    border: 2px solid transparent;
    text-decoration: none;
    display: block;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.category-card i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.category-card h3 {
    color: var(--secondary-color);
    margin-bottom: 10px;
    font-size: 20px;
}

.category-card p {
    color: var(--gray);
    font-size: 14px;
}

/* ========================================
   Product Grid
   ======================================== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.product-card {
    background-color: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    cursor: pointer;
}

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

.product-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background-color: var(--light-gray);
}

.product-info {
    padding: 20px;
}

.product-category {
    color: var(--secondary-color);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.product-title {
    color: var(--dark);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

.product-price {
    color: var(--primary-color);
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
}

.product-actions {
    display: flex;
    gap: 10px;
}

.btn-view-detail,
.btn-view-full {
    flex: 1;
    background-color: var(--secondary-color);
    color: var(--white);
    padding: 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-view-detail:hover,
.btn-view-full:hover {
    background-color: #1f2961;
    transform: translateY(-2px);
}

.btn-view-detail i,
.btn-view-full i {
    font-size: 16px;
}

/* Legacy button styles (for backward compatibility) */
.btn-add-cart {
    flex: 1;
    background-color: var(--primary-color);
    color: var(--white);
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
}

.btn-add-cart:hover {
    background-color: #7a0e13;
}

.btn-view {
    background-color: var(--secondary-color);
    color: var(--white);
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-view:hover {
    background-color: #1f2961;
}

/* ========================================
   Features Grid
   ======================================== */
.features {
    background-color: var(--light-gray);
}

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

.feature-card {
    background-color: var(--white);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: var(--shadow);
}

.feature-card i {
    font-size: 48px;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.feature-card h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 20px;
}

.feature-card p {
    color: var(--gray);
    font-size: 14px;
}

/* ========================================
   Footer - New Design
   ======================================== */
.footer {
    background-color: #ffffff;
    color: #333;
    padding: 50px 0 20px;
    border-top: 3px solid var(--primary-color);
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 40px;
    margin-bottom: 30px;
}

/* Logo Section */
.footer-logo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-logo {
    margin-bottom: 20px;
    text-align: center;
}

.footer-logo img {
    height: 140px;
    width: auto;
}

.footer-logo-section h3 {
    color: #333;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    text-align: center;
}

.footer-tagline {
    color: #666;
    font-size: 14px;
    font-style: italic;
    margin-bottom: 0;
    text-align: center;
}

/* Section Headers */
.footer-section h4 {
    color: #951117;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-invisible-header {
    visibility: hidden;
    margin-bottom: 20px;
}

/* Links */
.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links li a {
    color: #555;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: all 0.3s;
    font-size: 14px;
}

.footer-links li a i {
    margin-right: 8px;
    color: #951117;
    font-size: 10px;
}

.footer-links li a:hover {
    color: #951117;
    padding-left: 5px;
}

/* Address Section */
.footer-address h4 {
    color: #951117;
}

.address-content p {
    color: #555;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 8px;
}

/* Visitor Counter */
.visitor-counter {
    margin-top: 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
}

.counter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.counter-row:last-child {
    border-bottom: none;
}

.counter-label {
    color: #666;
    font-size: 13px;
    font-weight: 500;
}

.counter-value {
    background: #951117;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
}

/* Footer Bottom */
.footer-bottom {
    text-align: center;
    padding-top: 30px;
    margin-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.footer-bottom p {
    color: #666;
    font-size: 14px;
    margin: 0;
}

/* Responsive Footer */
@media (max-width: 1024px) {
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .footer-logo img {
        max-width: 150px;
    }
}

@media (max-width: 480px) {
    .footer {
        padding: 30px 0 15px;
    }
    
    .footer-section h4 {
        font-size: 16px;
    }
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
    }

    .nav ul {
        gap: 15px;
    }

    .search-box input {
        width: 150px;
    }

    .hero-content h2 {
        font-size: 28px;
    }

    .hero-content p {
        font-size: 16px;
    }

    .section-title {
        font-size: 28px;
    }

    .category-grid,
    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .nav {
        width: 100%;
    }

    .nav ul {
        justify-content: space-around;
    }

    .hero {
        padding: 40px 0;
    }

    .category-grid,
    .product-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   CATEGORIES PAGE - Step by Step Navigation
   ======================================== */
   
.categories-page {
    padding: 40px 0;
    min-height: 400px;
}

/* Breadcrumb Navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 0;
    margin-bottom: 30px;
    font-size: 14px;
    color: #666;
}

.breadcrumb a {
    color: #27347C;
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb a:hover {
    color: #951117;
}

.breadcrumb i {
    font-size: 12px;
    color: #999;
}

/* Categories Grid - Step Layout */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin: 30px 0;
}

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

/* Category Card - Step Style */
.category-card-step {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px 25px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.category-card-step::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #951117, #27347C);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.category-card-step:hover::before {
    transform: scaleX(1);
}

.category-card-step:hover {
    border-color: #951117;
    box-shadow: 0 8px 25px rgba(149, 17, 23, 0.15);
    transform: translateY(-5px);
}

.category-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #951117, #c41520);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.category-card-step:hover .category-icon {
    background: linear-gradient(135deg, #27347C, #3a4a9e);
    transform: scale(1.1) rotate(5deg);
}

.category-icon i {
    font-size: 36px;
    color: white;
}

.category-content {
    width: 100%;
}

.category-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.category-name-en {
    font-size: 13px;
    color: #666;
    margin: 5px 0;
    font-style: italic;
}

.category-keywords {
    font-size: 12px;
    color: #999;
    margin: 10px 0;
    line-height: 1.6;
}

.category-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.category-count {
    font-size: 13px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 5px;
}

.category-count i {
    color: #951117;
}

.has-subcategory {
    color: #27347C;
    font-size: 18px;
    transition: transform 0.3s;
}

.category-card-step:hover .has-subcategory {
    transform: translateX(5px);
}

.view-products {
    color: #951117;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: gap 0.3s;
}

.category-card-step:hover .view-products {
    gap: 10px;
}

/* Back Button Container */
.back-button-container {
    margin: 40px 0 20px;
    text-align: center;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 2px solid #ddd;
    padding: 12px 30px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #27347C;
    color: white;
    border-color: #27347C;
}

/* Page Title & Subtitle */
.page-title {
    font-size: 32px;
    font-weight: 700;
    color: #951117;
    margin-bottom: 10px;
    text-align: center;
}

.page-subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
    text-align: center;
}

/* Empty State */
.empty-categories {
    text-align: center;
    padding: 60px 20px;
}

.empty-categories i {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 20px;
}

.empty-categories h3 {
    font-size: 20px;
    color: #999;
    margin-bottom: 10px;
}

.empty-categories p {
    color: #bbb;
}