* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #1a1a1a;
    height: 100vh;
    overflow: hidden;
    color: #e0e0e0;
}

.app-container {
    display: none; /* Hidden by default, shown after authentication */
    flex-direction: column;
    height: 100vh;
}

.app-container.authenticated {
    display: flex;
}

/* Toolbar */
.toolbar {
    background: #2d2d2d;
    color: white;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border-bottom: 1px solid #404040;
    height: 56px;
    box-sizing: border-box;
}

.toolbar h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #ffffff;
}

.toolbar-buttons {
    display: flex;
    gap: 10px;
}

.tool-btn {
    background: #3d3d3d;
    border: 1px solid #4d4d4d;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: #4d4d4d;
    border-color: #5d5d5d;
}

.tool-btn:active {
    background: #353535;
}

.tool-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.tool-btn .icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: #4d4d4d;
    margin: 0 8px;
}

/* Project Menu */
.project-menu {
    position: relative;
}

/* Resolution Menu */
.resolution-menu {
    position: relative;
}

.resolution-menu-btn {
    position: relative;
}

.resolution-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #252526;
    border: 1px solid #3e3e42;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    min-width: 280px;
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.resolution-menu.active .resolution-dropdown {
    display: flex;
}

.resolution-category {
    padding: 8px 0;
}

.resolution-category-title {
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    color: #858585;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.resolution-item {
    width: 100%;
    text-align: left;
}

.resolution-item.active {
    background: rgba(0, 122, 204, 0.2);
    color: #4fc3f7;
}

.resolution-custom {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.resolution-input {
    flex: 1;
    padding: 8px 12px;
    background: #1e1e1e;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    color: #ffffff;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.resolution-input:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0,122,204,0.2);
}

.resolution-separator {
    color: #858585;
    font-size: 14px;
    font-weight: 500;
}

.resolution-apply-btn {
    padding: 8px 16px;
    background: #007acc;
    border: 1px solid #007acc;
    border-radius: 4px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.resolution-apply-btn:hover {
    background: #0098ff;
    border-color: #0098ff;
}

.project-menu-btn {
    position: relative;
}

.project-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #252526;
    border: 1px solid #3e3e42;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    min-width: 240px;
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.project-menu.active .project-dropdown {
    display: flex;
}

.dropdown-item {
    background: none;
    border: none;
    color: #cccccc;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    text-align: left;
    transition: background-color 0.15s;
}

.dropdown-item:hover {
    background: #2a2d2e;
    color: #ffffff;
}

.dropdown-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    stroke: currentColor;
}

.dropdown-divider {
    height: 1px;
    background: #3e3e42;
    margin: 4px 0;
}

.project-info {
    padding: 12px 16px;
    background: #1e1e1e;
    border-top: 1px solid #3e3e42;
}

.project-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}

.project-info-item:last-child {
    margin-bottom: 0;
}

.project-info-label {
    color: #858585;
    font-weight: 500;
}

.project-info-value {
    color: #cccccc;
    font-weight: 600;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal-dialog {
    background: #252526;
    border: 1px solid #3e3e42;
    border-radius: 8px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    min-width: 400px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #3e3e42;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2d2d30;
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

.modal-close {
    background: none;
    border: none;
    color: #858585;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #3e3e42;
    color: #ffffff;
}

.modal-content {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.modal-content p {
    margin: 0;
    color: #cccccc;
    line-height: 1.6;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #cccccc;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    background: #1e1e1e;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    color: #ffffff;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0,122,204,0.2);
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #3e3e42;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #2d2d30;
}

.btn {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: #007acc;
    color: #ffffff;
}

.btn-primary:hover {
    background: #005a9e;
}

.btn-secondary {
    background: #3d3d3d;
    color: #cccccc;
    border: 1px solid #4d4d4d;
}

.btn-secondary:hover {
    background: #4d4d4d;
    color: #ffffff;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Layers Panel */
.layers-panel {
    width: 280px;
    background: #252526;
    border-right: 1px solid #3e3e42;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
}

.layers-panel.collapsed {
    width: 0;
    overflow: hidden;
    border-right: none;
}

.layers-panel-header {
    padding: 8px 12px;
    border-bottom: 1px solid #3e3e42;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2d2d30;
    min-height: 32px;
}

.layers-panel-header h3 {
    font-size: 11px;
    margin: 0;
    color: #cccccc;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    user-select: none;
}

.layers-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #cccccc;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layers-toggle-btn svg {
    width: 12px;
    height: 12px;
    transition: transform 0.2s;
}

.layers-panel.collapsed .layers-toggle-btn svg {
    transform: rotate(-90deg);
}

.layers-toggle-btn:hover {
    background: #3e3e42;
}

.layers-panel.collapsed .layers-toggle-btn {
    transform: rotate(-90deg);
}

.layers-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.layers-tree {
    padding: 4px;
    user-select: none;
}

.layer-item {
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    user-select: none;
    position: relative;
    min-height: 24px;
    border-radius: 0;
}

.layer-item-row {
    display: flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 4px;
    border-radius: 4px;
    position: relative;
    transition: background-color 0.1s ease;
    gap: 4px;
}

.layer-item-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.layer-item.selected .layer-item-row {
    background: rgba(0, 122, 204, 0.2);
}

.layer-item.selected .layer-item-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #007acc;
    border-radius: 0 2px 2px 0;
}

.layer-item.dragging {
    opacity: 0.4;
}

.layer-item.drag-over-top .layer-item-row::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #007acc;
    z-index: 10;
}

.layer-item.drag-over-bottom .layer-item-row::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #007acc;
    z-index: 10;
}

