/**
 * All of the CSS for your public-facing functionality should be
 * included in this file.
 */

#crate-scene {
    position: relative;
    max-width: 800px;
    margin: 16px auto
}

#crate-box {
    width: 320px;
    height: 220px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center
}

#crate-box img {
    width: 100%;
    height: auto;
    transform-origin: center;
    will-change: transform
}

#crate-roll {
    position: relative;
    height: 120px;
    margin-top: 20px;
    overflow: hidden;
}

.roller {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    will-change: transform
}

.tile {
    min-width: 160px;
    height: 100px;
    border-radius: 8px;
    background: #222;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .4)
}
.tile.highlight {
    transform: scale(1.2);
    border: 2px solid gold;
    transition: transform 0.3s ease;
    z-index: 10;
}

.roller-mask {
    position: absolute;
    left: 0;
    right: 0;
    height: 100px;
    top: 0;
    pointer-events: none;
    border-top: 1px solid rgba(255, 255, 255, .03)
}

.hidden {
    display: none
}

#crate-canvas {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none
}

#crate-result-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #111;
    color: #fff;
    padding: 20px;
    border-radius: 10px;
    z-index: 9999;
    min-width: 320px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6)
}
#crate-result-modal h2, #crate-result-modal h3{
	color: #fff;
}

.modal-inner {
    display: grid;
    gap: 12px
}

#crate-result-item {
    font-size: 20px;
    padding: 14px;
    border-radius: 8px;
    background: linear-gradient(90deg, #222, #191919);
    text-align: center
}

#crate-result-item.common {
    box-shadow: 0 0 20px rgba(178, 178, 178, 0.1);
    border: 1px solid rgba(178, 178, 178, 0.2);
}

#crate-result-item.uncommon {
    box-shadow: 0 0 25px rgba(30, 255, 0, 0.1);
    border: 1px solid rgba(30, 255, 0, 0.2);
}

#crate-result-item.rare {
    box-shadow: 0 0 32px rgba(0, 112, 221, 0.18);
    border: 1px solid rgba(0, 112, 221, 0.2);
}

#crate-result-item.epic {
    box-shadow: 0 0 40px rgba(163, 53, 238, 0.2);
    border: 1px solid rgba(163, 53, 238, 0.3);
}

#crate-result-item.legendary {
    box-shadow: 0 0 48px rgba(255, 128, 0, 0.3);
    border: 1px solid rgba(255, 128, 0, 0.4);
    animation: legendary-glow 2s infinite alternate;
}
@keyframes legendary-glow {
    from { box-shadow: 0 0 30px rgba(255, 128, 0, 0.2); }
    to { box-shadow: 0 0 60px rgba(255, 128, 0, 0.5); }
}

/* Fullscreen overlay */

.crate-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    overflow: hidden;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.crate-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.crate-overlay.show {
    opacity: 1;
    pointer-events: auto;
}


/* Inner container (centar ekrana) */

