/* Reset en basis styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    overflow: hidden;
    height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark mode styles */
body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode .toolbar {
    background: #1a252f;
}

body.dark-mode .tools-toolbar {
    background: #2c3e50;
    border-bottom: 1px solid #1a252f;
}

body.dark-mode .left-sidebar {
    background-color: #2c3e50;
    border-right: 1px solid #1a1a1a;
}

body.dark-mode .right-sidebar {
    background-color: #2c3e50;
    border-left: 1px solid #1a1a1a;
}

body.dark-mode .sidebar-category h4 {
    color: #e0e0e0;
    border-bottom: 1px solid #34495e;
}

body.dark-mode .sidebar-element {
    background-color: #34495e;
    border: 1px solid #4a5568;
    color: #e0e0e0;
}

body.dark-mode .sidebar-element:hover {
    background-color: #4a5568;
    border-color: #667eea;
}

body.dark-mode #propertiesPanel {
    background-color: #2c3e50;
    color: #e0e0e0;
}



body.dark-mode .property-group h5 {
    color: #e0e0e0;
    border-bottom: 1px solid #34495e;
}

body.dark-mode .property-value {
    background-color: #34495e;
    border: 1px solid #4a5568;
    color: #e0e0e0;
}

body.dark-mode .property-value:focus {
    border-color: #667eea;
    background-color: #4a5568;
}

body.dark-mode .property-btn {
    background-color: #34495e;
    border: 1px solid #4a5568;
    color: #e0e0e0;
}

body.dark-mode .property-btn:hover {
    background-color: #4a5568;
}

body.dark-mode .property-btn.primary {
    background-color: #667eea;
    border-color: #667eea;
}

body.dark-mode .property-btn.danger {
    background-color: #e53e3e;
    border-color: #e53e3e;
}

body.dark-mode .no-selection {
    color: #a0a0a0;
}

body.dark-mode .element-preview {
    background-color: #34495e;
    border: 1px solid #4a5568;
}

/* Canvas dark mode styles */
body.dark-mode .canvas-container {
    background: #1a1a1a;
}

body.dark-mode #archimateCanvas {
    background: #2c3e50;
    box-shadow: inset 0 0 10px rgba(255,255,255,0.1);
}

body.dark-mode .status-bar {
    background: rgba(0,0,0,0.9);
    color: #e0e0e0;
}

/* Toolbar */
.toolbar {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 3px 12px rgba(0,0,0,0.15);
    height: 54px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.toolbar-left, .toolbar-right {
    display: flex;
    gap: 8px;
}

/* Topbar Menu */
.menu-wrapper { position: relative; }
.menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    min-width: 220px;
    z-index: 1500;
    padding: 6px 0;
}
.menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}
.menu-item:hover { background: #f5f7fa; }
.menu-separator { height: 1px; background: #eee; margin: 6px 0; }

/* Dark mode for menu */
body.dark-mode .menu-dropdown { background: #1a252f; border-color: #2c3e50; }
body.dark-mode .menu-item { color: #e0e0e0; }
body.dark-mode .menu-item:hover { background: #2c3e50; }
body.dark-mode .menu-separator { background: #34495e; }

.toolbar-center {
    flex: 1;
    text-align: center;
}

.app-title {
    font-size: 18px;
    font-weight: 600;
}

/* Search functionality */
.toolbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 20px;
    position: relative;
}

.search-input {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    min-width: 250px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.search-input::placeholder {
    color: rgba(255,255,255,0.7);
}

.search-input:focus {
    outline: none;
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.4);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.1);
}

.search-clear-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.search-clear-btn:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.4);
}

/* Dark mode search styles */
body.dark-mode .search-input {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: #e0e0e0;
}

body.dark-mode .search-input::placeholder {
    color: rgba(255,255,255,0.5);
}

body.dark-mode .search-input:focus {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
}

body.dark-mode .search-clear-btn {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: #e0e0e0;
}

body.dark-mode .search-clear-btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
}

.toolbar-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.lang-label { margin-left: 6px; font-weight: 600; }

.toolbar-btn:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.toolbar-btn:active {
    transform: translateY(0);
}

/* Tools Toolbar */
/* Tools toolbar verwijderd */

.tool-group {
    display: flex;
    gap: 2px;
    padding: 2px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.tool-btn {
    background: transparent;
    border: none;
    color: white;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: all 0.2s ease;
    min-width: 60px;
}

.tool-btn:hover {
    background: rgba(255,255,255,0.1);
}

.tool-btn.active {
    background: #3498db;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.tool-btn:hover {
    background: rgba(255,255,255,0.15);
}

.tool-icon {
    font-size: 16px;
    line-height: 1;
}

/* Undo Dropdown Styles */
.undo-tool-wrapper {
    position: relative;
}

.undo-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 300px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: 4px;
}

.undo-dropdown.show {
    display: block;
}

.undo-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.undo-dropdown-content {
    max-height: 300px;
    overflow-y: auto;
}

.undo-item {
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

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

.undo-item-icon {
    font-size: 14px;
    color: #666;
    min-width: 16px;
}

.undo-item-text {
    flex: 1;
    font-size: 13px;
    color: #333;
}

.undo-item-time {
    font-size: 11px;
    color: #999;
    margin-left: auto;
}

.undo-dropdown-footer {
    padding: 8px 16px;
    border-top: 1px solid #eee;
    background: #f8f9fa;
    text-align: center;
    font-size: 12px;
    color: #666;
}

/* Dark mode voor undo dropdown */
body.dark-mode .undo-dropdown {
    background: #1a252f;
    border-color: #2c3e50;
}

body.dark-mode .undo-dropdown-header {
    background: #2c3e50;
    border-bottom-color: #34495e;
    color: #e0e0e0;
}

body.dark-mode .undo-item {
    border-bottom-color: #34495e;
    color: #e0e0e0;
}

body.dark-mode .undo-item:hover {
    background: #2c3e50;
}

body.dark-mode .undo-item-text {
    color: #e0e0e0;
}

body.dark-mode .undo-item-time {
    color: #a0a0a0;
}

body.dark-mode .undo-dropdown-footer {
    background: #2c3e50;
    border-top-color: #34495e;
    color: #a0a0a0;
}

/* Context Menu Styles */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 10000;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
}

.context-menu.show {
    display: block;
}

.context-menu-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    gap: 8px;
}