.layer-item.drag-over-inside .layer-item-row {
    background: rgba(0, 122, 204, 0.15);
    border-left: 2px solid #007acc;
}

.layer-indent {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-expand {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 3px;
    flex-shrink: 0;
    color: #858585;
    transition: all 0.15s ease;
    margin-right: 2px;
}

.layer-expand:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #cccccc;
}

.layer-expand svg {
    width: 12px;
    height: 12px;
    transition: transform 0.15s ease;
}

.layer-expand.collapsed svg {
    transform: rotate(-90deg);
}

.layer-spacer {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.layer-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #858585;
    margin-right: 6px;
}

.layer-icon svg {
    width: 14px;
    height: 14px;
}

.layer-item.selected .layer-icon {
    color: #4fc3f7;
}

.layer-label {
    flex: 1;
    font-size: 12px;
    color: #cccccc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 2px 4px;
    border-radius: 2px;
    min-width: 0;
    transition: all 0.1s ease;
}

.layer-label:focus {
    outline: 1px solid #007acc;
    background: rgba(0, 122, 204, 0.1);
    color: #ffffff;
}

.layer-item.selected .layer-label {
    color: #ffffff;
    font-weight: 500;
}

.layer-children {
    display: none;
    margin-left: 0;
}

.layer-children.expanded {
    display: block;
}

.layer-content {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 2px;
}

.layer-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.layer-item-row:hover .layer-actions {
    opacity: 1;
}

.layer-item.selected .layer-actions {
    opacity: 1;
}

.layer-action-btn {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 3px;
    flex-shrink: 0;
    color: #858585;
    transition: all 0.15s ease;
    padding: 0;
    background: transparent;
    border: none;
}

.layer-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #cccccc;
}

.layer-action-btn svg {
    width: 14px;
    height: 14px;
}

.layer-visibility {
    color: #858585;
}

.layer-visibility.hidden {
    color: #555;
    opacity: 0.5;
}

.layer-lock {
    color: #858585;
}

.layer-lock.locked {
    color: #ff9800;
}

/* Right Sidebar */
.right-sidebar {
    width: 400px;
    background: #252526;
    border-left: 1px solid #3e3e42;
    display: flex;
    flex-direction: column;
    color: #cccccc;
}

/* Sidebar Tabs */
.sidebar-tabs {
    display: flex;
    background: #2d2d30;
    border-bottom: 1px solid #3e3e42;
    padding: 0 4px;
}

.sidebar-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #cccccc;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.sidebar-tab:hover {
    background: #2d2d30;
    color: #ffffff;
}

.sidebar-tab.active {
    background: #1e1e1e;
    border-bottom-color: #007acc;
    color: #ffffff;
}

.tab-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.tab-label {
    font-size: 12px;
}

