* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: #f4f6f9;
    color: #333;
}

/* Header */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    background-color: #1a1a2e;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
}

.logo {
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.add-product-btn {
    background: #0e19b6;
    color: white;
    text-decoration: none;
    padding: 7px 14px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85rem;
}

.logout-btn {
    color: #ff6b6b;
    text-decoration: none;
    font-size: 0.85rem;
}

/* Layout Container */
.container {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 20px;
}

/* Banner Card */
.banner-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.banner-logo {
    max-width: 180px;
    height: auto;
    object-fit: contain;
}

.banner-text h2 {
    font-size: 1.4rem;
    color: #111;
    margin-bottom: 6px;
}

.banner-text p {
    color: #666;
    font-size: 0.95rem;
}

.section-title {
    text-align: center;
    margin-bottom: 24px;
    font-size: 1.6rem;
    color: #1a1a2e;
}

/* Grid Layout */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (min-width: 576px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 20px;
    }
}

/* Product Card */
.card {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-image-wrapper {
    position: relative;
    width: 100%;
    height: 150px;
    background: #f9f9f9;
    overflow: hidden;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-content {
    padding: 12px;
}

.card-title {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: #111;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.meta-row span {
    font-size: 0.8rem;
    font-family: 'Kantumruy Pro', 'Battambang', 'Hanuman', -apple-system, sans-serif;
    font-weight: 600;
    color: #2e3745;
    line-height: 1.5;
}

.meta-row strong {
    font-size: 0.8rem;
    color: #222;
}

.meta-row strong.highlight {
    color: #111;
    font-weight: bold;
}

/* Product Card View Details Button */
.view-btn {
    width: 100%;
    padding: 8px;
    margin-top: 10px;
    background: #000000;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.view-btn:hover {
    background-color: #ff0000;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(33, 45, 216, 0.3);
}

.view-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Manager Edit/Delete Overlay */
.manager-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    display: flex;
    gap: 6px;
}

.overlay-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 14px;
    border: none;
    cursor: pointer;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
}
.sidebar-overlay.active {
    display: block;
}

.sidebar.open { left: 0; }

.close-btn { font-size: 24px; cursor: pointer; }
.sidebar-menu { list-style: none; }

.sidebar-menu .menu-item {
    padding: 0 !important;
    background: transparent !important;
    border-bottom: 1px solid #f0f0f0;
}

.manager-item { background: #fafafa; }
.manager-access-btn { border: none; background: none; color: #1a1a2e; font-weight: bold; cursor: pointer; width: 100%; text-align: left; }
.manager-badge { color: #2e7d32; font-size: 0.85rem; font-weight: bold; }

/* Modal Base */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 300;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #ffffff;
    padding: 24px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.close-modal {
    position: absolute;
    right: 16px;
    top: 12px;
    font-size: 20px;
    cursor: pointer;
    color: #333;
    z-index: 5;
}

/* Details Modal Styles */
.details-modal-content {
    background: #ffffff !important;
    max-width: 750px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 30px;
    border-radius: 16px;
    box-sizing: border-box;
}

.details-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-top: 15px;
    width: 100%;
    min-width: 0;
    align-items: start;
}

@media (max-width: 600px) {
    .details-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .details-modal-content {
        width: 94%;
        padding: 20px 16px;
    }
}

/* Dynamic Image Wrapper */
.details-image-container {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    background: #ffffff !important;
}

/* Carousel Wrapper */
.carousel-wrapper {
    position: relative;
    width: 100%;
    height: auto;
    overflow: hidden;
    border-radius: 10px;
    touch-action: pan-y;
    background: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
}

.carousel-wrapper img#modal-img {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    user-select: none;
    border-radius: 10px;
    background: #ffffff !important;
}

/* Top-Right Manager Caption Edit Button */
.caption-edit-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(26, 26, 46, 0.85);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 10;
    transition: transform 0.15s ease, background 0.2s ease;
}

.caption-edit-btn:hover {
    background: #1a1a2e;
    transform: scale(1.1);
}

