/* ==========================================
   HEADER & NAVIGATION
   ========================================== */
.header {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: all var(--transition-fast);
}

.header.scrolled {
    box-shadow: var(--shadow-md);
    background-color: var(--bg-white);
}

.top-bar {
    background-color: var(--primary-color);
    color: var(--bg-white);
    padding: 0.5rem 0;
    font-size: 0.85rem;
}

.top-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-contact {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.top-bar-contact a {
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.top-bar-contact a:hover {
    color: var(--bg-white);
}

/* Prominent Line Add Friend Button */
.top-bar-contact a#top-contact-line {
    background-color: #06c755;
    color: var(--bg-white) !important;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 4px rgba(6, 199, 85, 0.25);
}

.top-bar-contact a#top-contact-line:hover {
    background-color: #05b04c;
    color: var(--bg-white) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(6, 199, 85, 0.35);
}

.top-bar-contact a#top-contact-line svg {
    fill: var(--bg-white) !important;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo span {
    color: var(--highlight-color);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: var(--primary-light);
    font-weight: 500;
    position: relative;
    padding: 0.25rem 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-light);
    transition: width var(--transition-fast);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link.active {
    color: var(--accent-light);
    font-weight: 600;
}

/* Dropdown Menu for Products */
.nav-item-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    width: 250px;
    padding: 0.75rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-fast);
    z-index: 100;
}

