/* Maze Game Enhanced Animations
 * Based on inspiration from blockly.games/maze
 */

/* Improved Maze Container */
.maze-container {
    position: relative;
    width: 100%;
    height: 400px;
    background-color: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid #ddd;
}

.maze-container:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* Grid Styling */
.maze-grid {
    display: grid;
    width: 100%;
    height: 100%;
    background-color: #f8f9fa;
    background-image: 
      linear-gradient(rgba(200, 200, 200, 0.1) 1px, transparent 1px),
      linear-gradient(90deg, rgba(200, 200, 200, 0.1) 1px, transparent 1px),
      radial-gradient(circle at 10% 10%, rgba(230, 230, 250, 0.6) 0%, rgba(245, 245, 250, 0.3) 80%);
    transition: all 0.3s ease;
}

/* Cell Styling */
.maze-cell {
    border: 1px solid #e0e0e0;
    box-sizing: border-box;
    transition: background-color 0.3s ease;
}

.maze-wall {
    background-color: #4e5d6c;
    background-image: 
        linear-gradient(135deg, #455a70 25%, transparent 25%),
        linear-gradient(225deg, #455a70 25%, transparent 25%),
        linear-gradient(315deg, #455a70 25%, transparent 25%),
        linear-gradient(45deg, #455a70 25%, transparent 25%);
    background-size: 10px 10px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.maze-start {
    background-color: #5cb85c;
    background-image: 
        radial-gradient(circle, #5cb85c 60%, #4cae4c 100%),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0px, rgba(255, 255, 255, 0.1) 5px, transparent 5px, transparent 10px);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.1);
}

.maze-finish {
    background-color: #d9534f;
    background-image: 
        radial-gradient(circle, #d9534f 60%, #c9302c 100%),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0px, rgba(255, 255, 255, 0.1) 5px, transparent 5px, transparent 10px);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.1);
    animation: finishPulse 2s infinite alternate;
}

@keyframes finishPulse {
    0% { box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.1); }
    100% { box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.2), 0 0 15px rgba(217, 83, 79, 0.3); }
}

/* Player Animation Enhancements */
.maze-player {
    position: absolute;
    width: 40px;
    height: 40px;
    background-image: url('../images/player.svg');
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 10;
    /* Smooth movement animation */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: center center;
    filter: drop-shadow(0px 3px 5px rgba(0, 0, 0, 0.2));
}

.maze-player.moving {
    animation: playerBounce 0.3s ease;
}

.maze-player.turning-left {
    animation: turnLeft 0.3s ease;
}

.maze-player.turning-right {
    animation: turnRight 0.3s ease;
}

.maze-player.success {
    animation: success 1s ease infinite;
    filter: drop-shadow(0px 0px 8px rgba(92, 184, 92, 0.8));
}

.maze-player.failure {
    animation: failure 0.5s ease;
    filter: drop-shadow(0px 0px 8px rgba(217, 83, 79, 0.8));
}

/* Animation Keyframes */
@keyframes playerBounce {
    0% { transform: scale(1) rotate(var(--rotation)); }
    50% { transform: scale(1.2) rotate(var(--rotation)); }
    100% { transform: scale(1) rotate(var(--rotation)); }
}

@keyframes turnLeft {
    0% { transform: rotate(var(--start-rotation)); }
    100% { transform: rotate(calc(var(--start-rotation) - 90deg)); }
}

@keyframes turnRight {
    0% { transform: rotate(var(--start-rotation)); }
    100% { transform: rotate(calc(var(--start-rotation) + 90deg)); }
}

@keyframes success {
    0% { transform: scale(1) rotate(var(--rotation)); filter: brightness(1); }
    50% { transform: scale(1.2) rotate(var(--rotation)); filter: brightness(1.2); }
    100% { transform: scale(1) rotate(var(--rotation)); filter: brightness(1); }
}

@keyframes failure {
    0%, 100% { transform: rotate(var(--rotation)); }
    20%, 60% { transform: translate(-2px, 0) rotate(var(--rotation)); }
    40%, 80% { transform: translate(2px, 0) rotate(var(--rotation)); }
}

/* Visual feedback effects */
.maze-cell.path-highlight {
    background-color: rgba(66, 133, 244, 0.2);
    animation: pathPulse 1.5s infinite ease-in-out;
}

@keyframes pathPulse {
    0% { background-color: rgba(66, 133, 244, 0.1); }
    50% { background-color: rgba(66, 133, 244, 0.3); }
    100% { background-color: rgba(66, 133, 244, 0.1); }
}

/* Maze completion effects */
.maze-complete {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0);
    pointer-events: none;
    z-index: 20;
    transition: background-color 0.5s ease;
}

.maze-complete.show {
    background-color: rgba(255, 255, 255, 0.7);
    animation: successFlash 1s ease-in-out;
}

@keyframes successFlash {
    0% { background-color: rgba(255, 255, 255, 0); }
    50% { background-color: rgba(255, 255, 255, 0.7); }
    100% { background-color: rgba(255, 255, 255, 0.3); }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .maze-container {
        height: 300px;
    }
} 