/* Attached Image Caption Box (Below Image Frame, Above Thumbnail Line) */
.image-caption-box {
    margin-top: 6px;
    margin-bottom: 6px;
    padding: 6px 10px;
    background: #f8fafc;
    border-left: 3px solid #1a1a2e;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #334155;
    font-weight: 600;
    text-align: center;
    word-break: break-word;
    display: none;
}

/* ==========================================================================
   WATERMARK LOGO
   ========================================================================== */
/* Default watermark on product grid cards (stays bottom-right) */
.watermark-logo {
    position: absolute !important;
    bottom: 8px !important;
    right: 8px !important;
    width: 12% !important;
    min-width: 32px !important;
    max-width: 65px !important;
    height: auto !important;
    object-fit: contain !important;
    opacity: 0.25 !important;
    pointer-events: none !important;
    z-index: 5 !important;
    border-radius: 4px !important;
}

/* Center-positioned and smaller watermark for the View Details modal carousel */
.carousel-wrapper .watermark-logo {
    top: 50% !important;
    left: 50% !important;
    bottom: auto !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
    width: 13% !important;        /* Reduced size */
    min-width: 50px !important;
    max-width: 85px !important;
    opacity: 0.22 !important;     /* Subtle transparency */
}

/* Thumbnails Strip */
.thumbnail-grid {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
    background: #ffffff !important;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.thumbnail-grid::-webkit-scrollbar {
    height: 4px;
}

.thumbnail-grid::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.thumb-img {
    width: 52px;
    height: 52px;
    min-width: 52px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid #ddd;
    background: #ffffff;
    transition: border-color 0.2s ease, transform 0.1s ease;
}

.thumb-img:hover {
    border-color: #1a1a2e;
}

.thumb-img.active {
    border-color: #212dd8;
    transform: scale(1.05);
}

.details-info {
    min-width: 0;
    word-wrap: break-word;
}

.details-info h2 {
    font-size: 1.4rem;
    color: #1a1a2e;
    margin-bottom: 8px;
    word-break: break-word;
}

.details-badge {
    display: inline-block;
    background: #e2e8f0;
    color: #1a1a2e;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 15px;
}

.details-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
    font-family: 'Kantumruy Pro', 'Battambang', 'Hanuman', -apple-system, sans-serif;
    font-weight: 600;
    color: #2e3745;
    line-height: 2;
}

.details-description {
    margin-top: 15px;
}

.details-description h4 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.details-description p {
    font-size: 0.9rem;
    color: #333;
    line-height: 1.4;
    word-break: break-word;
}

/* Nav Arrows */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    font-size: 1.2rem;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 50%;
    z-index: 2;
    transition: background 0.2s ease;
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.prev-btn { left: 8px; }
.next-btn { right: 8px; }

/* Pagination Dots */
.dots-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    max-width: 100%;
    overflow-x: auto;
    padding: 4px;
    scrollbar-width: none;
    background: #ffffff !important;
}

.dots-container::-webkit-scrollbar {
    display: none;
}

.dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    background: #ccc;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease;
}

.dot.active {
    background: #1a1a2e;
    width: 10px;
    height: 10px;
    min-width: 10px;
}

.manager-status {
    color: #4caf50;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
}

.edit-cat-btn {
    color: #1a1a2e;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.edit-cat-btn:hover {
    color: #212dd8;
}

.delete-cat {
    color: #e53935;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
}

/* Circular Profile Button */
.profile-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2a2a4a;
    color: #ffffff;
    border: 1.5px solid #3f3f6e;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    text-decoration: none;
}

.profile-btn svg {
    width: 22px;
    height: 22px;
}

.profile-btn:hover {
    background: #3f3f6e;
    transform: scale(1.05);
}

.profile-btn.manager-active {
    background: #212dd8;
    border-color: #4c26ff;
}

/* Expandable Search Input */
.search-container {
    display: flex;
    align-items: center;
    position: relative;
}

.search-input {
    width: 0;
    opacity: 0;
    padding: 6px 0;
    border: 1px solid transparent;
    border-radius: 20px;
    background: #ffffff;
    color: #333;
    font-size: 0.85rem;
    transition: width 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    outline: none;
}