.sidebar-content {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-content.active {
    display: flex;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid #3e3e42;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2d2d30;
}

.sidebar-header h3 {
    font-size: 13px;
    margin: 0;
    color: #cccccc;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Code Panel (inside sidebar) */
.code-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}


.code-header-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

.code-copy-btn,
.code-edit-btn,
.code-fullscreen-btn {
    background: #2d2d2d;
    border: 1px solid #444;
    color: #d4d4d4;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.code-copy-btn svg,
.code-edit-btn svg,
.code-fullscreen-btn svg {
    width: 16px;
    height: 16px;
}

.code-copy-btn:hover,
.code-edit-btn:hover,
.code-fullscreen-btn:hover {
    background: #3d3d3d;
    border-color: #555;
}

.code-edit-btn.active {
    background: #007acc;
    border-color: #007acc;
    color: #ffffff;
}

.code-tabs {
    display: flex;
    border-bottom: 1px solid #3e3e42;
    background: #2d2d30;
}

.code-tab {
    flex: 1;
    padding: 10px 16px;
    background: #2d2d30;
    border: none;
    border-right: 1px solid #3e3e42;
    color: #858585;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.code-tab:last-child {
    border-right: none;
}

.code-tab:hover {
    background: #252526;
    color: #cccccc;
}

.code-tab.active {
    background: #1e1e1e;
    color: #ffffff;
    border-bottom: 2px solid #007acc;
}

.code-content {
    flex: 1;
    overflow: auto;
    position: relative;
}

.code-view {
    display: none;
    margin: 0;
    padding: 15px;
    height: 100%;
    overflow: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    background: #1e1e1e;
}

.code-view.active {
    display: block;
}

.code-view code {
    color: #d4d4d4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Syntax highlighting colors */
.code-view code .tag { color: #569cd6; }
.code-view code .attr { color: #92c5f7; }
.code-view code .string { color: #ce9178; }
.code-view code .comment { color: #6a9955; }
.code-view code .selector { color: #d7ba7d; }
.code-view code .property { color: #9cdcfe; }
.code-view code .value { color: #ce9178; }

/* Code Editor Styles */
.code-editor {
    display: none;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 15px;
    border: none;
    outline: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    background: #1e1e1e;
    color: #d4d4d4;
    resize: none;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
    tab-size: 4;
}

.code-editor.active {
    display: block;
}

/* Fullscreen Editor Styles */
.fullscreen-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    flex-direction: column;
}

.fullscreen-editor-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: #1e1e1e;
}

.fullscreen-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #252526;
    border-bottom: 1px solid #3e3e42;
}

.fullscreen-editor-header h3 {
    margin: 0;
    color: #cccccc;
    font-size: 16px;
    font-weight: 500;
}

.fullscreen-editor-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.fullscreen-editor-btn {
    background: #2d2d2d;
    border: 1px solid #444;
    color: #d4d4d4;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-size: 13px;
}

.fullscreen-editor-btn svg {
    width: 16px;
    height: 16px;
}

.fullscreen-editor-btn:hover {
    background: #3d3d3d;
    border-color: #555;
}

.fullscreen-editor-tabs {
    display: flex;
    border-bottom: 1px solid #3e3e42;
    background: #2d2d30;
}

.fullscreen-code-tab {
    flex: 1;
    padding: 12px 20px;
    background: #2d2d30;
    border: none;
    border-right: 1px solid #3e3e42;
    color: #858585;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.fullscreen-code-tab:last-child {
    border-right: none;
}

.fullscreen-code-tab:hover {
    background: #252526;
    color: #cccccc;
}

.fullscreen-code-tab.active {
    background: #1e1e1e;
    color: #ffffff;
    border-bottom: 2px solid #007acc;
}

.fullscreen-editor-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.fullscreen-code-editor {
    display: none;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 20px;
    border: none;
    outline: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    background: #1e1e1e;
    color: #d4d4d4;
    resize: none;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
    tab-size: 4;
}

.fullscreen-code-editor.active {
    display: block;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    overflow: auto;
    background: #1e1e1e;
    padding: 60px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    transition: margin-left 0.3s ease;
    position: relative;
    z-index: 1;
}

.canvas {
    background: #ffffff;
    width: 1920px; /* Default, will be set by JavaScript */
    height: 1080px; /* Default, will be set by JavaScript */
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    border-radius: 4px;
    border: 1px solid #3e3e42;
    overflow: hidden; /* Prevent elements from going outside canvas */
}

/* Properties Panel (inside sidebar) */
.properties-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.properties-tabs-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.properties-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    background: #252526;
    border-bottom: 1px solid #3e3e42;
    max-height: 120px;
    overflow-y: auto;
}

.property-tab {
    padding: 6px 12px;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 3px;
    color: #cccccc;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
}

.property-tab:hover {
    background: #3e3e42;
    border-color: #007acc;
}

.property-tab.active {
    background: #007acc;
    border-color: #007acc;
    color: #ffffff;
}

.properties-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    position: relative;
}

.no-selection {
    color: #858585;
    text-align: center;
    padding: 40px 20px;
    font-style: italic;
    font-size: 13px;
}

.property-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.property-group label {
    font-size: 11px;
    font-weight: 600;
    color: #858585;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.property-group input,
.property-group select,
.property-group textarea {
    padding: 8px 12px;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    font-size: 13px;
    background: #1e1e1e;
    color: #cccccc;
    transition: border-color 0.2s;
}

.property-group input:focus,
.property-group select:focus,
.property-group textarea:focus {
    outline: none;
    border-color: #007acc;
    background: #252526;
}

.property-group input[type="color"] {
    height: 40px;
    cursor: pointer;
}

.property-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.property-section {
    border: 1px solid #3e3e42;
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
    background: #1e1e1e;
}

.property-section-header {
    background: #2d2d30;
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    font-size: 12px;
    color: #cccccc;
    user-select: none;
    transition: background 0.2s;
}

.property-section-header:hover {
    background: #252526;
}

.property-section-header::after {
    content: '▼';
    font-size: 9px;
    transition: transform 0.2s;
    color: #858585;
}

.property-section.collapsed .property-section-header::after {
    transform: rotate(-90deg);
}

.property-section-content {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #1e1e1e;
}

.property-section.collapsed .property-section-content {
    display: none;
}

.property-group input[type="range"] {
    width: 100%;
}

.property-group input[type="text"] {
    font-family: monospace;
}

.gradient-preview {
    width: 100%;
    height: 40px;
    border-radius: 4px;
    border: 1px solid #ddd;
    margin-top: 5px;
}

.color-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-input-group input[type="color"] {
    flex-shrink: 0;
    width: 50px;
    height: 40px;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    cursor: pointer;
}

.color-input-group input[type="text"] {
    flex: 1;
}

/* Property Popup Window */
.property-popup {
    position: fixed;
    background: #252526;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    min-width: 320px;
    max-width: 500px;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    z-index: 10000;
    resize: both;
    overflow: hidden;
}

.property-popup-header {
    background: #2d2d30;
    border-bottom: 1px solid #3e3e42;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
    user-select: none;
}

.property-popup-title {
    font-size: 12px;
    font-weight: 600;
    color: #cccccc;
    flex: 1;
}

.property-popup-close {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 3px;
    color: #858585;
    transition: all 0.2s;
    flex-shrink: 0;
}

.property-popup-close:hover {
    background: #3e3e42;
    color: #ffffff;
}

.property-popup-close svg {
    width: 14px;
    height: 14px;
}

.property-popup-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #1e1e1e;
}

.property-popup-content .property-group {
    margin-bottom: 16px;
}

.property-popup-content .property-group:last-child {
    margin-bottom: 0;
}

/* Image Add Dialog */
.image-add-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.image-add-dialog .dialog-content {
    background: #252526;
    border: 1px solid #3e3e42;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.image-add-dialog .dialog-header {
    padding: 16px 20px;
    border-bottom: 1px solid #3e3e42;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2d2d30;
}

.image-add-dialog .dialog-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #cccccc;
}

.image-add-dialog .dialog-close {
    background: none;
    border: none;
    color: #858585;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.image-add-dialog .dialog-close:hover {
    background: #3e3e42;
    color: #ffffff;
}

.image-add-dialog .dialog-body {
    padding: 20px;
}

.image-add-dialog .dialog-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid #3e3e42;
}

.image-add-dialog .dialog-tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #858585;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: -1px;
}

.image-add-dialog .dialog-tab:hover {
    color: #cccccc;
}

.image-add-dialog .dialog-tab.active {
    color: #007acc;
    border-bottom-color: #007acc;
}

.image-add-dialog .dialog-tab-content {
    min-height: 100px;
}

/* Canvas Elements */
.canvas-element {
    position: absolute;
    cursor: move;
    border: 2px dashed transparent;
    transition: border-color 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

.canvas-element:hover {
    border-color: #667eea;
}

.canvas-element.selected {
    border-color: #667eea;
    border-style: solid;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.canvas-element.dragging {
    opacity: 0.8;
    z-index: 99999 !important;
    position: absolute !important;
    pointer-events: none;
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Box Element */
.element-box {
    background: #f0f0f0;
    border: 1px solid #ddd;
}

/* Kutu seçiliyken köşe noktaları taşmasın diye overflow açık */
.element-box.selected {
    overflow: visible;
}

/* Group/Container Element */
.element-group {
    background: transparent;
    border: none;
    /* Removed min-width and min-height to allow free resizing */
}

.element-group.selected {
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.3);
    overflow: visible;
}

.element-group .canvas-element {
    position: absolute !important;
}

/* Text Element (wrapper div contains textarea for resize handles) */
.element-text {
    padding: 10px;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    overflow: hidden;
    font-family: inherit;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    box-sizing: border-box;
}

/* Köşelerden boyutlandırma için seçiliyken taşan handle'ları göster */
.element-text.selected {
    overflow: visible;
}

.element-text .element-text-inner {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 1.2em;
    box-sizing: border-box;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    font: inherit;
    /* Köşe handle'larının tıklanabilir kalması için z-index düşük */
    position: relative;
    z-index: 0;
}
.element-text .resize-handle {
    z-index: 10;
}

.element-text:focus-within,
.element-text:focus {
    border: 2px dashed #667eea;
    border-radius: 4px;
}

/* Image Element (wrapper div contains img so resize handles work) */
.element-image {
    box-sizing: border-box;
    overflow: hidden;
}

.element-image .element-image-inner {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.element-image.selected {
    overflow: visible;
}

/* element-image.label-resim: kutu/yazı ile aynı özellikler – seçiliyken noktalar görünsün, köşeden boyutlandırma */
.element-image.label-resim.selected {
    overflow: visible;
}
.canvas-element.element-image.label-resim .resize-handle {
    pointer-events: auto !important;
    z-index: 10002 !important;
}
.canvas-element.element-image.label-resim.selected .resize-handle {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
/* label-resim: noktalar kutunun içinde (köşelerden 2px), daha kolay tıklanır */
.canvas-element.element-image.label-resim .resize-handle.nw {
    top: 2px;
    left: 2px;
}
.canvas-element.element-image.label-resim .resize-handle.ne {
    top: 2px;
    right: 2px;
    left: auto;
}
.canvas-element.element-image.label-resim .resize-handle.sw {
    bottom: 2px;
    left: 2px;
    right: auto;
}
.canvas-element.element-image.label-resim .resize-handle.se {
    bottom: 2px;
    right: 2px;
    left: auto;
}
.canvas-element.element-image.label-resim .resize-handle {
    width: 14px;
    height: 14px;
}

/* Resize Handle */
.resize-handle {
    position: absolute;
    background: #667eea;
    border: 2px solid white;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 1000;
    display: none;
    pointer-events: auto !important;
}

.canvas-element.selected .resize-handle {
    display: block;
}

/* Ensure text elements show resize handles when selected */
.element-text.selected .resize-handle,
textarea.element-text.selected .resize-handle,
.canvas-element.element-text.selected .resize-handle {
    display: block !important;
    z-index: 10002 !important;
    pointer-events: auto !important;
    position: absolute !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.resize-handle.se {
    bottom: -6px;
    right: -6px;
    cursor: nwse-resize;
}

.resize-handle.sw {
    bottom: -6px;
    left: -6px;
    cursor: nesw-resize;
}

.resize-handle.ne {
    top: -6px;
    right: -6px;
    cursor: nesw-resize;
}

.resize-handle.nw {
    top: -6px;
    left: -6px;
    cursor: nwse-resize;
}

/* Yazı kutularında handle'lar kutunun İÇİNDE (köşelerden 2px) – böylece tıklanabilir */
.canvas-element.element-text .resize-handle.nw {
    top: 2px;
    left: 2px;
}
.canvas-element.element-text .resize-handle.ne {
    top: 2px;
    right: 2px;
    left: auto;
}
.canvas-element.element-text .resize-handle.sw {
    bottom: 2px;
    left: 2px;
    right: auto;
}
.canvas-element.element-text .resize-handle.se {
    bottom: 2px;
    right: 2px;
    left: auto;
}
.canvas-element.element-text .resize-handle {
    width: 14px;
    height: 14px;
}

/* Delete Button */
/* Delete button removed */

/* Ensure resize handles are clickable on images */
.element-image .resize-handle {
    pointer-events: auto;
    z-index: 1002;
}

/* Ensure resize handles are clickable and visible on text elements */
.element-text .resize-handle,
textarea.element-text .resize-handle,
.canvas-element.element-text .resize-handle {
    pointer-events: auto !important;
    z-index: 10002 !important;
    position: absolute !important;
}

.element-text.selected .resize-handle,
textarea.element-text.selected .resize-handle,
.canvas-element.element-text.selected .resize-handle {
    display: block !important;
    pointer-events: auto !important;
    z-index: 10002 !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
}

/* Text/label: seçili DEĞİLken noktalar asla görünmesin */
.canvas-element.element-text:not(.selected) .resize-handle,
textarea.element-text:not(.selected) .resize-handle {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* contenteditable olsa bile sadece seçiliyken noktalar görünsün */
.element-text.selected[contenteditable="true"] .resize-handle,
.element-text.selected[contenteditable] .resize-handle {
    display: block !important;
    pointer-events: auto !important;
    z-index: 1002 !important;
}

/* Font Selector */
.font-selector-container {
    position: relative;
    width: 100%;
}

.font-selector-display {
    width: 100%;
    padding: 10px 12px;
    background: #1e1e1e;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color 0.2s;
    user-select: none;
}

.font-selector-display:hover {
    border-color: #5d5d5d;
}

.font-selector-display.active {
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0,122,204,0.2);
}

.font-display-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.font-selector-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #252526;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 10000;
    max-height: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.font-search-box {
    padding: 8px;
    border-bottom: 1px solid #3e3e42;
    background: #1e1e1e;
}

.font-search-input {
    width: 100%;
    padding: 6px 10px;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 3px;
    color: #ffffff;
    font-size: 13px;
    font-family: inherit;
}

.font-search-input:focus {
    outline: none;
    border-color: #007acc;
}

.font-list {
    overflow-y: auto;
    max-height: 250px;
}

.font-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #cccccc;
    transition: background-color 0.15s;
    border-bottom: 1px solid #2d2d30;
    user-select: none;
}

.font-item:last-child {
    border-bottom: none;
}

.font-item:hover {
    background: #2a2d2e;
    color: #ffffff;
}

.font-item.selected {
    background: rgba(0, 122, 204, 0.2);
    color: #4fc3f7;
    font-weight: 500;
}

.font-item.selected:hover {
    background: rgba(0, 122, 204, 0.3);
}

/* SVG Icon Menu */
.svg-icon-menu {
    position: relative;
}

.svg-icon-menu-btn {
    position: relative;
}

.svg-icon-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #252526;
    border: 1px solid #3e3e42;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    width: 500px;
    max-height: 600px;
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.svg-icon-menu.active .svg-icon-dropdown {
    display: flex;
}

.svg-icon-search-container {
    position: relative;
    padding: 12px;
    border-bottom: 1px solid #3e3e42;
    background: #1e1e1e;
}

.svg-icon-search-input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    color: #ffffff;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.svg-icon-search-input:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0,122,204,0.2);
}

.svg-icon-categories {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: #1e1e1e;
    border-bottom: 1px solid #3e3e42;
    overflow-x: auto;
    flex-wrap: wrap;
}

.svg-icon-category-btn {
    padding: 6px 12px;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    color: #cccccc;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.svg-icon-category-btn:hover {
    background: #3e3e42;
    border-color: #5d5d5d;
}

.svg-icon-category-btn.active {
    background: #007acc;
    border-color: #007acc;
    color: #ffffff;
}

.svg-icon-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    padding: 12px;
    overflow-y: auto;
    max-height: 450px;
    flex: 1;
}

.svg-icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    min-height: 80px;
}

.svg-icon-item:hover {
    background: #3e3e42;
    border-color: #007acc;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.svg-icon-item svg {
    width: 24px;
    height: 24px;
    stroke: #cccccc;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.svg-icon-item:hover svg {
    stroke: #4fc3f7;
}

.svg-icon-item-name {
    font-size: 10px;
    color: #858585;
    text-align: center;
    line-height: 1.2;
    margin-top: 4px;
    word-break: break-word;
}

.svg-icon-item:hover .svg-icon-item-name {
    color: #cccccc;
}

.svg-icon-item-shortcut {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.5);
    color: #858585;
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.2s;
}

.svg-icon-item:hover .svg-icon-item-shortcut {
    opacity: 1;
}

/* Effects Grid */
.effects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px;
}

.effect-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 8px;
    background: #2d2d30;
    border: 2px solid #3e3e42;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.effect-item:hover {
    background: #3e3e42;
    border-color: #007acc;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.effect-item.selected {
    border-color: #007acc;
    background: rgba(0, 122, 204, 0.2);
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.3);
}

