/**
 * Shop Popup Styles
 * Matches InventoryUI pattern with Shop Canopy / Awning Header
 * Tabs styled identically to inventory-popup
 */

/* ===== Backdrop ===== */
.shop-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    justify-content: center;
    align-items: center;
}

.shop-backdrop.active {
    display: flex;
}

/* ===== Main Container ===== */
.shop-popup {
    background: transparent;
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

/* ===== Header (Canopy Awning + Close + Points Badge) ===== */
.shop-header {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    background: transparent;
    z-index: 10;
    margin-bottom: 0;
}

.shop-header-inner {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.shop-title-img {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.16));
}

.shop-close-btn {
    position: absolute;
    right: 4px;
    top: 18px;
    width: 45px;
    height: 45px;
    cursor: pointer;
    transition: transform 0.2s ease;
    z-index: 15;
}

.shop-close-btn:hover {
    transform: scale(1.1);
}

.shop-close-btn:active {
    transform: scale(0.95);
}

/* Points Badge sitting right under the black outline of ร้านค้า */
.shop-points-badge {
    position: absolute;
    top: 72%;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border-radius: 999px;
    padding: 3px 18px;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
    z-index: 12;
    white-space: nowrap;
}

.shop-coin-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    margin-right: 6px;
    vertical-align: middle;
}

.shop-points-label {
    font-family: 'Prompt', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #222222;
    margin-right: 6px;
}

.shop-points-value {
    font-family: 'Prompt', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #DA3732;
}

/* ===== White Popup Card Container (covers the tabs and content) ===== */
.shop-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 24px 16px 20px 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
    width: 95%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: -24px;
    position: relative;
    z-index: 5;
}

/* ===== Tabs (Identical to inventory-popup) ===== */
.shop-tabs {
    display: flex;
    gap: 6px;
    padding: 0 6px;
    justify-content: center;
    margin-bottom: -1px;
    width: 100%;
    box-sizing: border-box;
    z-index: 5;
}

.shop-tab {
    flex: 1;
    padding: 10px 4px;
    font-family: 'Prompt', sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center;
    border: none;
    border-radius: 10px 10px 0 0;
    /* Inactive style: light pink background matching inventory-popup */
    background: #FFE4E1;
    color: #DF9595;
    box-sizing: border-box;
}

.shop-tab:hover {
    background: #FFCEC9;
    color: #DA3732;
}

.shop-tab.active {
    background: #DA3732;
    color: #ffffff;
}

/* ===== Content Wrapper (Red Border matching inventory-popup) ===== */
.shop-content-wrapper {
    margin: 0;
    border: 3px solid #DA3732;
    border-radius: 16px;
    overflow: hidden;
    background: #ffffff;
    width: 100%;
    box-sizing: border-box;
}

/* ===== Content Area ===== */
.shop-content {
    padding: 12px;
    min-height: 280px;
    max-height: 390px;
    overflow-y: auto;
    background: #ffffff;
    box-sizing: border-box;
}

/* Custom Scrollbar matching mockup */
.shop-content::-webkit-scrollbar {
    width: 6px;
}

.shop-content::-webkit-scrollbar-track {
    background: #f4f4f4;
    border-radius: 3px;
}

.shop-content::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 3px;
}

.shop-content::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* ===== Pagination (Matching inventory-popup pattern) ===== */
.shop-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 10px 12px;
    background: #ffffff;
    border-top: 1px solid #f0f0f0;
    box-sizing: border-box;
}

.shop-page-btn {
    padding: 6px 22px;
    border-radius: 20px;
    font-family: 'Prompt', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid #ddd;
    background: #ffffff;
    color: #666666;
    transition: all 0.2s ease;
}

.shop-page-btn:hover:not(:disabled) {
    border-color: #DA3732;
    color: #DA3732;
}

.shop-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.shop-page-info {
    font-family: 'Prompt', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    min-width: 36px;
    text-align: center;
}