.search-container.active .search-input {
    width: 180px;
    opacity: 1;
    padding: 6px 12px;
    border-color: #ccc;
    margin-right: 6px;
}

.icon-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.telegram-btn {
    display: inline-block;
    width: 100%;
    text-align: center;
    background-color: #3da0fc;
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    padding: 12px 20px;
    border-radius: 10px;
    text-decoration: none;
    margin-top: 20px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.telegram-btn:hover {
    background-color: #2563eb;
}

.telegram-btn:active {
    transform: scale(0.98);
}

.pin-top-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
}

.pin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(26, 26, 46, 0.85);
    color: #ffffff;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.1s ease;
}

.pin-btn:hover {
    background: #1a1a2e;
    transform: scale(1.05);
}

/* Mobile Banner Logo Fix */
@media (max-width: 576px) {
    .banner-card {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px;
    }

    .banner-logo {
        max-width: 85px !important;
        height: auto;
        flex-shrink: 0;
    }

    .banner-text h2 {
        font-size: 1.1rem;
        line-height: 1.2;
        margin-bottom: 4px;
    }

    .banner-text p {
        font-size: 0.82rem !important;
        line-height: 1.3;
    }
}

/* Category Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    width: 85% !important;
    max-width: 380px;
    left: -380px;
    height: 100%;
    background: #ffffff;
    z-index: 200;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    padding: 16px;
    overflow-y: auto;
}

.sidebar-header {
    background: #1a1a2e;
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px;
    margin-bottom: 12px;
}

.add-main-cat-btn {
    background-color: #212dd8;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.add-main-cat-btn:hover {
    background-color: #0e19b6;
}

.category-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 14px;
    border-radius: 6px;
    gap: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.category-row:hover,
.category-row:active {
    background-color: #1a1a2e !important;
    color: #ffffff !important;
}

.category-row:hover .category-name-text,
.category-row:active .category-name-text,
.category-row:hover strong,
.category-row:active strong,
.category-row:hover .toggle-arrow-btn,
.category-row:active .toggle-arrow-btn,
.category-row:hover .cat-action-icon,
.category-row:active .cat-action-icon {
    color: #ffffff !important;
}

.category-name-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.cat-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.cat-action-icon {
    font-size: 1rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px 6px;
    color: #444;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease, color 0.2s ease;
    line-height: 1;
}

.cat-action-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.toggle-arrow-btn {
    font-size: 1.25rem !important;
    font-weight: bold;
    color: #1a1a2e;
    padding: 2px 6px;
}

.sub-category-list {
    display: none;
    list-style: none;
    padding-left: 12px;
    margin: 4px 0 8px 10px;
    border-left: 2px solid #e2e8f0;
}

.sub-category-list.open {
    display: block;
}

.sub-item {
    padding: 2px 0;
}

.sub-cat-row {
    font-size: 0.9rem;
    color: #475569;
}

/* ==========================================================================
   FULLSCREEN IMAGE VIEWER MODAL (WITH ZOOM & DRAG SUPPORT)
   ========================================================================== */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.fullscreen-close-btn {
    position: absolute;
    top: 16px;
    right: 20px;
    color: #ffffff;
    font-size: 38px;
    cursor: pointer;
    z-index: 1002;
    font-weight: bold;
    line-height: 1;
}

.fullscreen-content-wrapper {
    position: relative;
    max-width: 96vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.fullscreen-content-wrapper img#fullscreen-img {
    max-width: 96vw;
    max-height: 82vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    cursor: grab;
    transform-origin: center center;
    transition: transform 0.15s ease-out;
}

/* Center-positioned watermark for the Fullscreen viewer */
.fullscreen-watermark {
    top: 50% !important;
    left: 50% !important;
    bottom: auto !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
    width: 12% !important;
    min-width: 55px !important;
    max-width: 90px !important;
    opacity: 0.25 !important;
}
.fullscreen-caption {
    margin-top: 10px;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    max-width: 90%;
    word-break: break-word;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 14px;
    border-radius: 20px;
}