/* ========== JUNKPILE GAME ========== */

.junkpile-game {
    position: relative;
    width: 100%;
}

.game-hud {
    display: flex;
    justify-content: space-around;
    padding: 20px;
    background: var(--oil-black);
    border: 2px solid var(--rust-orange);
    margin-bottom: 20px;
}

.hud-stat {
    text-align: center;
}

.hud-label {
    display: block;
    color: #888;
    font-size: 0.9em;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.hud-value {
    display: block;
    font-family: 'Rajdhani', sans-serif;
    font-size: 2em;
    color: var(--warning-yellow);
    font-weight: bold;
}

.game-container {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 20px;
}

.game-area {
    position: relative;
    width: 1024px;
    height: 650px;
    overflow: hidden;
    border: 3px solid var(--rust-orange);
    background: #2D2D30;
    margin: 0 auto;
}

.game-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* ========== POSITIONING CONTROLS ========== */
/* Adjust these values to position elements */

/* Conveyor Belt Position */
.conveyor-belt {
    position: absolute !important;
    bottom: -100px !important;  /* ← ADJUST: Vertical position (negative = up) */
    left: -12px !important;      /* ← ADJUST: Horizontal position from left */
    width: 550px;               /* 🔒 LOCKED SIZE - DO NOT CHANGE */
    height: auto;
    z-index: 2;
}

/* Bin Container Position */
.bin-container {
    position: absolute;
    right: 30px;     /* ← ADJUST: Distance from right edge */
    bottom: 0;        /* ← ADJUST: Distance from bottom */
    display: flex;
    align-items: flex-end;  /* Align all bins at bottom */
    gap: 20px;        /* ← ADJUST: Space between bins */
    z-index: 3;
}

.sorting-bin {
    position: relative;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto; /* Ensure bins are clickable */
}

.sorting-bin img {
    cursor: pointer;
    pointer-events: auto; /* Ensure bin images are clickable */
}

/* ========== INDIVIDUAL BIN ADJUSTMENTS ========== */
/* Fine-tune each bin's vertical position */
/* Positive values = move DOWN, Negative values = move UP */

#bin-trash {
    transform: translateY(0px);  /* ← ADJUST: Trash bin vertical offset */
}

#bin-recycle {
    transform: translateY(0px);  /* ← ADJUST: Paper bin vertical offset */
}

#bin-metal {
    transform: translateY(0px); /* ← ADJUST: Metal bin vertical offset */
}

#bin-plastic {
    transform: translateY(0px);  /* ← ADJUST: Plastic bin vertical offset */
    margin-left: -10px;  /* ← ADJUST: Extra space between metal and plastic bin */
}

/* Make plastic bin image 40% bigger */
#bin-plastic img {
    width: 126px;  /* 90px * 1.4 = 126px */
}

/* Plastic bin counter positioned higher to clear bigger bin */
#bin-plastic .bin-counter {
    top: -53px;  /* Higher to clear the bigger bin */
}

/* Individual counter adjustments for trash and metal bins */
#bin-trash .bin-counter {
    top: -40px;  /* ← ADJUST: Distance above trash bin image */
}

#bin-metal .bin-counter {
    top: -51px;  /* ← ADJUST: Distance above metal bin image */
}

.sorting-bin:hover {
    transform: scale(1.05);
}

.sorting-bin img {
    width: 90px;
    height: auto;
    display: block;
}

.sorting-bin.full {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.bin-counter {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.3em;
    font-weight: bold;
    color: var(--warning-yellow);
    background: rgba(0,0,0,0.8);
    padding: 5px 12px;
    border-radius: 5px;
    border: 2px solid var(--rust-orange);
    white-space: nowrap;
    z-index: 10;
}

.sorting-bin.full .bin-counter {
    background: rgba(184,92,63,0.9);
    border-color: var(--warning-yellow);
}

.bin-label {
    font-family: 'Rajdhani', sans-serif;
    font-weight: bold;
    font-size: 0.85em;
    color: var(--warning-yellow);
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.empty-progress {
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 0%;
    height: 6px;
    background: linear-gradient(90deg, var(--success-green), #9ACD32);
    border-radius: 3px;
    display: none;
    transition: width 0.05s linear;
}

/* Items container */
#items-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none; /* Don't block clicks! */
}

/* Individual items - LOCKED SIZE */
.conveyor-item {
    position: absolute;
    cursor: pointer;
    z-index: 10;
    pointer-events: none; /* Default: not clickable */
    transition: left 0.6s ease-out, opacity 0.3s ease-in;
}

/* Disable transition while dragging so item follows cursor */
.conveyor-item.dragging {
    transition: none !important;
    cursor: grabbing;
    z-index: 20;
    transform: scale(1.2) rotate(5deg);
    pointer-events: auto;
}

.conveyor-item.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.conveyor-item.pickable {
    pointer-events: auto;
    cursor: grab;
    animation: bounce 0.5s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.conveyor-item.pickable:hover {
    transform: scale(1.15);
    animation: none;
}

.conveyor-item img {
    width: 50px;
    height: auto;
    display: block;
    pointer-events: none;
    filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.5));
}

/* Feedback */
.feedback-popup {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Rajdhani', sans-serif;
    font-size: 4em;
    font-weight: bold;
    z-index: 600;
    animation: feedbackPop 1s ease-out forwards;
    pointer-events: none;
}

.feedback-popup.success {
    color: #9ACD32;
    text-shadow: 3px 3px 0 #000;
}

.feedback-popup.error {
    color: #FF6347;
    text-shadow: 3px 3px 0 #000;
}

@keyframes feedbackPop {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translateX(-50%) scale(1.2);
    }
    80% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) scale(0.8);
    }
}

#feedback-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 499;
}

.center-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Rajdhani', sans-serif;
    font-size: 3em;
    font-weight: bold;
    padding: 30px 60px;
    border-radius: 10px;
    z-index: 500;
    animation: centerMessageFade 2s ease-out forwards;
    pointer-events: none;
}

.center-message.success {
    color: #9ACD32;
    background: rgba(107,142,35,0.9);
    border: 3px solid #9ACD32;
    text-shadow: 2px 2px 0 #000;
}

.center-message.error {
    color: #FF6347;
    background: rgba(184,46,46,0.9);
    border: 3px solid #FF6347;
    text-shadow: 2px 2px 0 #000;
}

.center-message.warning {
    color: var(--warning-yellow);
    background: rgba(184,92,63,0.9);
    border: 3px solid var(--warning-yellow);
    text-shadow: 2px 2px 0 #000;
}

@keyframes centerMessageFade {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

.game-info {
    background: var(--oil-black);
    border: 2px solid var(--rust-orange);
    padding: 20px;
}

.game-info h3 {
    font-family: 'Rajdhani', sans-serif;
    color: var(--warning-yellow);
    font-size: 1.5em;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.game-info ul {
    list-style: none;
    padding: 0;
}

.game-info li {
    margin-bottom: 10px;
    padding-left: 5px;
    line-height: 1.5;
}

.game-controls {
    margin-top: 20px;
    text-align: center;
}