.nav-item-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-link {
    display: block;
    padding: 0.5rem 1.25rem;
    color: var(--text-main);
    font-weight: 500;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.dropdown-link:hover {
    background-color: var(--bg-light);
    color: var(--accent-light);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-color);
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

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

.btn-primary:hover {
    background-color: var(--accent-hover);
    color: var(--bg-white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

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

.btn-highlight:hover {
    background-color: var(--highlight-hover);
    color: var(--bg-white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background-color: transparent;
    color: var(--accent-light);
    border: 1px solid var(--accent-light);
}

.btn-outline:hover {
    background-color: var(--accent-light);
    color: var(--bg-white);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* ==========================================
   HERO BANNER
   ========================================== */
.hero {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.85) 100%), 
                url('../assets/images/hero-bg.jpg') no-repeat center center / cover;
    color: var(--bg-white);
    padding: 8rem 0 6rem 0;
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to top, var(--bg-white) 0%, transparent 100%);
    pointer-events: none;
}

.hero-content {
    max-width: 800px;
}

.hero h1 {
    color: var(--bg-white);
    font-size: 3.5rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.hero h1 span {
    color: var(--highlight-color);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 2.5rem;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 1rem;
}

/* ==========================================
   CARDS (PRODUCTS, SERVICES, BLOGS)
   ========================================== */
/* Product Card */
.product-card {
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
}

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

.product-image {
    position: relative;
    height: 220px;
    background-color: var(--bg-light);
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

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

.product-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background-color: var(--primary-color);
    color: var(--bg-white);
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    z-index: 10;
}

.product-details {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-cat {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.product-title {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.product-title a {
    color: var(--primary-color);
}

.product-title a:hover {
    color: var(--accent-light);
}

.product-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-actions {
    margin-top: auto;
    display: flex;
    gap: 0.5rem;
}

/* Service Card */
.service-card {
    background-color: var(--bg-white);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-light);
}

.service-icon {
    width: 60px;
    height: 60px;
    background-color: rgba(30, 64, 175, 0.08);
    color: var(--accent-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    transition: all var(--transition-fast);
}

.service-card:hover .service-icon {
    background-color: var(--accent-color);
    color: var(--bg-white);
}

.service-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.service-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* Blog / Insight Card */
.blog-card {
    background-color: var(--bg-white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

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

.blog-image {
    height: 200px;
    overflow: hidden;
}

.blog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

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

.blog-content {
    padding: 1.5rem;
}

.blog-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.blog-title {
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
}

.blog-title a {
    color: var(--primary-color);
}

.blog-title a:hover {
    color: var(--accent-light);
}

.blog-summary {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* ==========================================
   FLOATING ACTION BUTTONS
   ========================================== */
.floating-actions {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 999;
}

.floating-btn {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-white);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    border: none;
}

.floating-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.floating-line {
    background-color: #06c755; /* Line green */
}

.floating-phone {
    background-color: var(--highlight-color);
}

.floating-rfq {
    background-color: var(--accent-light);
}

.rfq-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--highlight-color);
    color: var(--bg-white);
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-white);
    box-shadow: var(--shadow-sm);
}

/* ==========================================
   FORMS & INPUTS
   ========================================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-white);
    color: var(--text-main);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* ==========================================
   FOOTER
   ========================================== */
.footer {
    background-color: var(--primary-color);
    color: var(--text-light);
    padding: 5rem 0 2rem 0;
    border-top: 4px solid var(--highlight-color);
}

.footer-top {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 3rem;
    margin-bottom: 3.5rem;
}

.footer-brand h3 {
    color: var(--bg-white);
    margin-bottom: 1.25rem;
}

.footer-brand p {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.footer-socials {
    display: flex;
    gap: 1rem;
}

.social-icon {
    width: 38px;
    height: 38px;
    background-color: var(--primary-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-white);
    transition: background-color var(--transition-fast);
}

.social-icon:hover {
    background-color: var(--accent-light);
}

.footer-column h4 {
    color: var(--bg-white);
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-column h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background-color: var(--highlight-color);
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--text-light);
    transition: color var(--transition-fast), padding-left var(--transition-fast);
}

.footer-links a:hover {
    color: var(--bg-white);
    padding-left: 5px;
}

.footer-contact li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.footer-contact li svg {
    flex-shrink: 0;
    color: var(--highlight-color);
    margin-top: 3px;
}

.footer-bottom {
    border-top: 1px solid var(--primary-light);
    padding-top: 2rem;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-bottom-links {
    display: flex;
    gap: 1.5rem;
}

.footer-bottom-links a {
    color: var(--text-light);
}

.footer-bottom-links a:hover {
    color: var(--bg-white);
}

/* ==========================================
   RESPONSIVE FOOTER & MENU
   ========================================== */
@media (max-width: 1024px) {
    .footer-top {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
    }
}

@media (max-width: 768px) {
    /* Hide the contact top bar on mobile — the bottom app bar already
       carries the phone and LINE actions. */
    .top-bar { display: none; }
    
    .top-bar-contact {
        justify-content: center;
        gap: 1rem;
        flex-wrap: wrap;
        width: 100%;
    }

    .navbar {
        position: relative;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--bg-white);
        flex-direction: column;
        align-items: flex-start;
        padding: 1.5rem;
        border-top: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
        gap: 1rem;
        display: none; /* Controlled by JS class */
    }
    
    .nav-menu.open {
        display: flex;
    }
    
    .dropdown-menu,
    .mega-dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border: none;
        padding: 0 0 0 1rem;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
    }
    
    /* Reset mega dropdown to single-column stack on mobile */
    .mega-dropdown-menu {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
        padding: 0.5rem 0 0.5rem 1rem !important;
    }
    
    .mega-menu-column h4 {
        margin-top: 0.75rem;
        font-size: 0.8rem;
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .nav-item-dropdown.active .dropdown-menu,
    .nav-item-dropdown.active .mega-dropdown-menu {
        display: block;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .hero {
        padding: 6rem 0 4rem 0;
    }
    
    .hero h1 {
        font-size: 1.85rem !important;
        line-height: 1.35;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: 1.75rem;
    }
    
    .footer-top {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .form-group {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .form-label {
        margin-bottom: 0.25rem;
    }

    .product-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .product-actions .btn {
        width: 100%;
        flex: none !important;
    }
}

/* ==========================================
   PRODUCT SEARCH & CATEGORY SHORTCUTS
   ========================================== */
.shortcut-item:hover {
    transform: translateY(-3px);
    border-color: var(--accent-light) !important;
    box-shadow: var(--shadow-md) !important;
}

.search-box-container:focus-within {
    border-color: var(--accent-light) !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2) !important;
}

.search-box-container input {
    flex: 1;
    min-width: 0;
}

.search-results-dropdown {
    box-sizing: border-box;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-fast);
    cursor: pointer;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: var(--bg-light);
}

.search-result-img {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.search-result-details {
    flex-grow: 1;
}

.search-result-name {
    font-size: 0.925rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.15rem;
    line-height: 1.3;
}

.search-result-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.75rem;
}

.search-result-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-color);
    flex-shrink: 0;
}

.search-no-results {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive adjustments for category grid */
@media (max-width: 768px) {
    .shortcuts-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem !important;
    }
    .shortcut-item {
        padding: 0.75rem 0.5rem !important;
        gap: 0.4rem !important;
    }
    .shortcut-icon {
        font-size: 1.75rem !important;
    }
    .shortcut-label {
        font-size: 0.75rem !important;
    }
}

@media (max-width: 480px) {
    .shortcuts-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ==========================================
   RFQ STEPS & SUCCESS MODAL
   ========================================== */
.modal-overlay {
    transition: opacity var(--transition-normal);
}

.success-card {
    animation: fadeIn var(--transition-normal) forwards;
}

@media (max-width: 768px) {
    .rfq-steps-indicator {
        padding: 1rem !important;
        margin-bottom: 2rem !important;
        gap: 0.5rem;
    }
    .step-line {
        display: none !important;
    }
    .step-text {
        font-size: 0.75rem !important;
    }
    .step-number {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.8rem !important;
    }
    .success-card {
        padding: 1.5rem !important;
    }
    .success-card h2 {
        font-size: 1.5rem !important;
    }
    .steps-box {
        padding: 1rem !important;
        margin-bottom: 1.5rem !important;
    }
    .steps-box ol {
        padding-left: 0.5rem !important;
    }
    .steps-box li {
        font-size: 0.85rem !important;
    }
}

/* ==========================================
   MODERN PREMIUM MISUMI-STYLE LAYOUT
   ========================================== */

/* Mega Dropdown Menu */
.mega-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    width: 600px;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 1000;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.nav-item-dropdown:hover .mega-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.mega-menu-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mega-menu-column h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.mega-dropdown-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.925rem;
    transition: all var(--transition-fast);
}

.mega-dropdown-link:hover {
    background-color: var(--bg-light);
    color: var(--accent-light);
    transform: translateX(4px);
}

.mega-dropdown-link .icon {
    font-size: 1.25rem;
}

/* Catalog 2-Column Sidebar Layout */
.catalog-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2.5rem;
    align-items: start;
    margin-top: 2rem;
}

.catalog-sidebar {
    position: sticky;
    top: 120px;
    max-height: calc(100vh - 160px);
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    z-index: 100;
    
    /* Scroll behavior enhancements */
    overflow-y: auto;
    overscroll-behavior: auto; /* When the menu reaches its end, let the wheel keep scrolling the page */
}

/* Thin modern scrollbar for catalog sidebar */
.catalog-sidebar::-webkit-scrollbar {
    width: 6px;
}
.catalog-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.catalog-sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(15, 23, 42, 0.35);
    border-radius: var(--radius-full);
}
.catalog-sidebar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(15, 23, 42, 0.3);
}

.catalog-sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--accent-light);
    padding-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.catalog-sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.catalog-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: all var(--transition-fast);
}

