.calculator-container {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: auto; /* Make container fit to content */
}

/* New wrapper divs for desktop layout */
.calc-form-wrapper {
    width: 100%;
}

.calc-field {
    margin-bottom: 15px;
    position: relative; /* Ensure dropdowns respect container boundaries */
}

.calc-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.calc-field select,
.calc-field input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.calc-field input:focus,
.calc-field select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

button#calc-calculate,
button#calculate-weight,
button#add-item {
    width: 100%;
    padding: 12px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    margin: 20px 0;
}

button#calc-calculate:hover,
button#calculate-weight:hover,
button#add-item:hover {
    background: #135e96;
}

#calc-results,
#weight-results {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.fees-section,
.weight-result-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.fees-section h3,
.weight-result-section h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.fee-row,
.weight-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 15px;
}

.fee-row.total,
.weight-row.total {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
    font-weight: 600;
}

.fee-explanation,
.weight-explanation {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

#calc-fee-payer {
    margin-bottom: 20px;
    padding: 10px;
    background: #e7f5ff;
    border-radius: 4px;
    text-align: center;
    color: #0066cc;
    font-weight: 600;
}

.final-earnings,
.final-weight {
    background: #e8f5e9;
}

.currency-symbol {
    margin-right: 2px;
}

/* Weight Calculator Specific Styles */
#item-list {
    margin-top: 15px;
}

/* Result item styling */
.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.result-item span {
    flex: 1;
    font-size: 14px;
}

.result-item .item-weight {
    text-align: right;
    margin-right: 10px;
    font-weight: bold;
}

.result-item .remove-item {
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 18px;
    cursor: pointer;
    padding: 0 5px;
}

.result-item .remove-item:hover {
    color: #ff0000;
}

/* Item list container */
#item-list {
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
}

/* Total weight styling */
.weight-result-section.final-weight {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.weight-row.total {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
}

#clear-items {
    display: block;
    width: 100%;
    margin-top: 20px;
}

/* Multi-item calculator specific styles */
.multi-item-controls {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.multi-item-controls .calc-field {
    flex: 1 0 auto;
    min-width: 110px; /* Ensure dropdowns are wide enough to read text */
}

/* Ensure the select elements are wide enough */
.multi-item-controls select {
    width: 100%;
    min-width: 110px;
}

/* Style for the Add Item button */
.multi-item-controls button#add-item {
    flex: 0 0 auto;
    min-width: 120px;
    height: 40px;
    margin-top: auto; /* Align with other inputs */
}

/* Fix for media queries */
@media screen and (max-width: 767px) {
    .multi-item-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .multi-item-controls .calc-field {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .multi-item-controls button#add-item {
        width: 100%;
        margin-top: 5px;
    }
}

/* Desktop Layout Media Query - 768px and above */
@media screen and (min-width: 768px) {
    .calculator-container {
        max-width: none;
        width: fit-content;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: flex-start;
        position: relative;
    }
    
    .calc-form-wrapper {
        width: 500px;
        max-width: 100%;
        transition: transform 0.3s ease;
        margin: 0 auto;
    }
    
    #calc-results, #weight-results {
        width: 500px;
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        position: absolute;
        right: -550px;
        top: 0;
        opacity: 0;
        transition: transform 0.3s ease, opacity 0.3s ease;
        display: none;
    }

    /* State when results are being shown */
    .calculator-container.showing-results {
        justify-content: center;
        /* Reduced gap in the middle */
        column-gap: 30px;
    }
    
    .calculator-container.showing-results .calc-form-wrapper {
        transform: none;
        width: 400px; /* Reduced width */
        flex: 0 0 400px;
        margin: 0;
        padding-right: 0;
        min-width: auto;
    }
    
    .calculator-container.showing-results #calc-results,
    .calculator-container.showing-results #weight-results {
        display: block;
        position: relative;
        right: auto;
        transform: translateX(0);
        opacity: 1;
        flex: 0 0 400px; /* Reduced width */
        width: 400px;
        margin-left: 0;
        padding-left: 0;
        min-width: auto;
        border-left: 0;
    }
    
    /* Add a vertical line for better separation - centered in the gap but not touching top/bottom */
    .calculator-container.showing-results::after {
        content: "";
        position: absolute;
        left: 50%;
        top: 20px; /* Moved down from top */
        height: calc(100% - 40px); /* Shorter by 40px (20px from top + 20px from bottom) */
        width: 1px;
        background-color: #ddd;
        transform: translateX(-50%);
    }
    
    /* Fix for dropdown menus */
    .calculator-container.showing-results .calc-field select {
        position: relative;
        z-index: 10;
    }
    
    button#calc-calculate,
    button#calculate-weight,
    button#add-item {
        margin-bottom: 0;
    }
    
    /* Enhanced styles for multi-item controls in desktop view */
    .multi-item-controls {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
    }
    
    .multi-item-controls .calc-field {
        flex: 1 1 110px;
        margin-right: 10px;
    }
    
    .multi-item-controls button#add-item {
        flex: 0 0 auto;
        min-width: 120px;
    }
}
