/* Balance Scale Styles */
.balance-scale {
    position: relative;
    width: 600px;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    margin-top: 50px;
}

.scale-base {
    width: 20px;
    height: 200px;
    background: #64748b;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 10px 10px 0 0;
    z-index: 1;
}

.scale-base::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 20px;
    background: #475569;
    border-radius: 10px;
}

.scale-beam {
    width: 500px;
    height: 10px;
    background: #94a3b8;
    position: absolute;
    top: 100px;
    left: 50%;
    margin-left: -250px;
    border-radius: 5px;
    transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 2;
}

.scale-beam::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: #cbd5e1;
    border-radius: 50%;
    border: 4px solid #64748b;
}

.scale-pan {
    width: 140px;
    height: 100px;
    /* Height of the string */
    position: absolute;
    top: 5px;
    /* Hang from beam */
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.scale-pan:hover {
    transform: scale(1.05);
}

.scale-pan-left {
    left: 0;
    transform-origin: top center;
}

.scale-pan-right {
    right: 0;
    transform-origin: top center;
}

.pan-string-left,
.pan-string-right {
    width: 2px;
    height: 80px;
    background: #cbd5e1;
    position: absolute;
    top: 0;
}

.pan-string-left {
    left: 20px;
    transform: rotate(15deg);
    transform-origin: top left;
}

.pan-string-right {
    right: 20px;
    transform: rotate(-15deg);
    transform-origin: top right;
}

.pan-plate {
    width: 140px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 0 0 70px 70px;
    position: absolute;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.pan-content {
    position: absolute;
    bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    flex-wrap: wrap;
    width: 100px;
    gap: 2px;
}

/* Weight Items */
.weight-item {
    width: 30px;
    height: 30px;
    background: #eab308;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
}

.weight-item.heavy-item {
    background: #ef4444;
}

.weight-item.light-item {
    background: #3b82f6;
    border-radius: 50%;
}

/* Tilt States */
.tilt-left {
    transform: rotate(-15deg);
}

.tilt-right {
    transform: rotate(15deg);
}

/* Keep pans vertical when beam tilts */
.tilt-left .scale-pan-left {
    transform: rotate(15deg);
}

.tilt-left .scale-pan-right {
    transform: rotate(15deg);
}

.tilt-right .scale-pan-left {
    transform: rotate(-15deg);
}

.tilt-right .scale-pan-right {
    transform: rotate(-15deg);
}

/* Mobile Scale */
@media (max-width: 768px) {
    .balance-scale {
        width: 320px;
        height: 250px;
        margin-top: 20px;
    }

    .scale-beam {
        width: 280px;
        margin-left: -140px;
    }

    .scale-pan {
        width: 100px;
    }

    .pan-plate {
        width: 100px;
        height: 30px;
    }

    .weight-item {
        width: 20px;
        height: 20px;
    }
}