.effect-preview {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    border-radius: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.effect-preview-box {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.effect-name {
    font-size: 10px;
    color: #cccccc;
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
    max-width: 100%;
}

.effect-item:hover .effect-name {
    color: #ffffff;
}

.quick-effects-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.quick-effects-row:last-child {
    margin-bottom: 0;
}

.quick-effect-btn {
    flex: 1;
    min-width: 80px;
    padding: 8px 12px;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    color: #cccccc;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s;
}

.quick-effect-btn:hover {
    background: #3e3e42;
    border-color: #007acc;
    color: #ffffff;
    transform: translateY(-1px);
}

.quick-effect-btn:active {
    transform: translateY(0);
    background: #252526;
}

.property-hint {
    font-size: 11px;
    color: #858585;
    margin-top: 4px;
    line-height: 1.4;
}

/* Shapes Menu */
.shapes-menu {
    position: relative;
}

.shapes-menu-btn {
    position: relative;
}

.shapes-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #252526;
    border: 1px solid #3e3e42;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    width: 500px;
    max-height: 600px;
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.shapes-menu.active .shapes-dropdown {
    display: flex;
}

.shapes-search-container {
    position: relative;
    padding: 12px;
    border-bottom: 1px solid #3e3e42;
    background: #1e1e1e;
}

.shapes-search-input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    color: #ffffff;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.shapes-search-input:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0,122,204,0.2);
}

.shapes-categories {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: #1e1e1e;
    border-bottom: 1px solid #3e3e42;
    overflow-x: auto;
    flex-wrap: wrap;
}

.shapes-category-btn {
    padding: 6px 12px;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    color: #cccccc;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.shapes-category-btn:hover {
    background: #3e3e42;
    border-color: #5d5d5d;
}

.shapes-category-btn.active {
    background: #007acc;
    border-color: #007acc;
    color: #ffffff;
}

.shapes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px;
    overflow-y: auto;
    max-height: 450px;
    flex: 1;
}