/* ===== 2-Column Grid ===== */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* ===== Item Card ===== */
.shop-item {
    background: #F2F6FA;
    border-radius: 14px;
    padding: 12px 10px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 152px;
    box-sizing: border-box;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.shop-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.shop-item-icon {
    width: 62px;
    height: 62px;
    object-fit: contain;
    margin-bottom: 6px;
}

.shop-item-name {
    font-family: 'Prompt', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #222222;
    text-align: center;
    margin-bottom: 8px;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shop-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: auto;
    padding: 0 2px;
    box-sizing: border-box;
}

.shop-item-price {
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    border-radius: 999px;
    padding: 3px 10px;
    font-family: 'Prompt', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #222222;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.shop-price-coin {
    width: 18px;
    height: 18px;
    object-fit: contain;
    margin-right: 4px;
}

.shop-buy-btn {
    background: #DA3732;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 4px 16px;
    font-family: 'Prompt', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.shop-buy-btn:hover {
    background: #C23732;
    transform: scale(1.05);
}

.shop-buy-btn:active {
    transform: scale(0.95);
}

.shop-buy-btn.owned {
    background: #B5B5B5;
    color: #ffffff;
    cursor: not-allowed;
}

.shop-buy-btn.owned:hover {
    background: #B5B5B5;
    transform: none;
}

/* ===== Empty State ===== */
.shop-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 10px;
    min-height: 250px;
}

.shop-empty-img {
    width: 125px;
    height: auto;
    object-fit: contain;
    margin-bottom: 12px;
}

.shop-empty-text {
    font-family: 'Prompt', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    text-align: center;
}

/* ===== Loading State ===== */
.shop-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
}

.shop-spinner {
    width: 38px;
    height: 38px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #DA3732;
    border-radius: 50%;
    animation: shopSpin 1s linear infinite;
}

@keyframes shopSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.shop-loading-text {
    font-family: 'Prompt', sans-serif;
    font-size: 14px;
    color: #666666;
    margin-top: 12px;
}

/* ===== Mobile Responsive ===== */
@media screen and (max-width: 480px) {
    .shop-popup {
        width: 95%;
        max-width: 420px;
    }

    .shop-header {
        margin-bottom: 0;
    }

    .shop-title-img {
        width: 100%;
    }

    .shop-card {
        width: 96%;
        padding: 20px 10px 14px 10px;
        margin-top: -18px;
        border-radius: 18px;
    }

    .shop-close-btn {
        width: 38px;
        height: 38px;
        top: 14px;
        right: 4px;
    }

    .shop-points-badge {
        padding: 2px 12px;
        top: 72%;
        bottom: auto;
    }

    .shop-coin-icon {
        width: 17px;
        height: 17px;
        margin-right: 4px;
    }

    .shop-points-label {
        font-size: 11px;
        margin-right: 4px;
    }

    .shop-points-value {
        font-size: 13px;
    }

    .shop-tabs {
        padding: 0 4px;
        gap: 3px;
        margin-bottom: -1px;
    }

    .shop-tab {
        padding: 8px 3px;
        font-size: 12px;
        border-radius: 8px 8px 0 0;
    }

    .shop-content-wrapper {
        border-radius: 12px;
    }

    .shop-content {
        padding: 8px;
        max-height: 340px;
        min-height: 240px;
    }

    .shop-grid {
        gap: 8px;
    }

    .shop-item {
        padding: 10px 6px 8px;
        min-height: 135px;
        border-radius: 10px;
    }

    .shop-item-icon {
        width: 50px;
        height: 50px;
    }

    .shop-item-name {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .shop-item-price {
        font-size: 12px;
        padding: 2px 8px;
    }

    .shop-price-coin {
        width: 15px;
        height: 15px;
        margin-right: 3px;
    }

    .shop-buy-btn {
        padding: 3px 12px;
        font-size: 12px;
    }

    .shop-empty-img {
        width: 95px;
    }

    .shop-empty-text {
        font-size: 14px;
    }

    .shop-pagination {
        padding: 8px 6px;
        gap: 8px;
    }

    .shop-page-btn {
        padding: 4px 14px;
        font-size: 12px;
    }

    .shop-page-info {
        font-size: 13px;
    }
}
