/* Advanced Interactive Minecraft Elements */

/* 3D Transform Effects */
.minecraft-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.minecraft-3d:hover {
    transform: translateZ(20px) rotateX(5deg);
}

/* Block Breaking Animation */
@keyframes block-crack {
    0% { background-image: none; }
    20% { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.1) 0px, rgba(255,255,255,0.1) 2px, transparent 2px, transparent 4px); }
    40% { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.2) 0px, rgba(255,255,255,0.2) 3px, transparent 3px, transparent 6px); }
    60% { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.3) 0px, rgba(255,255,255,0.3) 4px, transparent 4px, transparent 8px); }
    80% { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.4) 0px, rgba(255,255,255,0.4) 5px, transparent 5px, transparent 10px); }
    100% { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.5) 0px, rgba(255,255,255,0.5) 6px, transparent 6px, transparent 12px); }
}

.breaking {
    position: relative;
}

.breaking::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-repeat: no-repeat;
    pointer-events: none;
    animation: block-crack 0.3s steps(1) forwards;
    z-index: 10;
}

/* Minecraft Popup */
.minecraft-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #333;
    border: 4px solid #555;
    padding: 20px;
    z-index: 1000;
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.7);
    min-width: 300px;
    text-align: center;
    animation: popup-appear 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popup-appear {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.popup-title {
    color: var(--minecraft-accent);
    font-size: 20px;
    margin-bottom: 15px;
}

.popup-content {
    margin-bottom: 20px;
}

.popup-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Minecraft Achievement */
.minecraft-achievement {
    position: fixed;
    bottom: 20px;
    right: -300px;
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid #555;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    animation: achievement-slide 5s ease-in-out forwards;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    max-width: 280px;
}

@keyframes achievement-slide {
    0% { right: -300px; }
    15% { right: 20px; }
    85% { right: 20px; }
    100% { right: -300px; }
}

.achievement-icon {
    width: 32px;
    height: 32px;
    background: radial-gradient(circle, #ffcc00 0%, #ff9900 70%, #ff6600 100%);
    border-radius: 50%;
    box-shadow: 0 0 5px #ffcc00;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.achievement-text {
    flex: 1;
}

.achievement-title {
    color: #ffff55;
    font-size: 12px;
    margin: 0;
}

.achievement-desc {
    color: #ffffff;
    font-size: 10px;
    margin: 0;
}

/* Minecraft Tooltips */
.minecraft-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid #555;
    padding: 5px 10px;
    color: white;
    font-size: 12px;
    z-index: 1000;
    pointer-events: none;
    white-space: nowrap;
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.2s ease;
}

*[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border: 2px solid #555;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
}

/* XP Orb Animation */
.xp-orb {
    position: absolute;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, #7df9ff 0%, #00ff00 50%, #00cc00 100%);
    border-radius: 50%;
    box-shadow: 0 0 5px #00ff00;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 1000;
    animation: xp-float 1s ease-out forwards;
}

@keyframes xp-float {
    0% { transform: translate(0, 0) scale(0.5); opacity: 0; }
    10% { transform: translate(0, -5px) scale(1); opacity: 1; }
    90% { transform: translate(0, -50px) scale(1); opacity: 1; }
    100% { transform: translate(0, -60px) scale(0.5); opacity: 0; }
}

/* Animated Background Overlay */
.animated-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.animated-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48ZmlsdGVyIGlkPSJhIiB4PSIwIiB5PSIwIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iLjc1IiBzdGl0Y2hUaWxlcz0ic3RpdGNoIi8+PGZlQ29sb3JNYXRyaXggdHlwZT0ic2F0dXJhdGUiIHZhbHVlcz0iMCIvPjwvZmlsdGVyPjxwYXRoIGZpbHRlcj0idXJsKCNhKSIgb3BhY2l0eT0iLjA1IiBkPSJNMCAwaDMwMHYzMDBIMHoiLz48L3N2Zz4=');
    opacity: 0.03;
    animation: overlay-shift 30s linear infinite;
}

@keyframes overlay-shift {
    0% { transform: translate(0, 0); }
    50% { transform: translate(20px, 20px); }
    100% { transform: translate(0, 0); }
}

/* Weather Effects */
.rain-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.4;
}

.rain-drop {
    position: absolute;
    width: 2px;
    height: 20px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.7));
    animation: rain-fall linear infinite;
}

@keyframes rain-fall {
    0% { transform: translateY(-100px); }
    100% { transform: translateY(calc(100vh + 100px)); }
}

/* Redstone Dust Animation */
.redstone-path {
    position: absolute;
    height: 3px;
    background-color: var(--minecraft-redstone);
    opacity: 0.7;
    transform-origin: left center;
    animation: redstone-activate 2s ease-out forwards;
}

@keyframes redstone-activate {
    0% { transform: scaleX(0); filter: brightness(0.5); }
    100% { transform: scaleX(1); filter: brightness(1); }
}

/* Minecraft Item Hover */
.minecraft-item {
    position: relative;
    display: inline-block;
    padding: 5px;
    background-color: #333;
    border: 2px solid #555;
    transition: all 0.2s ease;
}

.minecraft-item:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    z-index: 10;
}

.minecraft-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.minecraft-item:hover::after {
    opacity: 1;
}

/* Enchantment Glint */
.enchanted {
    position: relative;
    overflow: hidden;
}

.enchanted::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, 
        rgba(255,255,255,0) 0%, 
        rgba(255,255,255,0) 45%, 
        rgba(255,255,255,0.3) 50%, 
        rgba(255,255,255,0) 55%, 
        rgba(255,255,255,0) 100%);
    animation: enchant-glint 3s linear infinite;
    pointer-events: none;
}

@keyframes enchant-glint {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(50%, 50%) rotate(360deg); }
}

/* Minecraft Day/Night Cycle */
.day-night-cycle {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #87CEEB, #E0F7FA);
    opacity: 0.1;
    pointer-events: none;
    z-index: -2;
    animation: day-night 120s linear infinite;
}

@keyframes day-night {
    0%, 100% { background: linear-gradient(to bottom, #87CEEB, #E0F7FA); opacity: 0.1; } /* Day */
    25%, 75% { background: linear-gradient(to bottom, #FFA500, #FF4500); opacity: 0.15; } /* Sunset/Sunrise */
    50% { background: linear-gradient(to bottom, #0F2027, #203A43); opacity: 0.2; } /* Night */
}

/* Sound Toggle Button */
.sound-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--minecraft-accent);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
}

.sound-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.7);
}

.sound-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.sound-icon::before {
    content: '🔊';
}

.sound-toggle.sound-off .sound-icon::before {
    content: '🔇';
}

.sound-feedback {
    position: fixed;
    bottom: 70px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--minecraft-accent);
    padding: 5px 10px;
    border: 2px solid var(--minecraft-accent);
    font-family: 'Minecraftia', 'Press Start 2P', monospace;
    font-size: 12px;
    animation: fadeOut 1.5s forwards;
    z-index: 1000;
}

@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}