.shape-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    min-height: 90px;
}

.shape-item:hover {
    background: #3e3e42;
    border-color: #007acc;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.shape-item svg {
    width: 40px;
    height: 40px;
    stroke: #cccccc;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.shape-item:hover svg {
    stroke: #4fc3f7;
}

.shape-item-name {
    font-size: 10px;
    color: #858585;
    text-align: center;
    line-height: 1.2;
    margin-top: 4px;
    word-break: break-word;
}

.shape-item:hover .shape-item-name {
    color: #cccccc;
}

/* Project Selector Styles */
.project-selector-overlay {
    z-index: 20000;
}

.project-selector-dialog {
    min-width: 600px;
    max-width: 800px;
    width: 90vw;
}

.project-selector-content {
    padding: 0;
    min-height: 400px;
    max-height: 70vh;
}

.project-selector-tabs {
    display: flex;
    border-bottom: 1px solid #3e3e42;
    background: #2d2d30;
}

.project-tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #858585;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.project-tab-btn:hover {
    color: #cccccc;
    background: #3e3e42;
}

.project-tab-btn.active {
    color: #007acc;
    border-bottom-color: #007acc;
    background: #252526;
}

.project-tab-content {
    display: none;
    padding: 20px;
    min-height: 350px;
}

.project-tab-content.active {
    display: block;
}

