/* =========================================================
   Store Catalog
   Modern responsive catalog + Dark / Light theme
   ========================================================= */

.product-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
    padding: 22px 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(115deg, rgba(124,92,255,.16), rgba(55,213,255,.045));
    color: var(--text);
    box-shadow: var(--shadow);
}

.product-title {
    min-width: 0;
}

.product-title h2 {
    margin: 0;
    color: var(--text) !important;
    font-family: "Chakra Petch", "Noto Sans Thai", sans-serif;
    font-size: clamp(1.45rem, 3vw, 2rem);
    font-weight: 700;
}

.product-subtitle {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.product-subtitle .shop-description,
.product-subtitle .product-total-count,
.product-subtitle .product-last-sync {
    display: block;
    width: 100%;
}

.shop-description {
    max-width: 720px;
    color: var(--text-muted);
}

.shop-price-badges {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.shop-discount-badge,
.customer-shop-level,
.level-discount {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border: 1px solid rgba(255,200,87,.28);
    border-radius: 999px;
    background: rgba(255,200,87,.09);
    color: #ffe5ae;
    font-size: .8rem;
    font-weight: 700;
}

.customer-shop-level {
    border-color: color-mix(in srgb, var(--level-color, var(--primary)) 45%, transparent);
    background: color-mix(in srgb, var(--level-color, var(--primary)) 12%, transparent);
    color: var(--text);
}

.level-discount {
    padding: 3px 8px;
    border: 0;
    background: rgba(255,255,255,.10);
    color: inherit;
}

/* Search */
.product-search-box {
    position: relative;
    display: grid;
    grid-template-columns: auto 100px 100px 100px 150px 120px;
    align-items: center;
    gap: 9px;
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

.product-search-input {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
}

.product-search-btn,
.product-clear-btn,
.quick-clear-btn,
.copy-btn,
.buy-product-btn,
.contact-admin-btn,
.facebook-btn {
    display: inline-flex !important;
    width: 100%;
    min-height: 44px;
    align-items: center;
    justify-content: center !important;
    gap: 6px;
    padding: 10px 14px;
    border: 1px solid rgba(55,213,255,.42) !important;
    border-radius: 10px;
    background: rgba(55,213,255,.11) !important;
    color: var(--text) !important;
    text-align: center !important;
    text-decoration: none !important;
    font-weight: 800;
    line-height: 1.2;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.product-search-btn:hover,
.product-clear-btn:hover,
.quick-clear-btn:hover,
.buy-product-btn:hover,
.contact-admin-btn:hover,
.facebook-btn:hover {
    transform: translateY(-1px);
}

.product-search-btn,
.buy-product-btn {
    border-color: #8870ff;
    background: linear-gradient(135deg,#7252ec,#5840cf);
    color: #fff !important;
}

.product-clear-btn,
.quick-clear-btn {
    background: rgba(255,255,255,.045);
    color: var(--text-muted);
}

.sort-box,
.per-page-box {
    min-width: 154px;
}

.select-wrapper {
    position: relative;
}

.sort-select,
.per-page-select {
    width: 100%;
    min-height: 42px;
    padding: 8px 34px 8px 12px;
    appearance: none;
    border: 1px solid var(--line) !important;
    border-radius: 10px;
    background: var(--surface-muted);
    color: var(--text);
}

.select-arrow {
    position: absolute;
    top: 50%;
    right: 11px;
    color: var(--text-muted);
    pointer-events: none;
    transform: translateY(-50%);
}

.item-suggest {
    display: none;

    position: absolute;
    z-index: 1200;
    top: calc(100% - 8px);
    left: 14px;
    width: min(560px, calc(100% - 28px));
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--surface-strong);
    color: var(--text);
    box-shadow: var(--shadow);
}

.search-result-info {
    width: 100%;
    margin-left: 0;
    margin-bottom: 14px;
    padding-top: 2px;
    color: var(--text-muted);
    font-size: .85rem;
}

/* Quick character */
.quick-character-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: visible;
    overflow-y: visible;
    flex-wrap: wrap;
    white-space: normal;

    margin-bottom: 16px;
    padding: 12px;

    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.quick-character-btn {
    position: relative;
    display: grid;
    width: 75px;
    height: 75px;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;
    padding: 3px;
    border: 2px solid var(--line-strong);
    border-radius: 14px;
    background: var(--surface-muted);
    cursor: pointer;
    box-sizing: border-box;
    box-shadow: 0 6px 18px rgba(0,0,0,.12);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.quick-character-btn:hover,
.quick-character-btn.active {
    transform: translateY(-2px);
    border-color: var(--cyan);
    box-shadow: 0 0 20px rgba(55,213,255,.22);
}

.quick-character-btn img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    max-height: none;
    object-fit: contain !important;
    object-position: center;
}

.quick-count {
    position: absolute;
    right: 3px;
    bottom: 3px;
    min-width: 18px;
    min-height: 18px;
    align-items: center;
    justify-content: center;
    padding: 1px 4px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: .67rem;
    font-weight: 700;
    line-height: 1;
}

/* Product table */
.product-table-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.table-responsive-mobile {
    overflow-x: auto;
    scrollbar-width: thin;
}

.game-product-table {
    width: 100%;
    min-width: 900px;
    table-layout: fixed;

    margin: 0 !important;

    color: var(--text) !important;

    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--line);
    --bs-table-hover-bg: rgba(124,92,255,.07);
}


.game-product-table .product-code-column {
    width: 85px;
}

.game-product-table .product-images-cell {
    width: 660px;
}

.game-product-table .product-price-column {
    width: 80px;
}

.game-product-table .product-detail-column {
    width: 130px;
}


.game-product-table > thead > tr > th {
    padding: 14px 13px;
    text-align: center !important;
    vertical-align: middle !important;
    border-bottom: 1px solid var(--line-strong) !important;
    background: rgba(124,92,255,.07);
    color: var(--text) !important;
    font-family: "Chakra Petch", "Noto Sans Thai", sans-serif;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}

.game-product-table {
    table-layout: fixed;
}

.game-product-table > thead > tr > th {
    text-align: center !important;
    vertical-align: middle !important;
}

.game-product-table > tbody > tr {
    transition: background .16s ease;
}

.game-product-table > tbody > tr:hover {
    background: rgba(124,92,255,.06);
}

.game-product-table > tbody > tr > td {
    padding: 12px 13px;
    border-bottom-color: var(--line) !important;
    color: var(--text) !important;
    vertical-align: middle !important;
}

.game-product-table .product-code-column,
.game-product-table .product-price-column,
.game-product-table .product-detail-column {
    text-align: center !important;
}

.game-product-table > tbody > tr:last-child > td {
    border-bottom: 0 !important;
}

.copy-box-vertical {
    display: grid;
    gap: 7px;
    justify-items: start;
}

.code-badge,
.uid-badge {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid rgba(55,213,255,.26);
    border-radius: 9px;
    background: rgba(55,213,255,.08);
    color: var(--text);
    font-family: "Chakra Petch", monospace;
    font-size: .9rem;
    font-weight: 800;
}

.copy-btn {
    min-height: 30px;
    padding: 4px 9px;
    background: rgba(255,255,255,.035);
    color: var(--text-muted);
    font-size: .72rem;
}

.product-code-column .copy-btn {
    width: auto !important;
    min-width: 0 !important;
    min-height: 26px;
    padding: 3px 7px;
    font-size: .68rem;
    display: inline-flex !important;
}

.product-code-column .copy-box-vertical {
    justify-items: center;
    width: 100%;
}

.product-code-column .copy-btn {
    width: fit-content !important;
    min-width: 0 !important;
}

.product-images-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 9px;
}

.product-thumb-box {
    position: relative;
    display: grid;
    width: 84px;
    height: 84px;
    flex: 0 0 84px;

    place-items: center;
    overflow: hidden;
    padding: 2px;
    border: 2px solid var(--line-strong);
    border-radius: 12px;
    background: var(--surface-muted);
    box-shadow: 0 6px 16px rgba(0,0,0,.12);
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.product-thumb-box:hover {
    transform: translateY(-2px);
    border-color: var(--cyan);
    box-shadow: 0 0 20px rgba(55,213,255,.18);
}

.product-thumb {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    max-height: none;
    object-fit: contain !important;
    object-position: center;
    cursor: zoom-in;
}

.img-count {
    position: absolute;
    right: 4px;
    bottom: 4px;
    padding: 2px 5px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    background: rgba(5,8,17,.88);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
}

.price-box {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-align: center;
}

.product-detail-column {
    text-align: center !important;
    vertical-align: middle !important;
}

.product-detail-column .buy-product-btn,
.product-detail-column .contact-admin-btn {
    margin-left: auto !important;
    margin-right: auto !important;
}

.normal-price,
.sale-price,
.member-price-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    min-height: 44px;
    padding: 6px 12px;
    border-radius: 10px;
    color: var(--level-color, var(--text)) !important;
    font-size: 1.32rem !important;
    font-weight: 950 !important;
    line-height: 1;
}

.sale-price {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px;
    line-height: 1 !important;
    white-space: nowrap;
}

.sale-price {
    min-width: 96px;
    border: 1px solid rgba(245,158,11,.40);
    background: rgba(245,158,11,.11);
    color: #d99000 !important;
    box-shadow: 0 5px 16px rgba(245,158,11,.08);
}

.member-price {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.member-level-badge {
    display: inline-flex;
    width: fit-content;
    padding: 4px 8px;
    border: 1px solid color-mix(in srgb, var(--level-color, var(--primary)) 35%, transparent);
    border-radius: 7px;
    background: color-mix(in srgb, var(--level-color, var(--primary)) 15%, transparent);
    color: var(--text);
    font-size: .7rem;
    font-weight: 700;
}

.reserved-box {
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid rgba(255,200,87,.27);
    border-radius: 10px;
    background: rgba(255,200,87,.07);
    color: #ffe3a3;
    font-size: .78rem;
}

.reserved-time {
    color: var(--text-muted);
    font-size: .73rem;
}

.buy-product-btn,
.contact-admin-btn {
    width: 100%;
    min-height: 43px;
    margin-bottom: 6px;
}

.buy-product-btn:last-child,
.contact-admin-btn:last-child {
    margin-bottom: 0;
}

/* Pagination */
.product-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 7px;
    margin: 22px 0 10px;
}

.product-pagination a,
.product-pagination span {
    display: inline-flex;
    min-width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    padding: 0 12px;

    border: 1px solid var(--line) !important;
    border-radius: 11px;

    background: var(--surface) !important;
    color: var(--text-muted) !important;

    font-weight: 700;
    text-decoration: none;

    box-shadow: 0 4px 12px rgba(0,0,0,.06);

    transition:
        transform .18s ease,
        border-color .18s ease,
        background .18s ease,
        color .18s ease;
}

.product-pagination a:hover {
    transform: translateY(-1px);

    border-color: var(--line-strong) !important;
    background: var(--surface-muted) !important;
    color: var(--text) !important;
}

.product-pagination span.active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

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

/* Image preview modal */
.item-preview-box {
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: var(--surface) !important;
    color: var(--text) !important;
}

.item-preview-box .modal-header,
.item-preview-box .modal-body {
    background: transparent !important;
    color: var(--text) !important;
}

.item-preview-image {
    max-width: min(86vw, 560px);
    max-height: 74vh;
    border-radius: 12px;
    object-fit: contain;
}

.btn-close {
    filter: invert(1);
}

/* Contact modal - explicit overlay so inline JS can simply toggle display */
.contact-modal {
    position: fixed;
    z-index: 2000;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(3,6,15,.72);
    backdrop-filter: blur(7px);
    color: var(--text);
}

.contact-modal[style*="display: flex"] {
    display: flex !important;
}

.contact-box {
    width: min(100%, 520px);
    max-height: min(86vh, 760px);
    overflow-y: auto;
    padding: 24px;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 24px 70px rgba(0,0,0,.30);
}

.contact-box h3 {
    margin: 0 0 16px;
    color: var(--text);
}

.contact-message-box {
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-muted);
    color: var(--text);
    white-space: pre-wrap;
    line-height: 1.65;
}

.facebook-btn {
    width: 100%;
    margin-bottom: 8px;
    border-color: rgba(55,213,255,.35);
    background: rgba(55,213,255,.09);
    color: var(--cyan);
}

.copy-contact-btn,
.close-btn {
    width: 100%;
    min-height: 42px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255,255,255,.045);
    color: var(--text);
    font-weight: 700;
}