.catalog-sidebar-link:hover {
    background-color: var(--bg-light);
    color: var(--accent-light);
    padding-left: 1.25rem;
}

.catalog-sidebar-link.active {
    background-color: rgba(59, 130, 246, 0.06);
    color: var(--accent-color);
    font-weight: 600;
    border-left-color: var(--accent-light);
}

.catalog-sidebar-link .icon {
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
}

.catalog-main {
    display: flex;
    flex-direction: column;
}

/* Responsive sidebar styling for mobile */
@media (max-width: 992px) {
    .catalog-layout {
        grid-template-columns: 240px 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .mega-dropdown-menu {
        display: none !important; /* Hide mega menu on mobile, default fallback triggers */
    }
    
    .catalog-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .catalog-sidebar {
        position: static;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0;
        margin-bottom: 0.5rem;
        /* Not a scroll container on mobile — let wheel/touch scroll the page */
        max-height: none;
        overflow-y: visible;
        overscroll-behavior: auto;
    }
    
    .catalog-sidebar-title {
        display: none;
    }
    
    .catalog-sidebar-menu {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.25rem 0;
        scrollbar-width: none; /* Hide scrollbar for Firefox */
    }
    
    .catalog-sidebar-menu::-webkit-scrollbar {
        display: none; /* Hide scrollbar for Chrome/Safari */
    }
    
    .catalog-sidebar-link {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-full);
        background-color: var(--bg-white);
        color: var(--text-main);
        font-size: 0.85rem;
        font-weight: 500;
        white-space: nowrap;
        scroll-snap-align: start;
        transition: all var(--transition-fast);
    }
    
    .catalog-sidebar-link:hover {
        background-color: var(--bg-light);
        color: var(--accent-light);
        padding-left: 1rem; /* Reset desktop padding shift hover effect */
    }
    
    .catalog-sidebar-link.active {
        background-color: var(--primary-color);
        color: var(--bg-white);
        border-color: var(--primary-color);
        font-weight: 600;
    }
    
    /* Hide category menu emojis/icons on mobile */
    .catalog-sidebar-link .icon {
        display: none;
    }

    /* Hide category cards images on mobile */
    .category-card-img-wrapper {
        display: none;
    }
}

