/* Reset and base styles */
* { 
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f6fa;
    color: #2c3e50;
    overflow: hidden;
}

/* App Container */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.app-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.header-right {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-secondary:hover {
    background-color: rgba(255,255,255,0.3);
}

/* Screen Tabs */
.screen-tabs {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e1e8ed;
    padding: 0 20px;
}

.screen-tabs-container {
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    overflow-x: auto;
}

.screen-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    transition: all 0.2s ease;
    min-width: 120px;
    max-width: 200px;
}

.screen-tab:hover {
    background-color: #dee2e6;
}

.screen-tab.active {
    background-color: white;
    color: #212529;
    border-bottom: 1px solid white;
    margin-bottom: -1px;
}

.screen-tab-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.screen-tab-edit,
.screen-tab-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 12px;
    color: #6c757d;
    opacity: 0;
    transition: all 0.2s ease;
}

.screen-tab:hover .screen-tab-edit,
.screen-tab:hover .screen-tab-close {
    opacity: 1;
}

.screen-tab-edit:hover,
.screen-tab-close:hover {
    background-color: rgba(0,0,0,0.1);
    color: #495057;
}

.screen-tab-close:hover {
    background-color: #dc3545;
    color: white;
}

.screen-tab-add {
    background: none;
    border: 1px dashed #ced4da;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #6c757d;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.screen-tab-add:hover {
    border-color: #3498db;
    color: #3498db;
    background-color: rgba(52, 152, 219, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Panels */
.toolbox-panel,
.properties-panel {
    width: 280px;
    min-width: 280px; /* Prevent panels from shrinking */
    max-width: 280px; /* Prevent panels from growing */
    background-color: white;
    border-right: 1px solid #e1e8ed;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
    flex-shrink: 0; /* Prevent panels from being compressed */
}

.properties-panel {
    border-right: none;
    border-left: 1px solid #e1e8ed;
}

.panel-title {
    padding: 20px;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #e1e8ed;
    background-color: #f8f9fa;
    color: #495057;
}

/* Toolbox */
.toolbox-items {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toolbox-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.toolbox-item:hover {
    background-color: #e9ecef;
    border-color: #3498db;
    transform: translateY(-1px);
}

.toolbox-item:active {
    cursor: grabbing;
}

.toolbox-icon {
    font-size: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    border-radius: 6px;
}

.toolbox-label {
    font-weight: 500;
    color: #495057;
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #777777;
    min-width: 0; /* Allow flex shrinking */
    overflow: hidden; /* Prevent layout overflow */
}

.canvas-header {
    padding: 16px 20px;
    background-color: white;
    border-bottom: 1px solid #e1e8ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.canvas-header h3 {
    margin: 0;
    font-weight: 600;
    color: #495057;
}

.canvas-controls {
    display: flex;
    gap: 20px;
    align-items: center;
}

.canvas-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #6c757d;
}

.canvas-controls select,
.canvas-controls input[type="checkbox"] {
    margin: 0;
}

.canvas-controls input[type="color"] {
    width: 40px;
    height: 24px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    background: none;
    padding: 0;
}

#backgroundImageControls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: 8px;
}

#backgroundImageControls .btn {
    padding: 2px 6px;
    font-size: 12px;
    min-height: 24px;
}

#backgroundImageControls select {
    font-size: 12px;
    padding: 2px 4px;
    border: 1px solid #ced4da;
    border-radius: 3px;
}

#customResolution {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

#customResolution label {
    margin: 0;
    font-size: 12px;
}

#customResolution input[type="number"] {
    width: 80px;
    padding: 4px 6px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 12px;
}

.canvas-container {
    flex: 1;
    overflow: auto;
    padding: 20px;
    position: relative;
    background: #f8f9fa;
    min-width: 0; /* Allow flex shrinking */
    display: flex;
    justify-content: center;
    align-items: center;
}

.canvas {
    width: 1920px;
    height: 1080px;
    background-color: rgb(117, 117, 117);
    position: relative;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
    overflow: hidden;
    transition: all 0.3s ease;
    flex-shrink: 0; /* Prevent canvas from shrinking */
}

