/* Native Dark UI Menu Styles */
:root {
    --menu-bg: #2d2d2d;
    --menu-border: #404040;
    --menu-text: #e0e0e0;
    --menu-text-secondary: #a0a0a0;
    --menu-hover: #3d3d3d;
    --menu-active: #4d4d4d;
    --menu-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --menu-radius: 0px;
    --menu-transition: all 0.15s ease;
}

#ui-menu {
    position: absolute;
    top: -32px;
    left: 0;
    width: 100%;
    height: 32px;
    background: var(--menu-bg);
    border-bottom: 1px solid var(--menu-border);
    box-shadow: var(--menu-shadow);
    z-index: 1000;
    transition: var(--menu-transition);
    display: flex;
    align-items: center;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    font-weight: 400;
}

#ui-menu.visible {
    top: 0;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        top: -32px;
        opacity: 0;
    }

    to {
        top: 0;
        opacity: 1;
    }
}

.menu-item {
    position: relative;
    color: var(--menu-text);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--menu-radius);
    transition: var(--menu-transition);
    user-select: none;
    display: flex;
    align-items: center;
    height: 100%;
    box-sizing: border-box;
}

.menu-item:hover {
    background-color: var(--menu-hover);
}

.menu-item.active {
    background-color: var(--menu-active);
}

.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--menu-bg);
    border: 1px solid var(--menu-border);
    border-radius: var(--menu-radius);
    min-width: 140px;
    box-shadow: var(--menu-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: var(--menu-transition);
    z-index: 1001;
    overflow: hidden;
}

.dropdown.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    padding: 6px 16px;
    color: var(--menu-text);
    cursor: pointer;
    transition: var(--menu-transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    white-space: nowrap;
}

.dropdown-item:hover {
    background-color: var(--menu-hover);
}

/* Keyboard shortcuts display */
.dropdown-item .shortcut {
    font-size: 11px;
    color: var(--menu-text-secondary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin-left: 24px;
}

/* Separator */
.dropdown-separator {
    height: 1px;
    background: var(--menu-border);
    margin: 2px 0;
}

/* Left Panel Styles */
#left-panel {
    position: absolute;
    top: 32px;
    /* Below menu bar */
    left: -250px;
    width: 250px;
    height: calc(100vh - 32px);
    background: var(--menu-bg);
    border-right: 1px solid var(--menu-border);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
    z-index: 999;
    transition: var(--menu-transition);
    overflow-y: auto;
    box-sizing: border-box;
}

#left-panel.visible {
    left: 0;
}

.panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--menu-border);
    font-weight: 500;
    color: var(--menu-text);
    background: var(--menu-active);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.game-object-tree {
    padding: 8px 0;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 4px 16px;
    color: var(--menu-text);
    cursor: pointer;
    transition: var(--menu-transition);
    font-size: 13px;
    user-select: none;
    position: relative;
}

.tree-item:hover {
    background-color: var(--menu-hover);
}

.tree-item.selected {
    background-color: #4096ff;
    color: #ffffff;
}

.tree-item.selected .tree-item-type {
    color: rgba(255, 255, 255, 0.8);
}



.tree-item-icon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0.7;
}

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

.tree-item-type {
    font-size: 11px;
    color: var(--menu-text-secondary);
    margin-left: 8px;
}

.tree-children {
    margin-left: 20px;
}

.tree-toggle {
    width: 12px;
    height: 12px;
    margin-right: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--menu-text-secondary);
    transition: var(--menu-transition);
}

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

.tree-toggle.expanded {
    transform: rotate(90deg);
}

.tree-item.has-children .tree-toggle::before {
    content: '▶';
}

.tree-item.leaf .tree-toggle {
    visibility: hidden;
}

/* Inactive tree item styling */
.tree-item.inactive {
    opacity: 0.5;
    font-style: italic;
    cursor: pointer;
    /* Ensure cursor shows it's clickable */
    pointer-events: auto;
    /* Explicitly allow pointer events */
}

.tree-item.inactive .tree-item-icon {
    opacity: 0.6;
}