.close-btn {
    margin-bottom: 0;
}

/* Back to top */
.back-to-top {
    position: fixed;
    z-index: 1500;
    right: 22px;
    bottom: 22px;
    display: none;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: linear-gradient(135deg, #7252ec, #5840cf);
    color: #fff;
    box-shadow: 0 14px 34px rgba(35,28,86,.30);
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 800;
    transition: transform .18s ease, box-shadow .18s ease;
}

.back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 42px rgba(35,28,86,.38);
}

/* Empty state */
.empty-product {
    padding: 58px 20px;
    border: 1px dashed var(--line-strong);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text-muted);
    text-align: center;
}

/* Light mode */
body.app-body:not(.dark-mode) .product-header {
    background: linear-gradient(115deg, rgba(104,70,232,.08), rgba(8,127,159,.035));
}

body.app-body:not(.dark-mode) .product-search-box,
body.app-body:not(.dark-mode) .quick-character-bar,
body.app-body:not(.dark-mode) .product-table-card,
body.app-body:not(.dark-mode) .product-pagination a,
body.app-body:not(.dark-mode) .product-pagination span,
body.app-body:not(.dark-mode) .contact-box,
body.app-body:not(.dark-mode) .empty-product {
    background: rgba(255,255,255,.94);
}

body.app-body:not(.dark-mode) .quick-character-btn,
body.app-body:not(.dark-mode) .game-product-table,
body.app-body:not(.dark-mode) .item-suggest {
    background: #fff;
}

