.template-wrapper {
    display: flex;
    gap: 20px;
    margin: 20px;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.template-visual {
    flex: 3; /* Changed from 1 to 3 to take up 75% of the space */
    min-width: 0;
    overflow-x: auto; /* Enable horizontal scrolling */
    padding-bottom: 20px; /* Space for the scrollbar */
}

.template-json {
    flex: 1; /* Keeps 1 to take up 25% of the space */
    min-width: 250px; /* Reduced from 300px */
    padding: 20px;
    background: #f8f8f8;
    border-left: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 25%; /* Set fixed width ratio */
    max-width: 400px; /* Prevent JSON section from getting too wide */
    flex-shrink: 0; /* Prevent JSON section from shrinking */
}

.json-editor {
    width: 100%;
    height: calc(100vh - 250px); /* Adjusted to make room for save button */
    font-family: monospace;
    font-size: 14px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: none;
    white-space: pre;
    overflow: auto;
}

.save-json-btn {
    padding: 10px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.save-json-btn:hover {
    background-color: #45a049;
}

.save-json-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.locker-grid {
    display: grid;
    gap: 4px;
    padding: 10px;
    background: #f5f5f5;
    width: fit-content;
    margin: 20px 0;
    min-width: fit-content; /* Ensure grid doesn't shrink below content size */
}

.locker {
    width: 100%; /* Change from fixed width to 100% */
    padding: 8px;
    border: 1px solid #333;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: move; /* Show move cursor */
    user-select: none; /* Prevent text selection while dragging */
    position: relative;
    white-space: pre-line; /* Preserve line breaks in tooltip */
    box-sizing: border-box;
}

/* Add background colors for locker types */
.locker.type-S { 
    background-color: #e3f2fd;
    border-color: #90caf9;
}

.locker.type-M { 
    background-color: #bbdefb;
    border-color: #64b5f6;
}

.locker.type-L { 
    background-color: #90caf9;
    border-color: #42a5f5;
}

.locker.type-XL { 
    background-color: #64b5f6;
    border-color: #2196f3;
}

/* Add hover effect for better visibility */
.locker:hover {
    box-shadow: 0 0 8px rgba(33, 150, 243, 0.5);
    border-width: 2px;
}

/* Additional style for inactive lockers */
.locker[title*="Status: Inactive"] {
    opacity: 0.7;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(0, 0, 0, 0.05) 10px,
        rgba(0, 0, 0, 0.05) 20px
    );
}

/* Style for maintenance lockers */
.locker[title*="Maintenance: Yes"] {
    border-style: dashed;
    border-width: 2px;
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 10px,
        rgba(255, 152, 0, 0.1) 10px,
        rgba(255, 152, 0, 0.1) 20px
    );
}

.locker:hover {
    box-shadow: 0 0 8px rgba(33, 150, 243, 0.5);
    border-width: 2px;
}

.locker.dragging {
    opacity: 0.5;
    border: 2px dashed #666;
    cursor: grabbing;
}

.locker.drag-over {
    border: 2px dashed #0066cc;
    background-color: rgba(0, 102, 204, 0.1);
}

.locker-number {
    font-weight: bold;
    font-size: 14px;
}

.locker-type {
    font-size: 12px;
    opacity: 0.8;
}

.legend {
    margin: 20px 0;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    display: flex;
    gap: 20px;
}

.legend-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: monospace; /* Makes dimensions more readable */
    min-width: 200px; /* Ensures enough space for dimensions */
}

.legend-swatch {
    min-width: 30px;
    min-height: 30px;
    border: 1px solid #333;
    flex-shrink: 0; /* Prevents swatch from shrinking */
}

/* Add legend color swatches for each type */
.legend-swatch.type-S { background-color: #e3f2fd; }
.legend-swatch.type-M { background-color: #bbdefb; }
.legend-swatch.type-L { background-color: #90caf9; }
.legend-swatch.type-XL { background-color: #64b5f6; }

/* Update modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    overflow-y: auto; /* Enable scrolling */
}

.modal-content {
    background-color: #fefefe;
    margin: 20px auto; /* Changed from 15% to 20px for better mobile support */
    padding: 20px;
    border: 1px solid #888;
    width: 90%; /* More responsive width */
    max-width: 500px;
    border-radius: 4px;
    position: relative; /* For absolute positioning of close button */
    max-height: 90vh; /* Maximum height */
    overflow-y: auto; /* Enable scrolling if content is too long */
}

.close {
    position: absolute;
    right: 10px;
    top: 10px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

/* Improve form layout */
.form-group {
    margin-bottom: 15px;
    width: 100%;
}

.form-group label {
    display: inline-block;
    margin-bottom: 5px;
    font-weight: bold;
    width: 100%;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box; /* Include padding in width calculation */
}

/* Add some spacing at the bottom of the form */
#lockerEditForm {
    padding-bottom: 20px;
}

/* Make submit button full width */
button[type="submit"] {
    width: 100%;
    margin-top: 10px;
}

button[type="submit"]:hover {
    background-color: #45a049;
}

.locker-cell {
    min-width: 100px;
    min-height: 100px;
    border: 1px dashed #ccc;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.locker-cell.drag-over {
    border: 2px dashed #666;
    background-color: rgba(0, 0, 0, 0.1);
}

.locker-split {
    flex: 1;
    width: auto; /* Override the fixed width */
    min-width: 0; /* Allow shrinking */
}

.upload-section {
    margin: 20px;
    padding: 20px;
    background: #f8f8f8;
    border-radius: 4px;
    border: 1px solid #ddd;
    display: flex;
    gap: 10px;
    align-items: center;
}

#selectFileInput {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
}

#loadBtn,
#downloadBtn {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.2s;
}

#downloadBtn {
    background-color: #2196F3;
}

#loadBtn:hover {
    background-color: #45a049;
}

#downloadBtn:hover {
    background-color: #1976D2;
}

#loadBtn:disabled,
#downloadBtn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}