.tree-item.inactive .tree-item-label {
    text-decoration: line-through;
    color: var(--menu-text-secondary);
}

.tree-item.inactive:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.tree-item.inactive.selected {
    background-color: rgba(64, 150, 255, 0.5);
    border-left: 3px solid #4096ff;
}

/* Right Panel Styles */
#right-panel {
    position: absolute;
    top: 32px;
    /* Below menu bar */
    right: -300px;
    width: 300px;
    height: calc(100vh - 32px);
    background: var(--menu-bg);
    border-left: 1px solid var(--menu-border);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
    z-index: 999;
    transition: var(--menu-transition);
    overflow-y: auto;
    box-sizing: border-box;
}

#right-panel.visible {
    right: 0;
}

.properties-container {
    padding: 8px;
}

.property-group {
    margin-bottom: 12px;
    border: 1px solid var(--menu-border);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.02);
}

.property-group-header {
    padding: 8px 12px;
    background: var(--menu-active);
    border-bottom: 1px solid var(--menu-border);
    font-weight: 500;
    color: var(--menu-text);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.property-group-header:hover {
    background: var(--menu-hover);
}

.property-group-toggle {
    font-size: 10px;
    transition: var(--menu-transition);
}

.property-group-toggle.collapsed {
    transform: rotate(-90deg);
}

.property-group-content {
    padding: 8px 12px;
    display: block;
}

.property-group-content.collapsed {
    display: none;
}

.property-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    gap: 8px;
}

.property-row:last-child {
    margin-bottom: 0;
}

.property-label {
    color: var(--menu-text);
    font-size: 12px;
    min-width: 20px;
    text-align: center;
    font-weight: 500;
}

.property-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--menu-border);
    border-radius: 3px;
    padding: 4px 6px;
    color: var(--menu-text);
    font-size: 11px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

.property-input:focus {
    outline: none;
    border-color: #4096ff;
    background: rgba(64, 150, 255, 0.1);
}

.property-input:hover {
    border-color: var(--menu-text-secondary);
}

.property-vector {
    display: flex;
    gap: 3px;
}

.property-vector .property-input {
    min-width: 0;
    width: 50px;
    font-size: 10px;
    padding: 3px 4px;
}

.property-vector>div {
    flex: 1;
    min-width: 0;
}

.property-vector .property-label {
    font-size: 9px;
}

/* Custom checkbox styling */
.property-input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--menu-border);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    position: relative;
    flex: none;
    margin: 0;
    padding: 0;
    transition: all 0.2s ease;
}

.property-input[type="checkbox"]:hover {
    border-color: var(--menu-text-secondary);
    background: rgba(0, 0, 0, 0.5);
}

.property-input[type="checkbox"]:focus {
    outline: none;
    border-color: #4096ff;
    box-shadow: 0 0 0 2px rgba(64, 150, 255, 0.2);
}

.property-input[type="checkbox"]:checked {
    background: #4096ff;
    border-color: #4096ff;
}

.property-input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
}

.property-input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.property-input[type="checkbox"]:disabled:hover {
    border-color: var(--menu-border);
    background: rgba(0, 0, 0, 0.3);
}

min-width: 10px;
font-weight: 600;
}

.property-color {
    width: 30px;
    height: 20px;
    border: 1px solid var(--menu-border);
    border-radius: 3px;
    cursor: pointer;
    background-size: 10px 10px;
    background-image:
        linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
}

.property-readonly {
    background: rgba(255, 255, 255, 0.05);
    color: var(--menu-text-secondary);
    cursor: not-allowed;
}

.no-selection-message {
    padding: 20px;
    text-align: center;
    color: var(--menu-text-secondary);
    font-style: italic;
    font-size: 13px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #ui-menu {
        height: 28px;
        top: -28px;
    }

    .menu-item {
        padding: 4px 10px;
    }

    .dropdown {
        min-width: 120px;
    }

    #left-panel {
        top: 28px;
        height: calc(100vh - 28px);
        width: 200px;
        left: -200px;
    }

    #right-panel {
        top: 28px;
        height: calc(100vh - 28px);
        width: 250px;
        right: -250px;
    }
}