body.app-body:not(.dark-mode) .game-product-table > thead > tr > th {
    background: #f0f3f8;
    color: #344054 !important;
}

body.app-body:not(.dark-mode) .game-product-table > tbody > tr:hover {
    background: rgba(104,70,232,.045);
}

body.app-body:not(.dark-mode) .normal-price,
body.app-body:not(.dark-mode) .member-price-number,
body.app-body:not(.dark-mode) .code-badge,
body.app-body:not(.dark-mode) .uid-badge,
body.app-body:not(.dark-mode) .member-level-badge,
body.app-body:not(.dark-mode) .product-title h2 {
    color: var(--text) !important;
}

body.app-body:not(.dark-mode) .item-preview-box {
    background: #fff !important;
    color: var(--text) !important;
}

body.app-body:not(.dark-mode) .contact-modal {
    background: rgba(227,233,241,.74);
}

body.app-body:not(.dark-mode) .contact-message-box {
    background: #f0f3f8;
}

body.app-body:not(.dark-mode) .btn-close {
    filter: none;
}

/* Strong contact button visibility + centered detail */
body.app-body.dark-mode .contact-admin-btn {
    background: rgba(55,213,255,.14) !important;
    border-color: rgba(55,213,255,.55) !important;
    color: #e9fbff !important;
    box-shadow: 0 0 14px rgba(55,213,255,.06);
}