.project-list-container {
    height: 100%;
}

.project-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.project-list-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
}

.btn-icon {
    background: #3d3d3d;
    border: 1px solid #4d4d4d;
    color: #cccccc;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #4d4d4d;
    border-color: #5d5d5d;
    color: #ffffff;
}

.project-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.project-list::-webkit-scrollbar {
    width: 8px;
}

.project-list::-webkit-scrollbar-track {
    background: #1e1e1e;
    border-radius: 4px;
}

.project-list::-webkit-scrollbar-thumb {
    background: #4d4d4d;
    border-radius: 4px;
}

.project-list::-webkit-scrollbar-thumb:hover {
    background: #5d5d5d;
}

.project-item {
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 6px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.project-item:hover {
    background: #3e3e42;
    border-color: #007acc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.project-item.selected {
    border-color: #007acc;
    background: #1e3a5f;
}

.project-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
    word-break: break-word;
}

.project-item-meta {
    font-size: 11px;
    color: #858585;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.project-item-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.project-item:hover .project-item-actions {
    opacity: 1;
}

.project-item-action {
    background: rgba(0,0,0,0.5);
    border: 1px solid #4d4d4d;
    color: #cccccc;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.project-item-action:hover {
    background: rgba(0,0,0,0.7);
    border-color: #007acc;
    color: #ffffff;
}

