/* ===============================
   INVENTORY PAGE
=============================== */

.inventory-page {
    max-width: 1050px;
    margin: 0 auto;
    padding: 40px 16px;
}

.inventory-header {
    text-align: center;
    margin: 0 0 24px;
}

.inventory-header h1 {
    margin: 0 0 6px;
    font-size: 32px;
    color: #5a2d82;
    line-height: 1.1;
}

.inventory-header p {
    margin: 0;
    color: #5d6470;
    font-size: 15px;
}

/* classic pet-site item grid */
.inventory-grid {
    max-width: 650px;
    margin: 0 auto;

    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 100px));

    gap: 18px 14px;

    justify-content: center;   /* centers the grid itself */
    justify-items: center;     /* centers each item inside */
}

.inventory-item {
    position: relative;
    padding: 8px 6px;
    border-radius: 12px;
    cursor: pointer;
}

.inventory-item:hover {
    background: rgba(212, 146, 253, 0.10);
}

.inventory-item-image {
    position: relative;
    height: 74px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inventory-item-image img {
    max-width: 62px;
    max-height: 62px;
    object-fit: contain;
}

.inventory-item-name {
    margin-top: 5px;
    color: #168116;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.15;
}

.inventory-qty-bubble {
    position: absolute;
    top: 0;
    right: 8px;
    background: linear-gradient(90deg, #d492fd 0%, #91caff 100%);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 7px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.16);
}

.inventory-empty {
    max-width: 620px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #ddd6ff;
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    color: #666;
}

/* ===============================
   ITEM ACTION MODAL - SOFT GAME UI
=============================== */

.inventory-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(25, 18, 40, 0.45);
    backdrop-filter: blur(2px);
}

.inventory-modal.open {
    display: flex;
}

.inventory-modal-card {
    width: min(420px, 100%);
    background: linear-gradient(180deg, #ffffff 0%, #fbf8ff 100%);
    border: 1px solid #d8c8ff;
    border-radius: 18px;
    box-shadow: 0 18px 38px rgba(70, 49, 120, 0.25);
    overflow: hidden;
}

.inventory-modal-header {
    position: relative;
    padding: 22px 20px 12px;
    text-align: center;
}

.inventory-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 10px;
    background: #f1e8ff;
    color: #5a2d82;
    font-weight: 900;
    cursor: pointer;
}

.inventory-modal-image {
    width: 82px;
    height: 82px;
    object-fit: contain;
    display: block;
    margin: 0 auto 10px;
}

.inventory-modal-title {
    margin: 0;
    color: #241636;
    font-size: 20px;
    font-weight: 800;
}

.inventory-modal-desc {
    margin: 0 22px 16px;
    color: #5d6470;
    font-size: 14px;
    line-height: 1.45;
    text-align: center;
}

.inventory-modal-actions {
    padding: 12px;
    background: #f6f0ff;
    border-top: 1px solid #e4d6ff;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inventory-modal-action-link {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e1d2ff;
    color: #5f3e99;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.inventory-modal-action-link:hover {
    background: linear-gradient(90deg, #d492fd 0%, #91caff 100%);
    color: #ffffff;
    border-color: transparent;
}

.inventory-modal-action-link.danger {
    background: transparent;
    border-color: transparent;
    color: #9b7aad;
}

.inventory-modal-action-link.danger:hover {
    background: #f1e8ff;
    color: #5a2d82;
}

/* ===============================
   DARK MODE
=============================== */

body.dark .inventory-modal-card {
    background: #1a1226;
    border-color: #4a326b;
}

body.dark .inventory-modal-title {
    color: #ffffff;
}

body.dark .inventory-modal-desc {
    color: #d9cffb;
}

body.dark .inventory-item:hover {
    background: rgba(185, 120, 255, 0.14);
}

body.dark .inventory-item-name {
    color: #caa7ff;
}

/* ===============================
   MOBILE
=============================== */

@media (max-width: 600px) {
    .inventory-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 14px 10px;
    }

    .inventory-item-image img {
        max-width: 56px;
        max-height: 56px;
    }

    .inventory-item-name {
        font-size: 12px;
    }
}

.inventory-ajax-message {
    max-width: 620px;
    margin: 0 auto 16px;
    padding: 10px 14px;
    border-radius: 12px;
    text-align: center;
    font-weight: 800;
    font-size: 14px;
    transition: opacity 0.35s ease;
}

.inventory-ajax-message.success {
    background: #e8f9ea;
    border: 1px solid #70b77a;
    color: #226a2f;
}

.inventory-ajax-message.error {
    background: #ffe5e5;
    border: 1px solid #d96b6b;
    color: #b10000;
}

.inventory-ajax-message.fade-out {
    opacity: 0;
}

/* =========================
   USE ITEM PAGE
========================= */

.inventory-use-card {
    max-width: 760px;
    margin: 25px auto;
    padding: 24px;

    display: flex;
    align-items: center;
    gap: 22px;

    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(212,146,253,0.18);
    border-radius: 24px;

    box-shadow: 0 10px 28px rgba(90,60,140,0.06);
}

.inventory-use-card img {
    width: 92px;
    height: 92px;
    object-fit: contain;
    flex-shrink: 0;
}

.inventory-use-card h2 {
    margin: 0 0 6px;
    color: #2f3441;
}

.inventory-use-card p {
    margin: 0 0 8px;
    color: #666d7f;
}

.pet-use-list {
    max-width: 760px;
    margin: 0 auto 40px;

    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pet-use-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    padding: 18px 20px;

    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(212,146,253,0.16);
    border-radius: 22px;

    box-shadow: 0 8px 22px rgba(90,60,140,0.05);
}

.pet-use-card h3 {
    margin: 0 0 6px;
    color: #5b2f91;
    font-size: 20px;
}

.pet-use-card p {
    margin: 0;
    color: #687083;
    font-size: 14px;
}

.pet-use-card button {
    border: none;
    padding: 11px 18px;

    border-radius: 14px;

    background: linear-gradient(135deg, #d492fd, #91caff);
    color: white;

    font-weight: 700;
    cursor: pointer;

    transition: 0.2s ease;
}

.pet-use-card button:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}

@media (max-width: 700px) {
    .inventory-use-card,
    .pet-use-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .pet-use-card button {
        width: 100%;
    }
}

.inventory-flip-wrap {
    animation: inventoryFlipIn 0.35s ease both;
}

@keyframes inventoryFlipIn {
    from {
        opacity: 0;
        transform: rotateY(12deg) scale(0.98);
    }

    to {
        opacity: 1;
        transform: rotateY(0deg) scale(1);
    }
}