/* Catalog Category Cards */
.category-card {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-light);
}

.category-card-img-wrapper {
    height: 140px;
    width: 100%;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.category-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

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

.category-card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex-grow: 1;
}

.category-card-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-weight: 700;
}

.category-card-text {
    font-size: 0.825rem;
    color: var(--text-muted);
    margin: 0 0 1.25rem 0;
    line-height: 1.4;
    min-height: 48px;
}

/* Language Selector */
.lang-selector {
    position: relative;
    display: inline-block;
    margin-left: 1rem;
    align-self: center;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lang-btn:hover {
    border-color: var(--accent-light);
    color: var(--accent-light);
    background-color: var(--bg-light);
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 120px;
    z-index: 1000;
    overflow: hidden;
}

.lang-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-main);
    font-size: 0.85rem;
    text-decoration: none;
    transition: background-color var(--transition-fast);
    text-align: left;
}

.lang-dropdown a:hover {
    background-color: var(--bg-light);
    color: var(--accent-light);
}

.lang-selector.active .lang-dropdown {
    display: block;
}

/* Mobile Language Selector adjustment */
@media (max-width: 768px) {
    .lang-selector {
        margin-left: 0;
        margin-top: 1rem;
        width: 100%;
        display: flex;
        justify-content: center;
    }
    .lang-dropdown {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
}


/* ==========================================================================
   SUBCATEGORY FILTER CHIPS (catalog landing pages)
   ========================================================================== */
.subcat-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.subcat-chip {
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full, 9999px);
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.subcat-chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.subcat-chip.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* Subcategory list expanded under the active category in the catalog sidebar */
.catalog-subcat-list {
    display: flex;
    flex-direction: column;
    margin: 0.15rem 0 0.6rem 0.4rem;
    padding-left: 0.5rem;
    border-left: 2px solid var(--border-color);
}

.catalog-subcat-link {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.4rem 0.6rem 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}

.catalog-subcat-link:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.catalog-subcat-link.active {
    background: var(--bg-light);
    color: var(--primary-color);
    font-weight: 700;
}

/* Mobile: subcategory list drops onto its own full-width row below the
   category pills (order:1) and renders as wrapped pills instead of a
   squished vertical block inside the horizontal menu. Placed after the
   base rules above so it wins the cascade. */
@media (max-width: 768px) {
    .catalog-subcat-list {
        order: 1;
        flex: 0 0 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.4rem;
        margin: 0.65rem 0 0;
        padding: 0.65rem 0 0;
        border-left: none;
        /* Dashed divider separates subcategories from the main category pills */
        border-top: 1px dashed var(--border-color);
    }

    /* Small label so the row reads clearly as "subcategories of the selected one" */
    .catalog-subcat-list::before {
        content: 'หมวดย่อย:';
        flex: 0 0 auto;
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--text-muted);
        letter-spacing: 0.02em;
    }

    /* Subcategory pills: softer look (tinted, borderless, smaller) so they
       visually sit one level below the white bordered main-category pills */
    .catalog-subcat-link {
        flex: 0 0 auto;
        white-space: nowrap;
        font-size: 0.78rem;
        padding: 0.35rem 0.8rem;
        border: 1px solid transparent;
        border-radius: var(--radius-full);
        background-color: var(--bg-light);
        color: var(--text-muted);
    }

    .catalog-subcat-link.active {
        background-color: var(--primary-color);
        color: var(--bg-white);
        border-color: var(--primary-color);
        font-weight: 600;
    }
}