body.app-body:not(.dark-mode) .contact-admin-btn {
    background: rgba(8,127,159,.08) !important;
    border-color: rgba(8,127,159,.28) !important;
    color: #14566a !important;
}

.product-detail-column {
    text-align: center !important;
    vertical-align: middle !important;
}

.product-detail-column .contact-admin-btn,
.product-detail-column .buy-product-btn {
    margin-left: auto;
    margin-right: auto;
    text-align: center !important;
}

/* Extra image safety: keep the whole asset visible inside its frame */
.quick-character-btn img,
.product-thumb {
    object-fit: contain !important;
    object-position: center center !important;
    padding: 2px;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .quick-character-btn {
        width: 82px;
        height: 82px;
        flex-basis: 82px;
        padding: 4px;
        border-width: 2px;
        border-radius: 15px;
    }

    .quick-character-btn img {
        padding: 2px;
    }

    .product-thumb-box {
        width: 80px;
        height: 80px;
        flex-basis: 80px;
        padding: 3px;
        border-width: 2px;
        border-radius: 13px;
    }

    .product-thumb {
        padding: 2px;
    }

    .product-detail-column .contact-admin-btn,
    .product-detail-column .buy-product-btn {
        width: 100%;
        min-height: 46px;
        justify-content: center !important;
        text-align: center !important;
    }
}