.crate-overlay-inner {
    position: relative;
    width: 80%;
    max-width: 900px;
    height: 250px;
    background: linear-gradient(to bottom, #1a1a1a, #111);
    border: 2px solid #333;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.blurred img {
    filter: blur(3px);
    /* Adjust the value to control blur */
}


/* Roller i itemi */

.crate-roll {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.roller {
    display: flex;
    align-items: center;
    height: 100%;
    transform: translateX(0);
    transition: transform 4s cubic-bezier(0.08, 0.82, 0.17, 1);
}

.roller-item {
    flex: 0 0 120px;
    height: 100%;
    margin: 0 8px;
    border-radius: 10px;
    background: #222;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ddd;
    font-size: 14px;
    text-align: center;
    transition: transform 0.2s;
}

.roller-item img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 8px;
}

.roller-item:hover {
    transform: scale(1.05);
}


/* Marker linija (pokazuje gdje "staje") */

.crate-overlay-inner::after {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: rgba(255, 215, 0, 0.6);
    transform: translateX(-50%);
    pointer-events: none;
}

.view-all-rewards-link {
    display: block;
    text-decoration: none;
    cursor: pointer;
}

.box-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.box-modal.hidden {
    display: none;
}

.box-modal-inner {
    background: #1b1b1b;
    border: 1px solid #444;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px 30px;
    position: relative;
    color: #fff;
}

.box-modal-inner h2 {
    margin-top: 0;
    text-align: center;
    font-size: 22px;
    margin-bottom: 20px;
}

.close-modal {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 26px;
    color: #fff;
    cursor: pointer;
}

.reward-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.reward-grid .reward {
    text-align: center;
    background: #222;
    border-radius: 10px;
    padding: 10px;
    transition: transform 0.2s;
}

.reward-grid .reward:hover {
    transform: scale(1.05);
}

.reward-grid .reward img {
    max-width: 100%;
    border-radius: 6px;
}

.reward-grid .reward.common {
    border: 2px solid #777;
}
.reward-grid .reward.common:hover {
    box-shadow: 0 0 15px rgba(119, 119, 119, 0.3);
}

.reward-grid .reward.uncommon {
    border: 2px solid #1eff00;
}
.reward-grid .reward.uncommon:hover {
    box-shadow: 0 0 15px rgba(30, 255, 0, 0.3);
}

.reward-grid .reward.rare {
    border: 2px solid #0070dd;
}
.reward-grid .reward.rare:hover {
    box-shadow: 0 0 20px rgba(0, 112, 221, 0.4);
	box-shadow: 0 0 20px rgba(0, 112, 221, 0.4);
}

.reward-grid .reward.epic {
    border: 2px solid #a335ee;
	box-shadow: 0 0 25px rgba(163, 53, 238, 0.5);
}
.reward-grid .reward.epic:hover {
    box-shadow: 0 0 25px rgba(163, 53, 238, 0.5);
}

.reward-grid .reward.legendary {
    border: 2px solid #ffd452;
	box-shadow: 0 0 30px rgba(255, 212, 82, 0.6);
}
.reward-grid .reward.legendary:hover {
    box-shadow: 0 0 30px rgba(255, 212, 82, 0.6);
}


/* tile layout */

.tile {
    flex: 0 0 140px;
    height: 160px;
    margin: 0 8px;
    border-radius: 8px;
    background: linear-gradient(180deg, #161616, #0f0f0f);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    color: #fff;
    text-align: center;
    /* overflow: hidden; */
}


/* image container */

.tile-img {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    /* overflow: hidden; */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 8px;
}

.tile-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}


/* placeholder if no image */

.tile-placeholder {
    width: 96px;
    height: 96px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #333, #1a1a1a);
    color: #ddd;
    font-weight: 700;
    font-size: 22px;
}


/* label under image */

.tile-label {
    font-size: 12px;
    line-height: 1.2;
    color: #e6e6e6;
    width: 100%;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}


/* rarity outlines */

.tile.common .tile-img img {
	border: 2px solid #777;
    box-shadow: 0 0 15px rgba(119, 119, 119, 0.3);
}

.tile.uncommon .tile-img img {
    border: 2px solid #1eff00;
    box-shadow: 0 0 15px rgba(30, 255, 0, 0.3);
}

.tile.rare .tile-img img {
    border: 2px solid #0070dd;
    box-shadow: 0 0 20px rgba(0, 112, 221, 0.4);
}

.tile.epic .tile-img img {
    border: 2px solid #a335ee;
	box-shadow: 0 0 25px rgba(163, 53, 238, 0.5);
}

.tile.legendary .tile-img img {
	border: 2px solid #ffd452;
    box-shadow: 0 0 30px rgba(255, 212, 82, 0.6);
	animation: legendary-glow 2s infinite alternate;
}
@keyframes legendary-glow {
    from { box-shadow: 0 0 30px rgba(255, 128, 0, 0.2); }
    to { box-shadow: 0 0 60px rgba(255, 128, 0, 0.5); }
}


/* responsive: smanji tile na mobilu */

@media (max-width: 600px) {
    .tile {
        flex: 0 0 110px;
        height: 130px;
    }
    .tile-img {
        width: 72px;
        height: 72px;
    }
    .tile-placeholder {
        width: 72px;
        height: 72px;
        font-size: 18px;
    }
}

.won-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    text-align: center;
}

.won-item-img {
    width: 160px;
    height: 160px;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    animation: pop-in 0.4s ease-out;
}