.canvas.show-grid {
    background-image: 
        linear-gradient(to right, #f1f3f4 1px, transparent 1px),
        linear-gradient(to bottom, #f1f3f4 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Anchor points indicators */
.canvas.show-anchors::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background-image: 
        /* Top anchors */
        radial-gradient(circle at 0% 0%, #3498db 2px, transparent 2px),
        radial-gradient(circle at 50% 0%, #3498db 2px, transparent 2px),
        radial-gradient(circle at 100% 0%, #3498db 2px, transparent 2px),
        /* Center anchors */
        radial-gradient(circle at 0% 50%, #3498db 2px, transparent 2px),
        radial-gradient(circle at 50% 50%, #e74c3c 3px, transparent 3px),
        radial-gradient(circle at 100% 50%, #3498db 2px, transparent 2px),
        /* Bottom anchors */
        radial-gradient(circle at 0% 100%, #3498db 2px, transparent 2px),
        radial-gradient(circle at 50% 100%, #3498db 2px, transparent 2px),
        radial-gradient(circle at 100% 100%, #3498db 2px, transparent 2px);
    background-repeat: no-repeat;
}

/* UI Elements on Canvas */
.ui-element {
    position: absolute;
    border: 2px solid transparent;
    cursor: move;
    user-select: none;
    transition: all 0.1s ease;
}

.ui-element:hover {
    border-color: #74b9ff;
}

.ui-element.selected {
    border-color: #0984e3;
    box-shadow: 0 0 0 1px #0984e3;
}

/* Multi-selection styling - slightly different to indicate group selection */
.ui-element.selected.multi-selected {
    border-color: #6c5ce7;
    box-shadow: 0 0 0 1px #6c5ce7, 0 0 0 3px rgba(108, 92, 231, 0.2);
}

.ui-element .resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #0984e3;
    border: 1px solid white;
    border-radius: 2px;
}

.ui-element .resize-handle.nw { top: -4px; left: -4px; cursor: nw-resize; }
.ui-element .resize-handle.ne { top: -4px; right: -4px; cursor: ne-resize; }
.ui-element .resize-handle.sw { bottom: -4px; left: -4px; cursor: sw-resize; }
.ui-element .resize-handle.se { bottom: -4px; right: -4px; cursor: se-resize; }
.ui-element .resize-handle.n { top: -4px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.ui-element .resize-handle.s { bottom: -4px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.ui-element .resize-handle.w { top: 50%; left: -4px; transform: translateY(-50%); cursor: w-resize; }
.ui-element .resize-handle.e { top: 50%; right: -4px; transform: translateY(-50%); cursor: e-resize; }

/* UI Text Element */
.ui-text {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(52, 152, 219, 0.1);
    border-radius: 4px;
    padding: 8px;
    min-width: 100px;
    min-height: 40px;
    font-family: inherit;
}

.ui-text-content {
    pointer-events: none;
    color: #2c3e50;
    font-weight: 500;
}

/* UI Button Element */
.ui-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(52, 152, 219, 0.1);
    border-radius: 4px;
    padding: 5px;
    min-width: 100px;
    min-height: 40px;
    font-family: inherit;
}

.ui-button-content {
    pointer-events: none;
    color: white;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* UI Container Element */
.ui-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(155, 89, 182, 0.1); /* Purple tint for containers */
    border-radius: 4px;
    padding: 8px;
    min-width: 150px;
    min-height: 100px;
    font-family: inherit;
}

.ui-container-content {
    pointer-events: none;
    color: #8e44ad;
    font-weight: 500;
    font-size: 12px;
    opacity: 0.8;
}

/* UI Gadget Image Element */
.ui-gadgetimage {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(40, 167, 69, 0.1); /* Green tint for gadgets */
    border: 2px solid rgba(40, 167, 69, 0.3);
    border-radius: 6px;
    padding: 4px;
    min-width: 64px;
    min-height: 64px;
    font-family: inherit;
}

.ui-gadget-content {
    pointer-events: none;
    color: #28a745;
    font-weight: 500;
    font-size: 11px;
    text-align: center;
    word-break: break-all;
}

/* Gadget with invalid parent */
.ui-gadgetimage.invalid-parent {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

.ui-gadgetimage.invalid-parent .ui-gadget-content {
    color: #dc3545;
}

.ui-gadgetimage.invalid-parent::after {
    content: '⚠️ Requires Parent Widget';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    background: #dc3545;
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    text-align: center;
    font-weight: bold;
    z-index: 10;
}

/* Image with invalid settings */
.ui-image.invalid-image {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

.ui-image.invalid-image .ui-image-content {
    color: #dc3545;
}

.ui-image.invalid-image::after {
    content: '⚠️ Invalid Image Settings';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    background: #dc3545;
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    text-align: center;
    font-weight: bold;
    z-index: 10;
}

/* Weapon with invalid settings */
.ui-weaponimage.invalid-weapon {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

.ui-weaponimage.invalid-weapon .ui-weapon-content {
    color: #dc3545;
}

.ui-weaponimage.invalid-weapon::after {
    content: '⚠️ Invalid Weapon Settings';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    background: #dc3545;
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    text-align: center;
    font-weight: bold;
    z-index: 10;
}

.ui-weaponimage.invalid-parent::after {
    content: '⚠️ Requires Parent Widget';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    background: #dc3545;
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    text-align: center;
    font-weight: bold;
    z-index: 10;
}

/* Properties Panel */
.properties-content {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    max-height: calc(100vh - 140px); /* Ensure it doesn't exceed viewport */
}

/* Validation Errors */
.validation-error {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
}

.error-header {
    font-weight: 600;
    color: #856404;
    margin-bottom: 8px;
}

.error-item {
    margin: 4px 0;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
}

.error-item.error {
    background: #f8d7da;
    color: #721c24;
    border-left: 3px solid #dc3545;
}

.error-item.warning {
    background: #fff3cd;
    color: #856404;
    border-left: 3px solid #ffc107;
}

/* Property field error highlighting */
.property-field.has-error .property-input {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.property-field.has-error label {
    color: #dc3545;
}

.no-selection {
    text-align: center;
    color: #6c757d;
    margin-top: 40px;
}

.property-group {
    margin-bottom: 24px;
}

.property-group h4 {
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.property-field {
    margin-bottom: 16px;
}

.property-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #6c757d;
}

.property-field input,
.property-field select,
.property-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.property-field input:focus,
.property-field select:focus,
.property-field textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.property-field input[type="color"] {
    height: 40px;
    padding: 4px;
}

.property-field input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.property-row {
    display: flex;
    gap: 8px;
}

.property-row .property-field {
    flex: 1;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 2000;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 95%;
    max-width: 1200px;
    height: 85vh;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    resize: both;
    overflow: hidden;
    min-width: 600px;
    min-height: 400px;
    position: relative;
}

.modal-content::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: linear-gradient(-45deg, transparent 0%, transparent 30%, #ddd 30%, #ddd 40%, transparent 40%, transparent 60%, #ddd 60%, #ddd 70%, transparent 70%);
    cursor: se-resize;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e1e8ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close:hover {
    background-color: #f8f9fa;
    color: #495057;
}

.modal-body {
    padding: 20px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Export tabs */
.export-tabs {
    display: flex;
    border-bottom: 1px solid #e1e8ed;
    margin-bottom: 16px;
}

.tab-btn {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 500;
    color: #6c757d;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #495057;
    background-color: #f8f9fa;
}

.tab-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

/* Export Error Display */
.export-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 20px;
    margin: 16px 0;
}

.export-error h3 {
    color: #721c24;
    margin: 0 0 12px 0;
    font-size: 18px;
}

.export-error p {
    color: #721c24;
    margin: 8px 0;
}

.export-error ul {
    color: #721c24;
    margin: 12px 0;
    padding-left: 20px;
}

.export-error li {
    margin: 4px 0;
}

.tab-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.tab-pane {
    display: none;
    height: 100%;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
}

.modal-body textarea {
    flex: 1;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    resize: both;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 16px;
    background-color: #f8f9fa;
    margin-bottom: 16px;
    min-height: 300px;
    overflow: auto;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive */
@media (max-width: 1200px) {
    .toolbox-panel,
    .properties-panel {
        width: 240px;
    }
    
    .canvas {
        width: 100%;
        min-width: 800px;
    }
}

/* Alignment Tools */
.alignment-tools,
.single-element-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 12px;
    padding: 4px 8px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 6px;
}

.alignment-label,
.tools-label {
    font-size: 12px;
    font-weight: 500;
    margin-right: 4px;
    opacity: 0.9;
}

.btn-sm {
    padding: 4px 6px;
    font-size: 12px;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-outline {
    background-color: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-outline:hover {
    background-color: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}

.btn-outline:active {
    background-color: rgba(255,255,255,0.3);
}

.alignment-separator,
.tools-separator {
    color: rgba(255,255,255,0.4);
    margin: 0 2px;
    font-size: 12px;
}

/* Multi-selection display */
.multi-selection {
    padding: 20px;
    text-align: center;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin: 10px;
}

.multi-selection h3 {
    color: #007acc;
    margin-bottom: 10px;
}

.multi-selection p {
    margin: 5px 0;
    color: #555;
}

.multi-selection-note {
    background-color: #e3f2fd;
    border-left: 4px solid #007acc;
    padding: 10px;
    margin-top: 15px;
    border-radius: 4px;
}

.multi-selection-note p {
    font-size: 12px;
    line-height: 1.4;
    margin: 3px 0;
}

/* Panel sections */
.panel-section {
    border-bottom: 1px solid #e1e8ed;
    flex-shrink: 0;
}

.panel-section:last-child {
    border-bottom: none;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.panel-section .panel-title {
    margin: 0;
    padding: 15px 20px 10px;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e1e8ed;
}

/* Collapsible header */
.collapsible-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    user-select: none;
    transition: background-color 0.2s ease;
}

.collapsible-header:hover {
    background-color: #e9ecef;
}

.collapse-icon {
    margin-right: 8px;
    font-size: 12px;
    transition: transform 0.2s ease;
    display: inline-block;
}

.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapsible-content {
    transition: max-height 0.3s ease, opacity 0.2s ease;
    overflow: hidden;
}

.collapsed {
    max-height: 0 !important;
    opacity: 0;
    padding: 0 !important;
}

.collapsed .collapsible-content {
    max-height: 0 !important;
    opacity: 0;
    padding: 0 !important;
}

.panel-section.collapsed {
    border-bottom: 1px solid #e1e8ed;
}

/* Element list */
.element-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
}

.element-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    margin: 2px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    position: relative;
}

.element-item:hover {
    background-color: #f0f7ff;
    border-color: #007acc;
}

.element-item.selected {
    background-color: #007acc;
    color: white;
}

.element-item.multi-selected {
    background-color: #e3f2fd;
    border-color: #007acc;
    color: #007acc;
}

.element-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.element-item.drop-above {
    border-top: 2px solid #007acc;
}

.element-item.drop-below {
    border-bottom: 2px solid #007acc;
}

.element-drag-handle {
    width: 12px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
    font-size: 8px;
    color: #999;
    cursor: grab;
    line-height: 1;
}

.element-drag-handle:hover {
    color: #007acc;
}

.element-item:active .element-drag-handle {
    cursor: grabbing;
}

.element-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    font-size: 12px;
}

.element-info {
    flex: 1;
    min-width: 0;
}

.element-name {
    font-weight: 500;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.element-type {
    font-size: 10px;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.element-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.element-item:hover .element-actions {
    opacity: 1;
}

.layer-btn {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    transition: all 0.2s ease;
}

.layer-btn:hover {
    background: #007acc;
    color: white;
    transform: scale(1.1);
}

.element-item.selected .layer-btn {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.element-item.selected .layer-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.no-elements {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 12px;
}

/* Layer context menu */
.layer-context-menu {
    font-family: inherit;
    font-size: 12px;
}

.layer-context-menu .menu-item:last-child {
    border-bottom: none;
}

/* Auto-save and unsaved changes styling */
.btn.has-changes {
    background-color: #ff6b6b !important;
    border-color: #ff5252 !important;
    color: white !important;
    position: relative;
}

.btn.has-changes:hover {
    background-color: #ff5252 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.3);
}