.project-item-action svg {
    width: 14px;
    height: 14px;
}

.project-list-empty {
    text-align: center;
    padding: 60px 20px;
    color: #858585;
}

.project-list-empty p {
    margin: 0;
    font-size: 14px;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: #252526;
    border: 1px solid #3e3e42;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    min-width: 180px;
    z-index: 10001;
    display: none;
    flex-direction: column;
    overflow: hidden;
    padding: 4px;
}

.context-menu.active {
    display: flex;
}

.context-menu-item {
    background: none;
    border: none;
    color: #cccccc;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    text-align: left;
    transition: background-color 0.15s;
    border-radius: 4px;
    width: 100%;
}

.context-menu-item:hover:not(:disabled) {
    background: #2a2d2e;
    color: #ffffff;
}

.context-menu-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.context-menu-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    stroke: currentColor;
}

/* Library Menu Styles */
.library-menu {
    position: relative;
}

.library-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #252526;
    border: 1px solid #3e3e42;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    width: 400px;
    max-height: 600px;
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.library-menu.active .library-dropdown {
    display: flex;
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #3e3e42;
    background: #1e1e1e;
}

.library-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
}

.library-save-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #007acc;
    border: 1px solid #007acc;
    border-radius: 4px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.library-save-btn:hover {
    background: #0098ff;
    border-color: #0098ff;
}

.library-save-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.library-search-container {
    position: relative;
    padding: 12px;
    border-bottom: 1px solid #3e3e42;
    background: #1e1e1e;
}

.library-search-input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    color: #ffffff;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.library-search-input:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0,122,204,0.2);
}

.library-list {
    padding: 8px;
    overflow-y: auto;
    max-height: 450px;
    flex: 1;
}

.library-list::-webkit-scrollbar {
    width: 8px;
}

.library-list::-webkit-scrollbar-track {
    background: #1e1e1e;
    border-radius: 4px;
}

.library-list::-webkit-scrollbar-thumb {
    background: #4d4d4d;
    border-radius: 4px;
}

.library-list::-webkit-scrollbar-thumb:hover {
    background: #5d5d5d;
}

.library-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    margin-bottom: 8px;
    transition: all 0.15s;
    cursor: pointer;
}

.library-item:hover {
    background: #3e3e42;
    border-color: #007acc;
}

.library-item-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.library-item-preview {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e1e1e;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    flex-shrink: 0;
}

.library-item-preview svg {
    stroke: #858585;
}

.library-item:hover .library-item-preview svg {
    stroke: #4fc3f7;
}

.library-item-info {
    flex: 1;
    min-width: 0;
}

.library-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #cccccc;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.library-item-date {
    font-size: 11px;
    color: #858585;
}

.library-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.library-item-use,
.library-item-delete {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    color: #cccccc;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.library-item-use:hover {
    background: #007acc;
    border-color: #007acc;
    color: #ffffff;
}

.library-item-delete:hover {
    background: #d32f2f;
    border-color: #d32f2f;
    color: #ffffff;
}

.library-item-use svg,
.library-item-delete svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.library-empty {
    padding: 40px 20px;
    text-align: center;
    color: #858585;
}

.library-empty p {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
}

/* Element Properties Modal */
.element-properties-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.property-subgroup {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid #3e3e42;
}

.property-subgroup .property-group {
    margin-bottom: 12px;
}

.property-subgroup .property-group:last-child {
    margin-bottom: 0;
}

/* Element Type Styles */
.element-button {
    cursor: pointer !important;
    user-select: none;
    transition: all 0.2s ease;
}

.element-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.element-button:active {
    transform: translateY(0);
    opacity: 0.8;
}

.element-link {
    cursor: pointer !important;
    text-decoration: underline;
    color: #007acc;
    transition: color 0.2s ease;
}

.element-link:hover {
    color: #0098ff;
}

.element-input {
    background: #ffffff;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    color: #333;
    width: 100%;
    box-sizing: border-box;
}

.element-input:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}

.element-select {
    background: #ffffff;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    color: #333;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
}

.element-select:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}

.element-textarea {
    background: #ffffff;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    color: #333;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 80px;
}

.element-textarea:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}

/* Layers Popup Modal */
.layers-popup-overlay {
    z-index: 15000;
}

.layers-popup-overlay.active {
    display: flex;
}