.context-menu-item:hover:not(.disabled) {
    background: #f8f9fa;
}

.context-menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.context-menu-icon {
    font-size: 16px;
    min-width: 20px;
    text-align: center;
}

.context-menu-text {
    flex: 1;
    color: #333;
}

.context-menu-shortcut {
    font-size: 12px;
    color: #999;
    font-family: monospace;
}

.context-menu-separator {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}

/* Paste Special Dialog */
.paste-special-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.paste-special-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    min-width: 300px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.paste-special-content h3 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 18px;
}

.paste-options {
    margin-bottom: 20px;
}

.paste-options label {
    display: block;
    padding: 8px 0;
    cursor: pointer;
    color: #333;
}

.paste-options input[type="radio"] {
    margin-right: 8px;
}

.paste-special-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.paste-special-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.paste-special-btn:hover {
    background: #f8f9fa;
}

.paste-special-btn.primary {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.paste-special-btn.primary:hover {
    background: #2980b9;
}

/* Dark mode voor context menu */
body.dark-mode .context-menu {
    background: #2c3e50;
    border-color: #34495e;
}

body.dark-mode .context-menu-item {
    color: #e0e0e0;
}

body.dark-mode .context-menu-item:hover:not(.disabled) {
    background: #34495e;
}

body.dark-mode .context-menu-text {
    color: #e0e0e0;
}

body.dark-mode .context-menu-shortcut {
    color: #a0a0a0;
}

body.dark-mode .context-menu-separator {
    background: #34495e;
}

body.dark-mode .paste-special-content {
    background: #2c3e50;
    color: #e0e0e0;
}

body.dark-mode .paste-special-content h3 {
    color: #e0e0e0;
}

body.dark-mode .paste-options label {
    color: #e0e0e0;
}

body.dark-mode .paste-special-btn {
    background: #34495e;
    border-color: #4a5568;
    color: #e0e0e0;
}

body.dark-mode .paste-special-btn:hover {
    background: #4a5568;
}

body.dark-mode .paste-special-btn.primary {
    background: #3498db;
    border-color: #3498db;
    color: white;
}

/* Relationships List Styles */
.relationships-list {
    max-height: 200px;
    overflow-y: auto;
}

.no-relationships {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 10px;
}

.relationship-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    gap: 8px;
}

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

.relationship-direction {
    font-size: 16px;
    color: #666;
    min-width: 20px;
    text-align: center;
}

.relationship-info {
    flex: 1;
    min-width: 0;
}

.relationship-type {
    font-weight: 600;
    color: #333;
    font-size: 13px;
    margin-bottom: 2px;
}