/* Responsive */
@media (max-width: 1050px) {
    .product-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .shop-price-badges {
        justify-content: flex-start;
    }

    .product-search-box {
        grid-template-columns:
            1fr 100px 120px;
    }

    .product-search-input {
        grid-column: 1 / -1;
    }

    .sort-box,
    .per-page-box {
        min-width: 0;
    }


    .search-result-info {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .product-header {
        padding: 18px;
        border-radius: 15px;
    }

    .product-title h2 {
        font-size: 1.4rem;
    }

    .product-search-box {
        grid-template-columns: 1fr;
        padding: 12px;
        border-radius: 14px;
    }

    .product-search-input {
        grid-column: auto;
    }

    .product-search-btn,
    .product-clear-btn,
    .sort-box,
    .per-page-box {
        width: 100%;
    }

    .quick-character-bar {
        padding: 10px;
    }

    .quick-character-btn {
        width: 58px;
        height: 58px;
        flex-basis: 58px;
        border-width: 2px;
    }

    .product-images-cell {
        min-width: 300px;
    }

    .product-thumb-box {
        width: 64px;
        height: 64px;
        flex-basis: 64px;
        border-width: 2px;
    }

    .product-pagination {
        gap: 6px;
        margin-top: 18px;
    }

    .product-pagination a,
    .product-pagination span {
        min-width: 40px;
        height: 40px;
        padding: 0 10px;
    }

    .back-to-top {
        right: 14px;
        bottom: 14px;
        width: 46px;
        height: 46px;
        border-radius: 13px;
    }

    .contact-modal {
        padding: 12px;
    }

    .contact-box {
        padding: 18px;
        border-radius: 15px;
    }

    .item-preview-image {
        max-width: 92vw;
        max-height: 70vh;
    }
}

/* =========================================================
   Store Catalog — final visual refinements
   ========================================================= */

/* Keep images smaller than their frame and centered */
.product-thumb-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px;
}

.product-thumb {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 88%;
    max-height: 88%;
    object-fit: contain;
    object-position: center center;
}

/* Slightly more breathing room on quick character images */
.quick-character-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.quick-character-btn img {
    width: 96%;
    height: 96%;
    max-width: 96%;
    max-height: 96%;
    object-fit: contain !important;
    object-position: center center !important;
}

/* Lock search field dimensions while typing */
.product-search-box {
    min-width: 0;
}

.product-search-input {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    resize: none;
}

.product-search-input:focus {
    min-width: 0;
    max-width: 100%;
}

/* Never allow search controls to push the layout wider */
.product-search-box > * {
    min-width: 0;
}

.product-search-box .product-search-input {
    flex: 1 1 auto;
}

