﻿body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

#canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    cursor: grab;
}

    #canvas-container.grab,
    #canvas-container[style*="cursor: grab"] {
        cursor: grab;
    }

    #canvas-container.grabbing {
        cursor: grabbing;
    }

    #canvas-container.crosshair {
        cursor: crosshair;
    }

#main-canvas {
    cursor: inherit;
    position: absolute;
    background-color: white;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

#toolbar {
    position: absolute;
    top: 20px;
    left: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 10px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.tool-button {
    width: 40px;
    height: 40px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

    .tool-button:hover {
        border-color: #4CAF50;
        background-color: #f5f5f5;
    }

    .tool-button.active {
        border-color: #4CAF50;
        background-color: #4CAF50;
        color: white;
    }

.panel-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

    .panel-header h3 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
        color: #333;
    }

.add-layer-button {
    width: 30px;
    height: 30px;
    border: 2px solid #4CAF50;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: #4CAF50;
    transition: all 0.2s;
}

    .add-layer-button:hover {
        background: #4CAF50;
        color: white;
    }

.layer-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin: 4px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

    .layer-item:hover {
        background: #f5f5f5;
        border-color: #4CAF50;
    }

    .layer-item.selected {
        background: #e8f5e8;
        border-color: #4CAF50;
    }

.layer-checkbox {
    margin-right: 10px;
    cursor: pointer;
}

.layer-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.layer-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    cursor: text;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

    .layer-name:hover {
        background-color: #f0f0f0;
    }

.layer-name-input {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    border: 1px solid #4CAF50;
    padding: 2px 4px;
    border-radius: 3px;
    background: white;
    font-size: inherit;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

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

.layer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.layer-action-btn {
    width: 24px;
    height: 24px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
}

    .layer-action-btn:hover {
        background: #f0f0f0;
    }

    .layer-action-btn.delete:hover {
        background: #ffebee;
        border-color: #f44336;
        color: #f44336;
    }

.visibility-toggle {
    cursor: pointer;
    font-size: 14px;
    color: #666;
}

    .visibility-toggle.hidden {
        color: #ccc;
    }

#file-input {
    display: none;
}


.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: #666;
    display: none;
}

.grid-icon-show {
    display: block;
}

.grid-icon-hide {
    display: none;
}

input[type="checkbox"]:checked ~ .grid-icon-show {
    display: none;
}

input[type="checkbox"]:checked ~ .grid-icon-hide {
    display: block;
}
/* Layer Properties Panel Styles */
#layer-properties {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    background-color: #f9f9f9;
    display: none;
}

    #layer-properties h3 {
        margin: 0 0 15px 0;
        font-size: 14px;
        font-weight: 600;
        color: #333;
    }

.property-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .property-group label {
        font-size: 13px;
        color: #555;
        min-width: 50px;
    }

    .property-group input[type="color"] {
        width: 50px;
        height: 30px;
        border: 1px solid #ddd;
        border-radius: 4px;
        cursor: pointer;
        background-color: white;
    }

    .property-group input[type="range"] {
        flex: 1;
        height: 5px;
        background: #ddd;
        border-radius: 5px;
        outline: none;
        -webkit-appearance: none;
    }

        .property-group input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 15px;
            height: 15px;
            background: #007bff;
            border-radius: 50%;
            cursor: pointer;
        }

        .property-group input[type="range"]::-moz-range-thumb {
            width: 15px;
            height: 15px;
            background: #007bff;
            border-radius: 50%;
            cursor: pointer;
            border: none;
        }

#layer-width-value {
    font-size: 12px;
    color: #666;
    min-width: 40px;
    text-align: right;
}

/* Update existing layer item styles for better visual feedback */
.layer-item.selected {
    background-color: #e3f2fd;
    border-left: 3px solid #2196f3;
}

.layer-item:hover {
    background-color: #f5f5f5;
}

.layer-item.selected:hover {
    background-color: #e3f2fd;
}

/* Measurement Controls */
.measurement-controls {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    background-color: #f9f9f9;
}

    .measurement-controls h3 {
        margin: 0 0 15px 0;
        font-size: 14px;
        font-weight: 600;
        color: #333;
    }

.measurement-option {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .measurement-option label {
        font-size: 13px;
        color: #555;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .measurement-option input[type="checkbox"] {
        cursor: pointer;
    }

        .measurement-option input[type="checkbox"]:disabled {
            cursor: not-allowed;
        }

    .measurement-option label.disabled {
        color: #aaa;
        cursor: not-allowed;
    }

/* Ratio Info */
#ratio-info {
    margin-top: 15px;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.ratio-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .ratio-details span {
        color: #ff6600;
        font-weight: 500;
    }

.no-ratio {
    color: #999;
    font-style: italic;
}

#clear-ratio-btn {
    font-size: 12px;
    padding: 2px 8px;
}

/* Ratio Dialog Modal */
.ratio-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

    .ratio-dialog .modal-content {
        background-color: white;
        padding: 25px;
        border-radius: 8px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
        max-width: 400px;
        width: 90%;
    }

    .ratio-dialog h3 {
        margin: 0 0 15px 0;
        font-size: 18px;
        color: #333;
    }

    .ratio-dialog p {
        margin: 0 0 20px 0;
        color: #666;
        font-size: 14px;
    }

    .ratio-dialog .form-group {
        margin-bottom: 15px;
    }

/* Add these styles to your CSS file */

/* Info button in layer item */
.layer-action-btn.info {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

    .layer-action-btn.info:hover {
        opacity: 1;
    }

/* Modal animations */
.lines-summary-overlay {
    animation: fadeIn 0.2s ease-out;
}

.lines-summary-modal {
    animation: slideIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Table hover effects */
.lines-summary-modal tbody tr:hover {
    background-color: #f8f8f8;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .lines-summary-modal {
        max-width: 95%;
        margin: 10px;
    }

        .lines-summary-modal h2 {
            font-size: 18px;
        }

        .lines-summary-modal table {
            font-size: 14px;
        }
}

/* Add these styles to your CSS file */

/* Layer item drag styles */
.layer-item {
    cursor: move;
    transition: transform 0.2s, opacity 0.2s;
    user-select: none;
}

    /* Prevent drag cursor on interactive elements */
    .layer-item input,
    .layer-item button,
    .layer-item .layer-name,
    .layer-item .layer-action-btn {
        cursor: auto;
    }

    /* Dragging state */
    .layer-item.dragging {
        opacity: 0.5;
        transform: scale(0.95);
        cursor: grabbing;
    }

    /* Hover effect when not dragging */
    .layer-item:not(.dragging):hover {
        background-color: rgba(0, 0, 0, 0.02);
    }

/* Drop indicator line */
.drop-indicator {
    display: block;
    width: 100%;
    pointer-events: none;
}

/* Visual feedback during drag over */
.layer-list {
    position: relative;
}

/* Ensure layer list has proper spacing */
#layer-list {
    min-height: 50px;
    padding: 4px 0;
}

    /* Empty state for layer list */
    #layer-list:empty::after {
        content: "No layers";
        display: block;
        text-align: center;
        color: #999;
        padding: 20px;
        font-style: italic;
    }

/* Disable text selection during drag */
.layer-item[draggable="true"] {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Ensure proper cursor during drag */
body.dragging * {
    cursor: grabbing !important;
}

/* Smooth transitions for reordering */
.layer-item:not(.dragging) {
    transition: transform 0.2s;
}