.won-item-title {
    font-size: 1.3em;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.won-item.common {
    border: 2px solid #777;
    background: rgba(119, 119, 119, 0.05);
}

.won-item.uncommon {
    border: 2px solid #1eff00;
    background: rgba(30, 255, 0, 0.05);
}

.won-item.rare {
    border: 2px solid #0070dd;
    background: rgba(0, 112, 221, 0.05);
}

.won-item.epic {
    border: 2px solid #a335ee;
    background: rgba(163, 53, 238, 0.05);
}

.won-item.legendary {
    border: 2px solid #ffd452;
    background: rgba(255, 212, 82, 0.05);
    box-shadow: 0 0 20px rgba(255, 212, 82, 0.2);
}

@keyframes pop-in {
    from {
        transform: scale(0.6);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.woocommerce-products-header.mysterx {
    text-align: left !important;
}

.mysterx .woocommerce-products-header__title {
    display: inline;
    width: auto;
    padding: 5px 10px;
}

th.woocommerce-orders-table__header.woocommerce-orders-table__header {
    min-width: 160px;
}

.mysterx h4.woocommerce-products-header__title.page-title {
    display: inline-table;
    margin: 0 15px 0 15px;
    padding: 5px 25px 5px 25px;
}

header.woocommerce-products-header {
    margin-bottom: 15px
}

.mysterx h4.woocommerce-products-header__title.page-title a {
    text-decoration: none;
}

.mysterx .woocommerce-products-header__title.page-title.active,
.mysterx h4.woocommerce-products-header__title.page-title.active,
.mysterx h4.woocommerce-products-header__title.page-title.active,
.mysterx h4.woocommerce-products-header__title.page-title.hover {
    background: var(--wp--preset--color--pale-cyan-blue);
}

.mysterx h4.woocommerce-products-header__title.page-title.hover {
    background: #eee;
}

.open-box-button.is-loading {
    position: relative;
    color: transparent !important; /* Sakrije tekst gumba dok se vrti */
    cursor: wait;
}

.open-box-button.is-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: mysterx-spin 0.6s linear infinite;
}
body.mysterx-processing {
    cursor: wait;
}
body.mysterx-processing::after {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    z-index: 9999;
}
@keyframes mysterx-spin {
	to { transform: rotate(360deg); }
}

/* Rewards List Grid */
.mysterx-rewards-container {
	margin-top: 30px;
	padding: 20px;
	background: #f9f9f9;
	border-radius: 12px;
	border: 1px solid #eee;
}

.mysterx-rewards-title {
	font-size: 1.2em;
	margin-bottom: 15px;
	color: #333;
	font-weight: 600;
}

.mysterx-rewards-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 15px;
}

.mysterx-reward-item {
	background: #fff;
	border-radius: 10px;
	padding: 10px;
	text-align: center;
	transition: transform 0.2s, box-shadow 0.2s;
	border: 1px solid #f0f0f0;
	position: relative;
	overflow: hidden;
	display: block;
	text-decoration: none !important;
}

.mysterx-reward-item:hover {
	transform: translateY(-3px);
	box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.mysterx-reward-image img {
	max-width: 100%;
	height: auto;
	border-radius: 6px;
	margin-bottom: 8px;
}

.mysterx-reward-name {
	display: block;
	font-size: 0.9em;
	font-weight: 500;
	color: #444;
	margin-bottom: 5px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.mysterx-reward-meta {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}

.mysterx-reward-rarity-badge {
	font-size: 0.7em;
	text-transform: uppercase;
	padding: 2px 8px;
	border-radius: 20px;
	font-weight: 700;
	background: #eee;
	color: #666;
}

.mysterx-reward-price {
	font-size: 0.85em;
	font-weight: 600;
	color: #2ecc71;
}

.mysterx-reward-chance {
	font-size: 0.75em;
	color: #888;
	font-weight: 600;
}

/* Rarity Colors */
.rarity-common .mysterx-reward-rarity-badge {
	background: #e0e0e0;
	color: #616161;
}

.rarity-uncommon .mysterx-reward-rarity-badge {
	background: #c8e6c9;
	color: #2e7d32;
}

.rarity-rare .mysterx-reward-rarity-badge {
	background: #bbdefb;
	color: #1565c0;
}

.rarity-epic .mysterx-reward-rarity-badge {
	background: #e1bee7;
	color: #7b1fa2;
}

.rarity-legendary .mysterx-reward-rarity-badge {
	background: #fff9c4;
	color: #fbc02d;
	border: 1px solid #fbc02d;
}

.rarity-legendary {
	border-color: #fbc02d;
}

.rarity-epic {
	border-color: #e1bee7;
}

/* Order Open Box Button */
.mysterx-order-open-box {
    margin-top: 20px;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    text-align: center;
    border-radius: 8px;
}

.mysterx-order-open-box p {
    margin-bottom: 15px;
    font-weight: bold;
    color: #333;
}

.mysterx-order-open-box .mysterx-button {
    display: inline-block;
    padding: 10px 25px;
    background-color: #7f54b3;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.mysterx-order-open-box .mysterx-button:hover {
    background-color: #6a4696;
    color: #fff;
}

/* Sold Out Status */
.mysterx-reward-item.mysterx-sold-out,
.reward-grid .reward.mysterx-sold-out {
	filter: grayscale(100%);
	opacity: 0.6;
	pointer-events: none;
	position: relative;
}

.mysterx-sold-out-badge {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) rotate(-15deg);
	background: #e74c3c;
	color: #fff;
	padding: 5px 15px;
	font-weight: bold;
	font-size: 0.8em;
	text-transform: uppercase;
	border-radius: 4px;
	z-index: 10;
	box-shadow: 0 2px 5px rgba(0,0,0,0.3);
	pointer-events: none;
    border: 2px solid #fff;
}

.reward-grid .reward.mysterx-sold-out .mysterx-sold-out-badge {
    font-size: 0.6em;
    padding: 3px 8px;
}

/* ==================================================== */
/* Multiple Opening Animation Styles                    */
/* ==================================================== */

/* 1. Mystery Chest Stage */
.mysterx-chest-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
}
.mysterx-chest-wrapper {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
}
.mysterx-chest-icon {
    font-size: 90px;
    width: 90px;
    height: 90px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 15px 25px rgba(0,0,0,0.6));
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.mysterx-chest-wrapper.shaking {
    animation: chestRumble 0.15s ease-in-out infinite alternate;
}
.mysterx-chest-wrapper.opening {
    animation: chestBurst 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.mysterx-chest-glow {
    position: absolute;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(243,156,18,0.8) 0%, rgba(241,196,15,0.4) 40%, transparent 70%);
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
    transition: all 0.4s ease;
}
.mysterx-chest-glow.active {
    opacity: 1;
    transform: scale(1.6);
    animation: glowPulse 1.2s ease-in-out infinite alternate;
}
@keyframes chestRumble {
    0% { transform: translate(-3px, 2px) rotate(-3deg); }
    100% { transform: translate(3px, -2px) rotate(3deg); }
}
@keyframes chestBurst {
    0% { transform: scale(1); }
    50% { transform: scale(1.3) translateY(-20px); }
    100% { transform: scale(0) translateY(-60px); opacity: 0; }
}
@keyframes glowPulse {
    0% { opacity: 0.7; transform: scale(1.4); }
    100% { opacity: 1; transform: scale(1.8); }
}

/* 2. 3D Holographic Card Flip Stage */
.mysterx-card-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1200px;
    gap: 15px;
}
.mysterx-card-3d {
    width: 150px;
    height: 210px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}
