@tailwind base;
@tailwind components;
@tailwind utilities;

.font-fredoka {
    font-family: 'Fredoka', sans-serif;
}

/* Custom Animations */
@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    80% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.animate-pop {
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* 2D Shapes Types */
.shape-2d {
    width: 80px;
    height: 80px;
    transition: transform 0.2s, filter 0.2s;
    filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.2));
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shape-2d:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.shape-square {
    background-color: #ef4444;
    /* red-500 */
    border-radius: 12px;
}

.shape-circle {
    background-color: #3b82f6;
    /* blue-500 */
    border-radius: 50%;
}

.shape-rectangle {
    width: 100px;
    height: 60px;
    background-color: #22c55e;
    /* green-500 */
    border-radius: 8px;
}

.shape-triangle {
    width: 0;
    height: 0;
    background-color: transparent;
    border-left: 45px solid transparent;
    border-right: 45px solid transparent;
    border-bottom: 80px solid #eab308;
    /* yellow-500 */
    filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.2));
}

/* Triangle needs specific centering logic or wrapper */

.shape-pentagon {
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    background-color: #a855f7;
    /* purple-500 */
    width: 85px;
    height: 85px;
}

.shape-hexagon {
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background-color: #ec4899;
    /* pink-500 */
    width: 90px;
    height: 80px;
}

/* 3D Shapes (Improved Isometric) */
.shape-3d {
    width: 60px;
    height: 60px;
    transition: transform 0.2s;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    /* Ensure z-index is handled for pseudo elements */
    transform-style: preserve-3d;
}

.shape-3d:active {
    cursor: grabbing;
    transform: scale(1.1);
}

/* Sphere: Enhanced Gradient */
.shape-sphere {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #60a5fa, #2563eb, #1e3a8a);
    /* lighter -> norm -> dark */
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.3), inset -5px -5px 10px rgba(0, 0, 0, 0.3);
}

/* Cube: Isometric construction */
.shape-cube {
    width: 40px;
    /* Base width */
    height: 40px;
    /* Base height */
    background-color: #ef4444;
    /* Front Face (Red-500) */
    position: relative;
    margin-top: 10px;
    /* push down to make room for top */
    margin-left: 0;
    transform: rotate(-5deg);
    /* Slight tilt for flavor, removal keeps it strict iso */
    box-shadow: none;
    /* Reset old */
}

/* Top Face */
.shape-cube::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 10px;
    /* skewed offset */
    width: 40px;
    height: 20px;
    background-color: #fca5a5;
    /* Top (Light Red-300) */
    transform: skewX(-45deg);
    transform-origin: bottom left;
}

/* Side Face */
.shape-cube::after {
    content: '';
    position: absolute;
    top: -10px;
    /* aligns with skewed top */
    right: -20px;
    width: 20px;
    height: 40px;
    background-color: #b91c1c;
    /* Side (Dark Red-700) */
    transform: skewY(-45deg);
    transform-origin: top left;
}

/* Cylinder */
.shape-cylinder {
    width: 40px;
    height: 50px;
    background: linear-gradient(to right, #16a34a 0%, #4ade80 40%, #166534 100%);
    /* Green cylinder body */
    position: relative;
    margin-top: 10px;
    border-radius: 0;
}

/* Top Oval */
.shape-cylinder::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    width: 40px;
    height: 20px;
    border-radius: 50%;
    background-color: #86efac;
    /* Top (Light Green-300) */
    border: 1px solid #16a34a;
    /* slightly darker rim */
    z-index: 2;
}

/* Bottom Oval (Curved base) */
.shape-cylinder::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 40px;
    height: 20px;
    border-radius: 50%;
    background-color: #166534;
    /* Matching dark edge of gradient */
    z-index: 0;
}

/* Cone */
.shape-cone {
    width: 60px;
    height: 60px;
    position: relative;
    background: transparent;
    display: flex;
    justify-content: center;
}

.shape-cone::before {
    /* The Triangle Body */
    content: '';
    position: absolute;
    top: 0;
    width: 50px;
    height: 60px;
    background: linear-gradient(105deg, #ca8a04 0%, #eab308 50%, #fef08a 100%);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    z-index: 2;
}

.shape-cone::after {
    /* The Curved Base */
    content: '';
    position: absolute;
    top: 50px;
    /* aligns with bottom of clip-path */
    width: 50px;
    height: 16px;
    background-color: #a16207;
    /* Darker yellow base */
    border-radius: 50%;
    z-index: 1;
}

/* Pyramid: 2-Face tent */
.shape-pyramid {
    width: 60px;
    height: 60px;
    position: relative;
    background: transparent;
    display: flex;
    justify-content: center;
}

/* Left Face */
.shape-pyramid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 60px;
    background: #7e22ce;
    /* Dark side */
    /* Tip(100,0) -> BottomLeft(0,90) -> BottomCenter(100,100) */
    clip-path: polygon(100% 0%, 0% 85%, 100% 100%);
}

/* Right Face */
.shape-pyramid::after {
    content: '';
    position: absolute;
    top: 0;
    left: 30px;
    width: 30px;
    height: 60px;
    background: #d8b4fe;
    /* Light side */
    /* Tip(0,0) -> BottomCenter(0,100) -> BottomRight(100,90) */
    clip-path: polygon(0% 0%, 0% 100%, 100% 85%);
}

/* Bin Styles */
.bin {
    height: 200px;
    /* rounded-2xl */
    border-width: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 1rem;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.bin-top {
    width: 80%;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 100%;
    margin-bottom: 1rem;
}

.bin:hover {
    transform: translateY(-5px);
}

.bin.highlight {
    background-color: #f0fdf4;
    /* green-50 */
    border-color: #4ade80;
    /* green-400 */
    transform: scale(1.05);
}

.bin-label {
    font-size: 1.5rem;
    font-weight: 700;
    color: #475569;
    /* slate-600 */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    pointer-events: none;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}