/* Buy / contact buttons must remain visible in Light Mode */
.buy-product-btn,
.buy-product-btn:visited,
.buy-product-btn:hover,
.buy-product-btn:focus,
.buy-product-btn:active {
    background: linear-gradient(135deg, #7252ec, #5840cf) !important;
    border-color: #7252ec !important;
    color: #ffffff !important;
    text-align: center;
}

.contact-admin-btn,
.contact-admin-btn:visited,
.contact-admin-btn:hover,
.contact-admin-btn:focus,
.contact-admin-btn:active {
    background: linear-gradient(135deg, #0f9fbd, #087f9f) !important;
    border-color: #087f9f !important;
    color: #ffffff !important;
    text-align: center;
}

.buy-product-btn,
.contact-admin-btn {
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    text-align: center;
}

/* Light mode explicit override */
body.app-body:not(.dark-mode) .buy-product-btn {
    background: linear-gradient(135deg, #7252ec, #5840cf) !important;
    border-color: #7252ec !important;
    color: #fff !important;
}

body.app-body:not(.dark-mode) .contact-admin-btn {
    background: linear-gradient(135deg, #0f9fbd, #087f9f) !important;
    border-color: #087f9f !important;
    color: #fff !important;
}

/* Mobile: preserve centered image proportions */
@media (max-width: 640px) {
    .quick-character-btn {
        padding: 6px;
    }

    .quick-character-btn img {
        width: 86%;
        height: 86%;
        max-width: 86%;
        max-height: 86%;
    }

    .product-thumb-box {
        padding: 9px;
    }

    .product-thumb {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
    }

    .product-search-input {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
}

/* =========================================================
   Final catalog refinements
   ========================================================= */

/* Make product images a little larger while keeping a safe margin */
.product-thumb-box {
    padding: 5px;
}

.product-thumb {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
}

/* Search button: strong contrast in both themes */
.product-search-btn,
.product-search-btn:visited,
.product-search-btn:hover,
.product-search-btn:focus,
.product-search-btn:active {
    background: linear-gradient(135deg, #7252ec, #5840cf) !important;
    border-color: #7252ec !important;
    color: #ffffff !important;
    text-align: center !important;
}

/* Shop discount badge: readable in Light Mode */
.shop-discount-badge {
    color: #7a4b00 !important;
    background: rgba(255, 184, 45, .16) !important;
    border-color: rgba(214, 148, 0, .34) !important;
}

.shop-discount-badge strong {
    color: #5d3700 !important;
}

.shop-discount-icon {
    color: #d77b00 !important;
}

body.app-body.dark-mode .shop-discount-badge {
    color: #ffe5ae !important;
    background: rgba(255, 200, 87, .09) !important;
    border-color: rgba(255, 200, 87, .28) !important;
}

body.app-body.dark-mode .shop-discount-badge strong {
    color: #fff0c8 !important;
}

body.app-body.dark-mode .shop-discount-icon {
    color: inherit !important;
}

/* Extra mobile space for image frame and search button */
@media (max-width: 640px) {
    .product-thumb-box {
        padding: 6px;
    }

    .product-thumb {
        max-width: 92% !important;
        max-height: 92% !important;
    }

    .product-search-btn {
        min-height: 46px;
        font-size: .95rem;
    }

    .shop-discount-badge {
        font-size: .84rem;
        min-height: 42px;
    }
}


/* Copy Toast */
.copy-toast {
    position: fixed;
    z-index: 3000;
    right: 24px;
    bottom: 24px;

    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 180px;
    max-width: calc(100vw - 32px);
    min-height: 44px;

    padding: 10px 16px;

    border: 1px solid rgba(55,213,255,.35);
    border-radius: 12px;

    background: rgba(15,22,40,.96);
    color: #ffffff;

    font-size: .88rem;
    font-weight: 700;
    text-align: center;

    box-shadow: 0 12px 35px rgba(0,0,0,.25);
    backdrop-filter: blur(8px);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(12px);
    transition:
        opacity .2s ease,
        transform .2s ease,
        visibility .2s ease;
}

.copy-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Light Mode */
body.app-body:not(.dark-mode) .copy-toast {
    border-color: rgba(8,127,159,.25);
    background: rgba(255,255,255,.96);
    color: #183042;
    box-shadow: 0 12px 35px rgba(31,45,76,.16);
}

@media (max-width: 640px) {
    .copy-toast {
        right: 12px;
        bottom: 12px;
        left: 12px;
        min-width: 0;
        width: auto;
    }
    .game-product-table {
        min-width: 760px;
    }
}


.item-suggest-row img {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    object-fit: contain;
    object-position: center;
    border-radius: 7px;
}

.quick-clear-row {
    display: contents;
    align-items: center;
    justify-content: flex-end;
}

.quick-clear-row .quick-clear-btn {
    width: 100% !important;
    min-height: 44px;
}

@media (max-width: 640px) {

    .product-search-box {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .product-search-input {
        grid-column: 1 / -1;
        width: 100%;
    }

    .product-search-btn,
    .quick-clear-row,
    .sort-box,
    .per-page-box {
        width: 100%;
    }

    .quick-clear-row {
        display: block;
    }
}

.per-page-box .select-wrapper {
    position: relative;
}

.per-page-box .select-arrow {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    z-index: 2;
    pointer-events: none;
}

.per-page-box .per-page-select {
    width: 100%;
    padding-right: 34px !important;
}


.product-code-actions{
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.favorite-btn {
    width: 30px;
    height: 30px;
    padding: 0;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--line);
    border-radius: 9px;

    background: var(--surface-muted);
    color: var(--text-muted);

    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.favorite-btn.active {
    color: #ff4f81 !important;
    background: rgba(255,77,126,.12);
    border-color: rgba(255,77,126,.45);
}

@media (max-width: 640px) {

    .favorite-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

}

@media (max-width: 640px) {

    .mobile-card-code-main {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    .product-code-actions {
        flex-direction: column;
    }
}


.favorites-filter-btn {
    display: inline-flex !important;

    width: 100%;
    min-width: 0;
    min-height: 44px;

    align-items: center;
    justify-content: center;

    gap: 6px;

    padding: 10px 10px;

    border: 1px solid rgba(255,77,126,.35);
    border-radius: 10px;

    background: rgba(255,77,126,.08);
    color: var(--text);

    font-size: .60rem;
    font-weight: 800;
    line-height: 1;

    white-space: nowrap;
    overflow: hidden;
}

.favorites-filter-btn span {
    flex: 0 0 auto;

    min-width: 20px;
    height: 20px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 5px;

    border-radius: 999px;

    background: rgba(255,77,126,.14);
    color: #ff4f81;

    font-size: .7rem;
}


.favorites-filter-btn.active {
    background: rgba(255,77,126,.16);
    border-color: rgba(255,77,126,.55);
}




@media (max-width: 640px) {

    .product-search-box {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .product-search-input {
        grid-column: 1 / -1;
    }

    .product-search-btn,
    .favorites-filter-btn,
    .quick-clear-row,
    .sort-box,
    .per-page-box {
        width: 100%;
    }

    .sort-box,
    .per-page-box {
        min-width: 0;
    }

    .quick-clear-row {
        display: contents;
    }
}



.product-admin-table {
    width: 100%;
    table-layout: fixed;
}

.product-admin-table .product-uid-column {
    width: 60px;
}

.product-admin-table .product-code-column {
    width: 70px;
}

.product-admin-table .product-images-cell {
    width: 420px;
}

.product-admin-table .product-price-column {
    width: 60px;
}

.product-admin-table .product-detail-column {
    width: 60px;
}

.product-admin-table thead th {
    text-align: center !important;
    vertical-align: middle !important;
}


.mobile-card-price-area {
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
}

.mobile-card-normal-price,
.mobile-card-sale-price {
    font-size: 1.2rem !important;
    font-weight: 900 !important;
}

.mobile-card-member-price {
    align-items: center !important;
    justify-content: center !important;
}

.mobile-card-member-price > strong {
    font-size: 1.25rem !important;
    font-weight: 900 !important;
}

.product-last-sync {
    margin-top: 5px;
    font-size: 12px;
    color: var(--bs-secondary-color, #64748b);
}

.product-last-sync strong {
    font-weight: 800;
    margin-left: 3px;
}

body.dark-mode .product-last-sync {
    color: #aeb6c8;
}

.product-total-count {
    display: block;
    margin-top: 4px;
}

.product-last-sync {
    display: block;
    margin-top: 4px;
    font-size: 12px;
}