.relationship-target {
    color: #666;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.relationship-actions {
    display: flex;
    gap: 4px;
}

.relationship-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    font-size: 12px;
    transition: background-color 0.2s;
}

.relationship-btn:hover {
    background: #e9ecef;
}

.relationship-btn.danger:hover {
    background: #f8d7da;
}

/* Dark mode voor relationships */
body.dark-mode .relationship-item {
    border-color: #4a5568;
    color: #e0e0e0;
}

body.dark-mode .relationship-item:hover {
    background: #34495e;
}

body.dark-mode .relationship-type {
    color: #e0e0e0;
}

body.dark-mode .relationship-target {
    color: #a0a0a0;
}

body.dark-mode .relationship-btn:hover {
    background: #4a5568;
}

body.dark-mode .relationship-btn.danger:hover {
    background: #742a2a;
}

.tool-label {
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
}

/* Main Container */
.main-container {
    display: flex;
    height: calc(100vh - 110px);
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    min-height: 400px; /* Zorg ervoor dat sidebar altijd zichtbaar is */
}

.left-sidebar {
    display: flex !important; /* Forceer zichtbaarheid */
    visibility: visible !important;
    opacity: 1 !important;
}

.right-sidebar {
    border-right: none;
    border-left: 1px solid #e0e0e0;
    box-shadow: -2px 0 4px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 6px 12px;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    min-height: 41px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
    padding: 0px 12px;
    line-height: 1.2;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* Sidebar collapsed state */
.sidebar.collapsed {
    width: 50px;
    min-width: 50px;
}

.sidebar.collapsed .sidebar-content {
    display: none;
}

.sidebar.collapsed .sidebar-header h3 {
    display: none;
}

.sidebar.collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

/* Dark mode sidebar toggle */
body.dark-mode .sidebar-toggle {
    color: #a0a0a0;
}

body.dark-mode .sidebar-toggle:hover {
    background-color: #34495e;
    color: #e0e0e0;
}

/* Dark mode sidebar headers */
body.dark-mode .sidebar-header h3 {
    color: #e0e0e0;
}

/* Navigation buttons styling */
.sidebar-header button {
    padding: 6px 12px;
    font-size: 14px;
    min-height: 24px;
    line-height: 1.2;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: #555;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.sidebar-header button:hover {
    background: linear-gradient(135deg, #f0f0f0 0%, #e8e9ea 100%);
    border-color: #d0d0d0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.sidebar-header button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Element Categories */
.element-category {
    margin-bottom: 24px;
}

.element-category h4 {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    margin-bottom: 12px;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
}

.element-subcategory {
    margin-bottom: 15px;
    padding-left: 10px;
}

.element-subcategory h5 {
    font-size: 12px;
    font-weight: 500;
    color: #888;
    margin-bottom: 8px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 3px;
    border-left: 3px solid #4a90e2;
}

.element-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 4px;
    padding-left: 5px;
    max-width: 100%;
    overflow-x: hidden;
}

.element-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    margin-bottom: 2px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-size: 11px;
    min-width: 0;
    overflow: hidden;
}

.element-item:hover {
    background: #f0f8ff;
    border-color: #4a90e2;
}

.element-item:active {
    background: #e3f2fd;
    transform: translateY(1px);
}

.element-item[draggable="true"] {
    cursor: grab;
}

.element-item[draggable="true"]:active {
    cursor: grabbing;
}

.element-item.active {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.element-item.active .element-icon {
    background: white;
}

.element-item.active .element-icon::before {
    background: #4a90e2;
}

.element-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border-radius: 3px;
    background: #4a90e2;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: white;
    flex-shrink: 0;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    position: relative;
    background: #fafafa;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* View Tabs */
.view-tabs-container {
    display: flex;
    align-items: center;
    background: var(--sidebar-background);
    border-bottom: 1px solid var(--border-color);
    height: 40px;
    min-height: 40px;
    position: relative;
}

.view-tabs {
    display: flex;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.view-tabs::-webkit-scrollbar {
    height: 4px;
}

.view-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.view-tabs::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.view-tab {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e9ecef;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    margin-right: 6px;
    cursor: pointer;
    white-space: nowrap;
    min-width: 120px;
    max-width: 200px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.view-tab:hover {
    background: linear-gradient(135deg, #f0f0f0 0%, #e8e9ea 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-color: #d0d0d0;
}

.view-tab.active {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1976d2;
    border-color: #1976d2;
    border-bottom: 4px solid #1976d2;
    z-index: 2;
    box-shadow: 0 -4px 20px rgba(25, 118, 210, 0.25);
    font-weight: 600;
    transform: translateY(-2px);
    position: relative;
}

.view-tab-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.view-tab-close {
    margin-left: 8px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-color);
    opacity: 0.6;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.view-tab-close:hover {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
    transform: scale(1.1);
}

.view-tab-close-all {
    padding: 8px 12px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-color);
    transition: all 0.2s ease;
    margin-right: 8px;
}

.view-tab-close-all:hover {
    background: var(--hover-color);
}

/* Canvas area */
.canvas-container > canvas {
    flex: 1;
    width: 100% !important;
    height: 100% !important;
}

/* Canvas full width when right sidebar is collapsed */
.main-container .right-sidebar.collapsed + .canvas-container {
    margin-right: 0;
    flex: 1;
    width: calc(100vw - 320px - 50px); /* Full width minus left sidebar and collapsed right sidebar */
}

/* Canvas full width when left sidebar is collapsed */
.main-container .left-sidebar.collapsed ~ .canvas-container {
    margin-left: 0;
    flex: 1;
    width: calc(100vw - 50px - 320px); /* Full width minus collapsed left sidebar and right sidebar */
}

/* Canvas full width when both sidebars are collapsed */
.main-container .left-sidebar.collapsed .right-sidebar.collapsed ~ .canvas-container,
.main-container .right-sidebar.collapsed .left-sidebar.collapsed ~ .canvas-container {
    margin: 0;
    flex: 1;
    width: calc(100vw - 50px - 50px); /* Full width minus both collapsed sidebars */
}

/* Canvas full width when no sidebars are collapsed */
.main-container .canvas-container {
    flex: 1;
    width: calc(100vw - 320px - 320px); /* Full width minus both sidebars */
}

/* Canvas width classes for different sidebar states */
.canvas-container.left-collapsed {
    width: calc(100vw - 50px - 320px) !important; /* Left collapsed, right open */
}

.canvas-container.right-collapsed {
    width: calc(100vw - 320px - 50px) !important; /* Left open, right collapsed */
}

.canvas-container.both-collapsed {
    width: calc(100vw - 50px - 50px) !important; /* Both collapsed */
}

#archimateCanvas {
    display: block;
    background: white;
    cursor: crosshair;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
    transition: border 0.2s ease, background-color 0.2s ease;
}

/* Resize cursor styles */
#archimateCanvas.nw-resize {
    cursor: nw-resize;
}

#archimateCanvas.ne-resize {
    cursor: ne-resize;
}

#archimateCanvas.ns-resize {
    cursor: ns-resize;
}

