/* Production Multi-Vendor Marketplace Custom Styling */
/* Font Kanit โหลดผ่าน <link> ใน header.php แล้ว (เร็วกว่า @import) */

@import url('theme.css');

:root {
    --bs-primary-rgb: 13, 110, 253;
    --app-bg: var(--color-background);
    --app-card-shadow: var(--shadow-sm);
    --app-card-hover-shadow: var(--shadow-md);
}

body {
    font-family: 'Kanit', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--app-bg);
} 

/* Category Section */
.category-grid-container {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
    margin-bottom: 2rem;
}

@media (max-width: 991.98px) {
    .category-grid-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 575.98px) {
    .category-grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Category Circle Card Item */
.category-box-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    padding: 8px; /* reduced padding */
    text-decoration: none;
    color: #334155;
    transition: all 0.2s ease-in-out;
    height: 100px; /* fixed height 100px (40% downsized from 140px) */
    border-radius: 12px; /* border radius 12px */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04); /* light shadow */
}

.category-box-card:hover {
    background: #f8fafc;
    color: #0d6efd;
    transform: translateY(-2px); /* hover effect */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

/* Circular Icon Container */
.category-box-icon {
    width: 32px; /* icon size 32px */
    height: 32px; /* icon size 32px */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    margin-bottom: 6px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

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

/* Category Title */
.category-box-title {
    font-size: 13px; /* font-size 13px */
    font-weight: 500;
    line-height: 1.3;
    color: #334155;
    text-align: center;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 2.6em;
    word-break: break-word;
}
.category-box-card:hover .category-box-title {
    color: #0d6efd;
}

/* Header Styles */
.navbar {
    height: 72px; /* Header height 72px */
    display: flex;
    align-items: center;
}

.navbar .container {
    height: 100%;
    display: flex;
    align-items: center;
}

#navbarMain {
    height: 100%;
    align-items: center;
}

.search-bar-header {
    width: 550px !important; /* Search bar width 550px */
    max-width: 100%;
}

.navbar-nav {
    display: flex;
    flex-direction: row !important;
    align-items: center !important;
    gap: 24px !important; /* Menu items gap 24px */
}

.navbar-nav .nav-item {
    display: flex;
    align-items: center;
    height: 100%;
}

.navbar-nav .nav-link {
    white-space: nowrap !important; /* White space nowrap to keep in single line */
    display: inline-flex;
    align-items: center;
}

/* Floating Navigation Arrows */
.cat-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #334155;
    z-index: 10;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.cat-scroll-btn.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.cat-scroll-btn:hover {
    background: #ffffff;
    color: #0d6efd;
    border-color: #0d6efd;
    box-shadow: 0 6px 16px rgba(13, 110, 253, 0.25);
    transform: translateY(-50%) scale(1.08);
}
.cat-scroll-prev {
    left: -16px;
}
.cat-scroll-next {
    right: -16px;
}

/* Theme updates */
.btn-white {
    background-color: #fff;
    border: 1px solid var(--color-border);
    color: var(--color-primary);
    transition: background-color 0.2s ease, color 0.2s ease;
}
.btn-white:hover {
    background-color: var(--color-primary);
    color: #fff;
}
.btn-primary-burgundy {
    background-color: var(--color-primary);
    border: none;
    color: #fff;
}
.btn-primary-burgundy:hover {
    background-color: var(--color-primary-hover);
}
.btn-outline-burgundy {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}
.btn-outline-burgundy:hover {
    background-color: var(--color-primary);
    color: #fff;
}


.hover-primary:hover {
    color: var(--color-primary-hover) !important;
}

@keyframes fadeInLightbox {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

#lightboxPrev,
#lightboxNext {
    opacity: 0.75;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

#lightboxPrev:hover,
#lightboxNext:hover {
    opacity: 1;
    transform: scale(1.12);
}

/* ==== Custom Map Styles ==== */
.custom-marker .pin {
    background: #ff9800; /* warm soft orange */
    width: 30px;
    height: 30px;
    border-radius: 15px 15px 0 0;
    transform: rotate(45deg);
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.custom-marker .pin i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    color: #fff;
    font-size: 14px;
}
.leaflet-popup-custom .leaflet-popup-content-wrapper {
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.leaflet-popup-custom .leaflet-popup-tip {
    background: #fff;
}
/* Inline Store Map expand/collapse */
.map-collapsed {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}
.map-expanded {
    max-height: 500px; /* adjust as needed */
    overflow: hidden;
    transition: max-height 0.4s ease;
}

/* ================================================================
   MODERN PREMIUM SIDEBAR — SHOP 39
   ================================================================ */

/* ── Toggle Button in Navbar ── */
.sidebar-toggle-btn {
    width: 40px;
    height: 40px;
    color: #334155;
    background: transparent;
    transition: background 0.2s ease, color 0.2s ease;
}
.sidebar-toggle-btn:hover {
    background: #f0f4ff;
    color: #0d6efd;
}

/* ── Overlay ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.28s ease;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.visible {
    display: block;
    opacity: 1;
}

/* ── Drawer ── */
.sidebar-drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: #ffffff;
    z-index: 1060;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 32px rgba(13, 110, 253, 0.10), 0 0 0 1px rgba(226, 232, 240, 0.6);
    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    border-radius: 0 20px 20px 0;
    overflow: hidden;
}
.sidebar-drawer.open {
    transform: translateX(0);
}
body.sidebar-open {
    overflow: hidden;
}

/* ── Sidebar Head ── */
.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 18px 16px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
}

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

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.20);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #ffffff;
    flex-shrink: 0;
}