.layers-popup-dialog {
    background: #252526;
    border: 1px solid #3e3e42;
    border-radius: 8px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    width: 90vw;
    max-width: 1200px;
    height: 85vh;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalFadeIn 0.2s ease;
}

.layers-popup-header {
    padding: 16px 20px;
    border-bottom: 1px solid #3e3e42;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2d2d30;
    flex-shrink: 0;
}

.layers-popup-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.layers-popup-close {
    background: none;
    border: none;
    color: #858585;
    cursor: pointer;
    padding: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.layers-popup-close:hover {
    background: #3e3e42;
    color: #ffffff;
}

.layers-popup-close svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.layers-popup-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
}

.layers-tree-popup {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    user-select: none;
}

.layers-tree-popup .layer-item {
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    user-select: none;
    position: relative;
    min-height: 28px;
    border-radius: 0;
}

.layers-tree-popup .layer-item-row {
    display: flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 8px;
    border-radius: 4px;
    position: relative;
    transition: background-color 0.1s ease;
    gap: 6px;
}

.layers-tree-popup .layer-item-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.layers-tree-popup .layer-item.selected .layer-item-row {
    background: rgba(0, 122, 204, 0.2);
}

.layers-tree-popup .layer-item.selected .layer-item-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #007acc;
    border-radius: 0 2px 2px 0;
}

.layers-tree-popup .layer-label {
    flex: 1;
    font-size: 13px;
    color: #cccccc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 2px;
    min-width: 0;
    transition: all 0.1s ease;
}

.layers-tree-popup .layer-item.selected .layer-label {
    color: #ffffff;
    font-weight: 500;
}

.layers-tree-popup .layer-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #858585;
    margin-right: 8px;
}

.layers-tree-popup .layer-icon svg {
    width: 16px;
    height: 16px;
}

.layers-tree-popup .layer-item.selected .layer-icon {
    color: #4fc3f7;
}

.layers-tree-popup .layer-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.layers-tree-popup .layer-item-row:hover .layer-actions {
    opacity: 1;
}

.layers-tree-popup .layer-item.selected .layer-actions {
    opacity: 1;
}

.layers-tree-popup .layer-action-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 3px;
    flex-shrink: 0;
    color: #858585;
    transition: all 0.15s ease;
    padding: 0;
    background: transparent;
    border: none;
}

.layers-tree-popup .layer-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #cccccc;
}

.layers-tree-popup .layer-action-btn svg {
    width: 16px;
    height: 16px;
}

.layers-tree-popup .layer-expand {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 3px;
    flex-shrink: 0;
    color: #858585;
    transition: all 0.15s ease;
    margin-right: 4px;
}

.layers-tree-popup .layer-expand:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #cccccc;
}

.layers-tree-popup .layer-expand svg {
    width: 14px;
    height: 14px;
    transition: transform 0.15s ease;
}

.layers-tree-popup .layer-expand.collapsed svg {
    transform: rotate(-90deg);
}

.layers-tree-popup .layer-children {
    display: none;
    margin-left: 24px;
}

.layers-tree-popup .layer-children.expanded {
    display: block;
}

.layers-tree-popup::-webkit-scrollbar {
    width: 12px;
}

.layers-tree-popup::-webkit-scrollbar-track {
    background: #1e1e1e;
    border-radius: 6px;
}

.layers-tree-popup::-webkit-scrollbar-thumb {
    background: #4d4d4d;
    border-radius: 6px;
}

.layers-tree-popup::-webkit-scrollbar-thumb:hover {
    background: #5d5d5d;
}

/* Login Styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    backdrop-filter: blur(10px);
}

.login-overlay.hidden {
    display: none;
}

.login-container {
    background: #252526;
    border: 1px solid #3e3e42;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
    width: 100%;
    max-width: 420px;
    padding: 0;
    overflow: hidden;
    animation: loginFadeIn 0.3s ease;
}

@keyframes loginFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.login-header {
    padding: 32px 32px 24px;
    text-align: center;
    background: linear-gradient(135deg, #007acc 0%, #005a9e 100%);
    border-bottom: 1px solid #3e3e42;
}

.login-header h2 {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.login-header p {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

.login-content {
    padding: 32px;
}

.login-form-group {
    margin-bottom: 20px;
}

.login-form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #cccccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-input {
    width: 100%;
    padding: 12px 16px;
    background: #1e1e1e;
    border: 1px solid #3e3e42;
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    box-sizing: border-box;
}

.login-input:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 3px rgba(0,122,204,0.2);
    background: #252526;
}

.login-input::placeholder {
    color: #858585;
}

.login-error {
    background: rgba(211, 47, 47, 0.1);
    border: 1px solid rgba(211, 47, 47, 0.3);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.login-error span {
    color: #f44336;
    font-size: 13px;
    font-weight: 500;
}

.login-btn {
    width: 100%;
    padding: 14px 24px;
    background: #007acc;
    border: 1px solid #007acc;
    border-radius: 6px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-btn:hover {
    background: #0098ff;
    border-color: #0098ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.3);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