#archimateCanvas.ew-resize {
    cursor: ew-resize;
}

.canvas-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    pointer-events: none;
}

.status-bar {
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

/* Info / Version Modal */
.info-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.info-modal-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 520px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
}

.info-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #2c3e50;
    color: white;
}

.info-modal-body {
    padding: 16px;
    color: #333;
    background: #fff;
}

.info-modal-body table {
    width: 100%;
    border-collapse: collapse;
}

.info-modal-body th, .info-modal-body td {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.info-modal-footer {
    padding: 12px 16px;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
}

.info-modal-ok, .info-modal-close {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.info-modal-close {
    background: transparent;
    color: white;
    padding: 4px 8px;
}

/* Dark mode styles for modal */
body.dark-mode .info-modal-content { background: #1a252f; color: #e0e0e0; }
body.dark-mode .info-modal-body { background: #1a252f; color: #e0e0e0; }
body.dark-mode .info-modal-footer { background: #2c3e50; }
body.dark-mode .info-modal-body th, body.dark-mode .info-modal-body td { border-bottom-color: #34495e; }

/* Relationship Toolbar */
.relationship-toolbar {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.relationship-toolbar h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.relationship-instructions {
    margin-bottom: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid #4a90e2;
}

.relationship-instructions p {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.relationship-instructions p:last-child {
    margin-bottom: 0;
}

.relationship-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.relationship-btn:hover {
    background: #e8f4fd;
    border-color: #4a90e2;
}

.relationship-btn.active {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

/* Relationship Dialog */
.relationship-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.relationship-dialog-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: dialogSlideIn 0.3s ease-out;
}

@keyframes dialogSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.relationship-dialog-content h3 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
}

.relationship-dialog-content p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
    text-align: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #4a90e2;
}

.relationship-categories {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.relationship-category {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.relationship-category h4 {
    margin: 0;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid #e9ecef;
}

.relationship-options {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.relationship-option {
    padding: 16px;
    background: white;
    border: none;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 16px;
}

.relationship-option:last-child {
    border-bottom: none;
}

.relationship-option:hover {
    background: #f8f9fa;
    transform: translateX(4px);
}

.relationship-option:active {
    background: #e8f4fd;
    border-color: #4a90e2;
}

.relationship-visual {
    flex-shrink: 0;
    font-family: monospace;
    font-size: 16px;
    font-weight: bold;
    min-width: 80px;
    text-align: center;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.relationship-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.relationship-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.relationship-desc {
    color: #666;
    font-size: 12px;
    line-height: 1.4;
}

.relationship-line {
    font-family: monospace;
    font-weight: bold;
    display: inline-block;
    white-space: nowrap;
}

.dialog-actions {
    display: flex;
    justify-content: center;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.relationship-cancel {
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.relationship-cancel:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.relationship-cancel:active {
    transform: translateY(0);
}

/* Element Creation Dialog */
.element-creation-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.element-creation-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.element-creation-content h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    text-align: center;
}

.element-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.element-categories .element-category {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.element-categories h4 {
    margin: 0 0 12px 0;
    color: #495057;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.element-categories button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    text-align: left;
    transition: all 0.2s ease;
}

.element-categories button:hover {
    background: #e8f4fd;
    border-color: #4a90e2;
}

.cancel-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
}

.cancel-btn:hover {
    background: #5a6268;
}

/* Properties Panel */
#propertiesPanel {
    padding: 16px;
    border-top: 1px solid #e0e0e0;
}



.property-group {
    margin-bottom: 20px;
}

.property-group h5 {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.property-item {
    margin-bottom: 12px;
}

.property-label {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
    color: #555;
    font-size: 13px;
}

.property-value {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s ease;
}

.property-value:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

.property-value:disabled {
    background: #f8f9fa;
    color: #6c757d;
}

.property-color {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-preview {
    width: 24px;
    height: 24px;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-preview:hover {
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

.property-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.property-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.property-btn:hover {
    background: #f8f9fa;
    border-color: #4a90e2;
}

.property-btn.primary {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.property-btn.primary:hover {
    background: #357abd;
}

.property-btn.danger {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

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

.element-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 16px;
}

.element-preview-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
}

.element-preview-info h6 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.element-preview-info span {
    font-size: 12px;
    color: #666;
}

.no-selection {
    color: #999;
    font-style: italic;
    text-align: center;
    margin-top: 20px;
    padding: 20px;
}

.no-selection-icon {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 12px;
}

/* Scrollbar styling */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive design */
@media (max-width: 1200px) {
    .sidebar {
        width: 280px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }
    
    .toolbar {
        padding: 6px 12px;
    }
    
    .toolbar-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
}

/* Model Navigator Styles */
.nav-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.nav-tab {
    flex: 1;
    padding: 8px 12px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.nav-tab:hover {
    background-color: var(--hover-color);
}

.nav-tab.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 500;
}

.nav-tab-content {
    display: none;
}

.nav-tab-content.active {
    display: block;
}

/* Model Info Styles */
.no-model {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

.no-model-icon {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.load-model-btn {
    margin-top: 10px;
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.load-model-btn:hover {
    background-color: var(--primary-hover);
}

.model-header {
    padding: 10px;
    margin-bottom: 10px;
}

.model-header h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
}

.model-header p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

.model-stats {
    padding: 10px;
    background-color: var(--bg-secondary);
    border-radius: 4px;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 12px;
}

.stat-item:last-child {
    margin-bottom: 0;
}

.stat-label {
    color: var(--text-muted);
}

.stat-value {
    font-weight: 500;
    color: var(--text-color);
}

.model-views,
.model-folders {
    margin-bottom: 15px;
}

.model-views h5,
.model-folders h5 {
    margin: 0 0 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.views-list,
.folders-list {
    height: 100%;
    overflow-y: auto;
}

.view-item,
.folder-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    margin-bottom: 2px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 12px;
}
.folder-item.active { 
    background-color: var(--hover-color); 
    color: var(--text-color);
}
.folder-children .view-item { margin-left: 0; }

.view-item:hover,
.folder-item:hover {
    background-color: var(--hover-color);
}

.view-item.active {
    background-color: var(--primary-color);
    color: var(--text-color);
}

.view-icon,
.folder-icon {
    margin-right: 8px;
    font-size: 14px;
}

.view-info {
    flex: 1;
}

.view-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.view-type {
    font-size: 10px;
    opacity: 0.7;
    text-transform: uppercase;
}

.folder-name {
    font-weight: 500;
}

/* Tree View Styling */
.tree-node {
    position: relative;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 4px 10px;
    margin-bottom: 1px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    min-height: 24px;
    border: 1px solid transparent;
}

.tree-item:hover {
    background-color: rgba(52, 152, 219, 0.1);
    border-color: rgba(52, 152, 219, 0.3);
    transform: translateX(2px);
}

.tree-item.active {
    background-color: var(--primary-color);
    color: var(--text-color);
    font-weight: bold;
    border-left: 3px solid var(--accent-color);
    padding-left: 5px;
}

.tree-indent {
    flex-shrink: 0;
    min-width: 6px; /* Verminderd van 12px naar 6px voor nog minder verspringing */
}

.tree-toggle {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    margin-right: 4px;
    color: var(--text-color);
    transition: color 0.2s ease;
    font-weight: bold;
}

.tree-toggle:hover {
    color: var(--text-color);
}

.tree-icon {
    flex-shrink: 0;
    margin-right: 6px;
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.tree-label {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-children {
    margin-left: 0;
    border-left: 2px solid var(--border-color);
    margin-left: 4px; /* Verminderd van 6px naar 4px */
    padding-left: 4px; /* Verminderd van 6px naar 4px */
    display: block;
}

.tree-children.collapsed {
    display: none;
}

.tree-children .tree-node:last-child {
    border-left: none;
}

.tree-children .tree-node:last-child::before {
    content: '';
    position: absolute;
    left: -11px;
    top: 0;
    bottom: 50%;
    width: 1px;
    background-color: var(--border-color);
}

/* Model separator styling */
.tree-item[data-model-root="true"] {
    margin-bottom: 0px;
    border-bottom: 3px solid var(--border-color);
    background-color: var(--bg-secondary);
    border-radius: 4px;
    padding: 0px 12px 0px 12px;
}

/* Add spacing and line above model names (except first model) */
.tree-item[data-model-root="true"]:not(:first-child) {
    margin-top: 16px;
    border-top: 2px solid var(--border-color);
    padding-top: 8px;
}

.tree-item[data-model-root="true"]:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

/* Model Footer Layout */
.model-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    background: var(--background-color);
}

.model-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
}

.stat-label {
    font-weight: 500;
}

.stat-value {
    font-weight: bold;
    color: var(--text-color);
}

.model-description {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    padding: 8px 0;
}

.model-description p {
    margin: 0;
}

/* Model Structure Layout */
.model-structure {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.model-header {
    margin-bottom: 16px;
    padding-bottom: 8px;
}

.model-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
    color: var(--text-color);
}

.model-folders {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
}

/* Dark mode tree adjustments */
.dark-mode .tree-toggle {
    color: var(--text-muted);
}

.dark-mode .tree-toggle:hover {
    color: var(--text-color);
}

.dark-mode .tree-children {
    border-left-color: var(--border-color);
}

.dark-mode .tree-children .tree-node:last-child::before {
    background-color: var(--border-color);
}

/* Dark mode adjustments */
.dark-mode .nav-tab {
    color: var(--text-color);
}

.dark-mode .nav-tab.active {
    color: var(--primary-color);
}

.dark-mode .model-stats {
    background-color: var(--bg-secondary);
}

.dark-mode .view-item.active {
    background-color: var(--primary-color);
}

/* Dark mode view tab styling */
.dark-mode .view-tab {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-color);
}

.dark-mode .view-tab:hover {
    background: var(--hover-color);
}

.dark-mode .view-tab.active {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5aa0 100%);
    color: #64b5f6;
    border-color: #64b5f6;
    border-bottom: 3px solid #64b5f6;
    box-shadow: 0 -4px 16px rgba(100, 181, 246, 0.3);
    font-weight: 600;
    transform: translateY(-2px);
    position: relative;
}

.dark-mode .view-tab-close {
    color: var(--text-color);
}

.dark-mode .view-tab-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.dark-mode .view-tab-close-all {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-color);
}

.dark-mode .view-tab-close-all:hover {
    background: var(--hover-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .nav-tabs {
        flex-direction: column;
    }
    
    .nav-tab {
        border-bottom: none;
        border-right: 2px solid transparent;
        text-align: left;
    }
    
    .nav-tab.active {
        border-right-color: var(--primary-color);
        border-bottom-color: transparent;
    }
}