/* Variant option pills on product cards (สี / ขนาด selectors) */
.variant-rows {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin: 0.5rem 0 0.65rem;
}

.variant-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.variant-row-label {
    flex: 0 0 auto;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.variant-pill {
    flex: 0 0 auto;
    font-size: 0.8rem;
    padding: 0.28rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background-color: var(--bg-white);
    color: var(--text-main);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.variant-pill:hover {
    border-color: var(--accent-light);
    color: var(--accent-light);
}

.variant-pill.active {
    background-color: var(--primary-color);
    color: var(--bg-white);
    border-color: var(--primary-color);
    font-weight: 600;
}

.variant-pill.unavailable {
    opacity: 0.35;
    cursor: not-allowed;
    text-decoration: line-through;
}

.btn-add-rfq:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Subcategory badge on product cards */
.product-subcat-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-light, #2563eb);
    background: rgba(37, 99, 235, 0.08);
    border-radius: var(--radius-sm);
    padding: 0.1rem 0.5rem;
    margin-bottom: 0.4rem;
}

/* ==========================================================================
   MEGA MENU SUBCATEGORY PANEL (shared flyout, pops to the right of the menu)
   ========================================================================== */
.mega-subcat-panel {
    display: none;
    position: absolute;
    top: 0;
    left: 100%;
    margin-left: -1px;          /* touch the menu edge so the hover path is seamless */
    width: 250px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl, 0 12px 30px rgba(0, 0, 0, 0.15));
    padding: 0.6rem;
    z-index: 1200;
}

.mega-subcat-panel.open {
    display: block;
}

.mega-subcat-link {
    display: block;
    font-size: 0.85rem;
    color: var(--text-main);
    text-decoration: none;
    padding: 0.45rem 0.7rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}

.mega-subcat-link:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

/* Mega menu is hidden on mobile (≤768px), so the panel needs no mobile styles */

/* ==========================================================================
   SUBCATEGORY SECTION HEADING (in-page catalog grid divider)
   ========================================================================== */
.subcat-section-title {
    grid-column: 1 / -1;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 1.5rem 0 0.25rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--border-color);
}

.subcat-section-title:first-child {
    margin-top: 0;
}




/* ==========================================================================
   MOBILE MARKETPLACE MODE (Shopee/Lazada-style) — product pages, ≤768px
   ========================================================================== */
@media (max-width: 768px) {
    /* Tighter 2-column product grid */
    .catalog-main .grid-3,
    #featured-products-grid.grid-3 {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    /* Compact product card */
    .product-card {
        border-radius: 10px;
    }
    .product-card:hover { transform: none; box-shadow: var(--shadow-sm); }
    .product-image {
        height: auto;
        aspect-ratio: 1 / 1;
    }
    .product-image img { object-fit: contain; }
    .product-details { padding: 0.6rem; }
    .product-cat { font-size: 0.62rem; margin-bottom: 0.2rem; }
    .product-title {
        font-size: 0.82rem;
        line-height: 1.35;
        margin-bottom: 0.35rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    /* Hide the long description on the mobile card — marketplace style */
    .product-desc { display: none; }
    .product-details .product-subcat-badge { display: none; }
    /* Shrink the "spec" secondary button, keep RFQ button prominent */
    .product-actions { gap: 6px; }
    .product-actions .btn { font-size: 0.72rem; padding: 0.45rem 0.4rem; }

    /* Category (brand) tag smaller */
    .product-badge { font-size: 0.62rem; padding: 0.15rem 0.5rem; top: 0.5rem; left: 0.5rem; }

    /* Variant option pills tighter on mobile cards */
    .variant-rows { margin: 0.35rem 0 0.5rem; gap: 0.3rem; }
    .variant-row-label { font-size: 0.68rem; }
    .variant-pill { font-size: 0.72rem; padding: 0.2rem 0.55rem; }

    /* Sticky search bar on catalog pages */
    .catalog-main > .search-box-wrapper {
        position: sticky;
        top: 0;
        z-index: 90;
        background: var(--bg-white);
        padding: 0.5rem 0;
        margin-bottom: 1rem !important;
    }

    /* Replace the floating action stack with a bottom app bar */
    .floating-actions { display: none !important; }

    body { padding-bottom: 62px; }
}

/* Discount badge (marketplace "-X%") — visible on all viewports */
.product-discount {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #dc2626;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-bottom-left-radius: 8px;
    z-index: 11;
    line-height: 1.3;
}

/* Bottom app bar (mobile only, shown via JS) */
.mobile-app-bar { display: none; }
@media (max-width: 768px) {
    .mobile-app-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: var(--bg-white);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.06);
        padding: 4px 0 max(4px, env(safe-area-inset-bottom));
    }
    .mobile-app-bar a {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 4px 0;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 0.62rem;
        position: relative;
    }
    .mobile-app-bar a.active { color: var(--highlight-color); }
    .mobile-app-bar a svg { width: 22px; height: 22px; }
    .mobile-app-bar .app-bar-badge {
        position: absolute;
        top: 0;
        right: 50%;
        transform: translateX(16px);
        background: #dc2626;
        color: #fff;
        font-size: 0.6rem;
        font-weight: 700;
        min-width: 16px;
        height: 16px;
        border-radius: 999px;
        display: none;
        align-items: center;
        justify-content: center;
        padding: 0 4px;
    }
}