.mysterx-card-3d.spinning {
    animation: cardHoverSpin 2.5s infinite ease-in-out;
}
.mysterx-card-3d.flipped {
    transform: rotateY(180deg) scale(1.08);
}
.mysterx-card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    padding: 12px;
    box-sizing: border-box;
}
.mysterx-card-front {
    background: linear-gradient(135deg, #1f1f2e, #0d0d14);
    border: 2px solid #f39c12;
    color: #fff;
    transform: rotateY(0deg);
}
.mysterx-card-front .card-back-pattern {
    width: 100%;
    height: 100%;
    border: 1px dashed rgba(243,156,18,0.4);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: radial-gradient(circle, rgba(243,156,18,0.1) 0%, transparent 80%);
}
.mysterx-card-front .card-back-pattern .dashicons {
    font-size: 42px;
    width: 42px;
    height: 42px;
    color: #f39c12;
    filter: drop-shadow(0 0 8px rgba(243,156,18,0.6));
}
.mysterx-card-back {
    background: linear-gradient(135deg, #1a1a24, #12121a);
    border: 2px solid #2ecc71;
    color: #fff;
    transform: rotateY(180deg);
}
@keyframes cardHoverSpin {
    0% { transform: translateY(0) rotateY(-10deg) rotateX(5deg); }
    50% { transform: translateY(-10px) rotateY(10deg) rotateX(-5deg); }
    100% { transform: translateY(0) rotateY(-10deg) rotateX(5deg); }
}

/* 3. Instant Neon Flash Stage */
.mysterx-neon-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.mysterx-neon-ring {
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 3px solid #00f0ff;
    box-shadow: 0 0 30px #00f0ff, inset 0 0 30px #00f0ff;
    animation: neonRingRotate 1.5s linear infinite;
}
.mysterx-neon-ring::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    border: 2px dashed #ff007f;
    box-shadow: 0 0 20px #ff007f;
    animation: neonRingRotate 1s linear infinite reverse;
}
.mysterx-neon-icon {
    font-size: 70px;
    width: 70px;
    height: 70px;
    color: #fff;
    filter: drop-shadow(0 0 15px #00f0ff);
    z-index: 2;
    animation: neonPulse 0.5s ease-in-out infinite alternate;
}
.mysterx-neon-stage.flash-active {
    animation: neonExplosion 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes neonRingRotate {
    to { transform: rotate(360deg); }
}
@keyframes neonPulse {
    from { transform: scale(0.95); opacity: 0.8; }
    to { transform: scale(1.1); opacity: 1; }
}
@keyframes neonExplosion {
    0% { transform: scale(1); opacity: 1; filter: brightness(1); }
    50% { transform: scale(1.4); opacity: 1; filter: brightness(3); }
    100% { transform: scale(0.2); opacity: 0; filter: brightness(5); }
}

