/* Label Editor Styles */
.label-editor-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: Arial, sans-serif;
}

.label-editor-main {
    display: table;
    width: 100%;
    border-spacing: 30px 0;
}

.canvas-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    position: relative;
    display: table-cell;
    vertical-align: top;
    width: auto;
    /* Canvas determines size, container just provides padding and background */
}

.canvas-container canvas {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 4px;
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

.editor-sidebar {
    background: #ffffff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: fit-content;
    width: 250px;
    display: table-cell;
    vertical-align: top;
}

.sidebar-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
    border-bottom: 2px solid #007cba;
    padding-bottom: 5px;
}

.label-templates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.template-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    font-size: 12px;
    transition: all 0.2s;
}

.template-btn:hover {
    background: #e9ecef;
    border-color: #007cba;
}

.template-btn.active {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

.control-group {
    margin-bottom: 12px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.control-group input,
.control-group select,
.control-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.control-group input[type="range"] {
    margin: 5px 0;
}

.control-group input[type="color"] {
    width: 50px;
    height: 30px;
    padding: 0;
    border: none;
    cursor: pointer;
}

.control-group textarea {
    resize: vertical;
    min-height: 60px;
}

.control-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.control-row input {
    flex: 1;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.btn-primary {
    background: #007cba;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    width: 100%;
    margin-bottom: 10px;
}

.btn-primary:hover {
    background: #005a87;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    width: 100%;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    width: 100%;
}

.btn-danger:hover {
    background: #c82333;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.action-buttons button {
    flex: 1;
    min-width: 120px;
}

.layer-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.layer-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.layer-item:hover {
    background: #f8f9fa;
}

.layer-item.selected {
    background: #e3f2fd;
    border-left: 3px solid #007cba;
}

.layer-item:last-child {
    border-bottom: none;
}

.layer-info {
    flex: 1;
}

.layer-name {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.layer-type {
    color: #666;
    font-size: 12px;
}

.layer-actions {
    display: flex;
    gap: 5px;
}

.layer-actions button {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 3px;
    cursor: pointer;
}

.layer-actions button:hover {
    background: #f8f9fa;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #666;
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: #28a745;
    color: white;
    border-radius: 4px;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.toast.error {
    background: #dc3545;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .label-editor-main {
        display: block;
        border-spacing: 0;
    }
    
    .canvas-container {
        display: block;
        width: 100%;
        margin-bottom: 20px;
        padding: 15px;
    }
    
    .canvas-container canvas {
        max-width: 100%;
        max-height: 50vh;
    }
    
    .editor-sidebar {
        display: block;
        width: 100%;
        max-width: none;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons button {
        width: 100%;
    }
}