.sidebar-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.sidebar-logo-name {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.5px;
}
.sidebar-logo-name strong {
    font-weight: 800;
}

.sidebar-logo-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 500;
}

.sidebar-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,0.18);
    border-radius: 8px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
    font-size: 14px;
}
.sidebar-close-btn:hover {
    background: rgba(255,255,255,0.35);
}

/* ── Sidebar Body (scrollable menu area) ── */
.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px 14px;
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}
.sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.sidebar-body::-webkit-scrollbar-track { background: transparent; }

/* ── Group Label ── */
.sidebar-group-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #94a3b8;
    padding: 14px 10px 6px;
    margin-top: 4px;
}

/* ── Menu Item ── */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 11px;
    text-decoration: none;
    color: #475569;
    font-size: 14.5px;
    font-weight: 500;
    margin-bottom: 2px;
    position: relative;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    cursor: pointer;
    border: none;
    background: transparent;
}

.sidebar-item:hover {
    background: #eff6ff;
    color: #0d6efd;
    text-decoration: none;
    transform: translateX(2px);
}

.sidebar-item.active {
    background: #dbeafe;
    color: #0d6efd;
    font-weight: 600;
}
.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #0d6efd;
    border-radius: 0 4px 4px 0;
}

/* Seller apply item: green tint */
.sidebar-item.sidebar-item-seller {
    color: #059669;
}
.sidebar-item.sidebar-item-seller:hover,
.sidebar-item.sidebar-item-seller.active {
    background: #ecfdf5;
    color: #059669;
}
.sidebar-item.sidebar-item-seller.active::before {
    background: #059669;
}

/* Admin item: danger tint */
.sidebar-item.sidebar-item-admin {
    color: #dc2626;
}
.sidebar-item.sidebar-item-admin:hover,
.sidebar-item.sidebar-item-admin.active {
    background: #fef2f2;
    color: #dc2626;
}
.sidebar-item.sidebar-item-admin.active::before {
    background: #dc2626;
}

/* Logout/danger item */
.sidebar-item.sidebar-item-danger {
    color: #dc2626;
}
.sidebar-item.sidebar-item-danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* ── Item Icon ── */
.sidebar-item-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 9px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: background 0.2s ease;
}

.sidebar-item:hover .sidebar-item-icon {
    background: #dbeafe;
}

.sidebar-item.active .sidebar-item-icon {
    background: #bfdbfe;
    color: #0d6efd;
}

.sidebar-item-seller .sidebar-item-icon {
    background: #d1fae5;
    color: #059669;
}
.sidebar-item-seller:hover .sidebar-item-icon {
    background: #a7f3d0;
}

.sidebar-item-admin .sidebar-item-icon {
    background: #fee2e2;
    color: #dc2626;
}
.sidebar-item-danger .sidebar-item-icon {
    background: #fee2e2;
    color: #dc2626;
}

/* ── Item Text ── */
.sidebar-item-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Badge ── */
.sidebar-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
    line-height: 1.4;
    flex-shrink: 0;
}
.sidebar-badge-red {
    background: #ef4444;
    color: #fff;
}
.sidebar-badge-blue {
    background: #0d6efd;
    color: #fff;
}

/* ── Sidebar Footer: User Profile ── */
.sidebar-footer {
    flex-shrink: 0;
    padding: 12px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #eff6ff;
    border: 2px solid #dbeafe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #0d6efd;
    flex-shrink: 0;
    overflow: hidden;
}
.sidebar-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    margin-top: 2px;
}

.sidebar-role-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.sidebar-role-customer {
    background: #eff6ff;
    color: #0d6efd;
}
.sidebar-role-seller {
    background: #ecfdf5;
    color: #059669;
}
.sidebar-role-admin {
    background: #fef2f2;
    color: #dc2626;
}

.sidebar-user-settings {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}
.sidebar-user-settings:hover {
    background: #f1f5f9;
    color: #0d6efd;
}

/* ================================================================
   RESPONSIVE BEHAVIOR
   ================================================================ */

/* Desktop (≥992px): sidebar is always a drawer, closed by default */
@media (min-width: 992px) {
    .sidebar-drawer {
        width: 288px;
    }
}

/* Mobile: narrower drawer */
@media (max-width: 576px) {
    .sidebar-drawer {
        width: 270px;
        border-radius: 0 16px 16px 0;
    }
}