/* Compact page-title hero (dark breadcrumb band) on mobile */
@media (max-width: 768px) {
    section.section-alt[style*="--primary-color"] {
        padding: 1rem 0 !important;
    }
    section.section-alt[style*="--primary-color"] h1 {
        font-size: 1.3rem !important;
        margin-bottom: 0.2rem !important;
    }
    section.section-alt[style*="--primary-color"] p {
        font-size: 0.78rem !important;
    }
}

/* Floating LINE CTA pill — always visible, dismissible per session */
.line-cta-float {
    position: fixed;
    left: 14px;
    bottom: 20px;
    z-index: 998;
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #06C755;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(6, 199, 85, 0.4);
    text-decoration: none;
    animation: lineCtaPulse 2.4s ease-in-out infinite;
}
.line-cta-float svg { width: 20px; height: 20px; flex: 0 0 auto; }
.line-cta-float .line-cta-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 2px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 0.7rem;
    line-height: 1;
    border: none;
    cursor: pointer;
}
@keyframes lineCtaPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}
@media (max-width: 768px) {
    .line-cta-float {
        bottom: 74px; /* clear the mobile app bar */
        left: 10px;
        font-size: 0.78rem;
        padding: 0.5rem 0.85rem;
    }
}

/* "Load more" full-width control inside the product grid */
.load-more-wrap {
    grid-column: 1 / -1;
    text-align: center;
    padding: 0.75rem 0 0.25rem;
}

/* ==========================================================================
   RELATED PRODUCTS — single horizontally-scrollable row (marketplace style)
   ========================================================================== */
#related-products .grid-3 {
    display: flex;
    grid-template-columns: none;
    gap: 0.75rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.75rem;
}

#related-products .grid-3::-webkit-scrollbar { height: 6px; }
#related-products .grid-3::-webkit-scrollbar-track { background: transparent; }
#related-products .grid-3::-webkit-scrollbar-thumb {
    background-color: rgba(15, 23, 42, 0.25);
    border-radius: 999px;
}

#related-products .product-card {
    flex: 0 0 200px;
    scroll-snap-align: start;
}

#related-products .product-image {
    height: auto;
    aspect-ratio: 1 / 1;
}
#related-products .product-image img { object-fit: contain; }

#related-products .product-details { padding: 0.6rem; }
#related-products .product-cat { font-size: 0.62rem; margin-bottom: 0.2rem; }
#related-products .product-title {
    font-size: 0.82rem;
    line-height: 1.35;
    margin-bottom: 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.2em;
}
#related-products .product-desc { display: none; }
#related-products .product-actions { gap: 6px; }
#related-products .product-actions .btn { font-size: 0.72rem; padding: 0.45rem 0.4rem; }
#related-products .product-badge { font-size: 0.62rem; padding: 0.15rem 0.5rem; top: 0.5rem; left: 0.5rem; }
#related-products .product-card:hover { transform: none; box-shadow: var(--shadow-sm); }

@media (max-width: 768px) {
    #related-products .product-card { flex: 0 0 160px; }
    #related-products .grid-3 { gap: 0.5rem; }
}
