html { overflow: hidden !important; }
body { margin: 0; }
canvas { width: 100%; height: 100% }

.editor-grab {
    cursor: pointer;
    cursor: hand;
    cursor: -webkit-grab;
    cursor: grab;
}

.editor-grabbing {
    cursor: pointer;
    cursor: hand;
    cursor: -webkit-grabbing;
    cursor: grabbing;
}

.editor-move {
    cursor: move;
    cursor: -webkit-grab;
    cursor: grab;
}

.editor-moving {
    cursor: move;
    cursor: -webkit-grabbing;
    cursor: grabbing;
}

.editor-pointing {
    cursor: pointer;
}

.editor-removing {
    cursor: pointer;
    cursor: no-drop;
}

#container {
    position: relative;
    height: 100%;
}

#dashboard {
    position: absolute;
    top: 0;
    left: 0;
}

#planner-error {
    position: absolute;
    top: 100%;
    left: -8px;
    width: 100%;
}

#editor-enabler, #editor-controls {
    position: absolute;
    left: 0;
    bottom: 0;
}

#editor-help {
    position: absolute;
    right: 0;
    bottom: 80px;
    margin-bottom: 0;
    max-width: 400px;
    max-height: calc(50vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10;
}

/* Prevent help panel from overflowing viewport */
#editor-help > div:not(.is-hidden) {
    max-height: 100%;
    overflow: visible;
}

.editor-mode-hint {
    position: absolute;
    left: 50%;
    top: 72px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    z-index: 12;
}

.editor-mode-hint .icon {
    color: #f0c674;
}

/* AI vehicle table layout */
.ai-spawn-table {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(20, 20, 30, 0.6);
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

.ai-spawn-header, .ai-spawn-row {
    display: grid;
    grid-template-columns: 40px 100px 100px 110px 100px 90px 80px;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 8px;
}

.ai-spawn-header {
    background: linear-gradient(135deg, rgba(255, 136, 0, 0.12) 0%, rgba(255, 136, 0, 0.04) 100%);
    font-size: 0.72rem;
    color: #d5d5d5;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ai-spawn-header .icon {
    margin-right: 6px;
    color: #ffb25f;
}

.ai-spawn-header .ai-col {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.ai-spawn-body {
    background: rgba(10, 10, 15, 0.4);
    padding-right: 4px;
}

.ai-spawn-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-spawn-row:last-child {
    border-bottom: none;
}

.ai-spawn-row-ego .ai-col-index {
    background: rgba(74, 158, 255, 0.25);
    color: #dceaff;
}

.ai-spawn-row-ego {
    background: rgba(74, 158, 255, 0.06);
    border-bottom: 1px solid rgba(74, 158, 255, 0.15);
}

.ai-col-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 136, 0, 0.2);
    border-radius: 6px;
    color: #ff8800;
    font-weight: 700;
}

.ai-spawn-row input.input.is-small {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    padding-left: 6px;
    padding-right: 6px;
    font-size: 0.8rem;
}

.ai-col-station input.input.is-small {
    max-width: 70px;
}

.ai-col-speed input.input.is-small {
    max-width: 70px;
}

.ai-col-change {
    display: flex;
    justify-content: center;
}

.ai-col-actions {
    display: flex;
    justify-content: flex-end;
    padding-right: 4px;
    min-width: 0;
}

.ai-spawn-row .select.is-small select {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #e5e5e5;
    padding-left: 6px;
    padding-right: 22px;
    font-size: 0.8rem;
}

.ai-spawn-row .select:not(.is-multiple):not(.is-loading)::after {
    border-color: #b5b5b5;
}

.ai-spawn-row .checkbox {
    color: #cfcfcf;
    font-size: 0.8rem;
}

.ai-spawn-row .checkbox input {
    margin-right: 0;
}

.ai-spawn-row .button.is-small.is-danger {
    padding: 0 10px;
}

.ai-spawn-card {
    padding: 0;
    background: transparent;
}

#editor-help-path .flex, #editor-help-static-obstacles .flex {
    display: flex;
    flex-direction: row;
}

#editor-clear-options {
    position: absolute;
    bottom: 100%;
    padding-bottom: 0;
    padding-right: 0;
}

#editor-clear-options .button {
    width: 100%;
    margin-right: 0.5rem;
}

#editor-road-box {
    position: absolute;
}

#editor-dynamic-obstacles-box {
    width: 450px;
    position: absolute;
}

#editor-traffic-lights-box {
    width: 450px;
    position: absolute;
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.95) 0%, rgba(20, 20, 30, 0.95) 100%) !important;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

#editor-traffic-lights-box #editor-traffic-light-forms {
    max-height: calc(100vh - 350px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

#editor-vehicle-spawns-box {
    width: 720px;
    position: absolute;
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.95) 0%, rgba(20, 20, 30, 0.95) 100%) !important;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

#editor-vehicle-spawns-box #editor-ai-spawn-forms {
    overflow-y: visible !important;
    overflow-x: hidden !important;
}

#editor-scenario-info {
    position: absolute;
    top: 0;
    right: 0;
    max-width: 50%;
}

#editor-scenario-name {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

#welcome-modal:not(.is-active) {
    display: none !important;
}

#welcome-modal .hero {
    margin: -1.5rem -1.5rem 1.5rem -1.5rem;
}

#welcome-modal a, #planner-error a {
    color: #6697e5 !important;
}

#welcome-modal a:hover, #planner-error a:hover {
    color: #3273dc !important;
}

#scenarios-modal .columns {
    margin-bottom: 0;
}

#scenarios-modal-items {
    flex: 1;
    margin-bottom: -0.75rem;
    overflow-y: scroll;
    overflow-x: hidden;
}

#scenarios-modal-tabs a {
    color: #dbdbdb;
}

#scenarios-modal-tabs a:hover {
    color: #4a4a4a;
}

#scenarios-modal-tabs .is-active a {
    color: #fff;
}

.scenarios-modal-tab {
    height: calc(50vh);
    display: flex;
    flex-direction: column;
}

#scenarios-modal-examples-tab .columns {
    height: 25%;
    margin-top: 0;
    margin-bottom: 0;
}

#scenarios-modal-examples-tab .column:hover {
    cursor: pointer;
    color: #fff;
    text-decoration: underline;
}

#scenarios-modal-examples-tab img {
    float: left;
    height: 100%;
}

#scenarios-modal-examples-tab .name {
    padding-left: 0.75rem;
    padding-bottom: 1.5rem;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.scenario-sort-button {
    cursor: pointer;
}

.scenario-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.scenario-item-name {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scenario-item-name:hover {
    cursor: pointer;
    color: #fff;
    text-decoration: underline;
}

.is-underlined {
    text-decoration: underline;
}

.editor-dynamic-obstacle-form:last-child {
    margin-bottom: 0;
}

.editor-field-center {
    -webkit-box-pack: center !important;
    -ms-flex-pack: center !important;
    justify-content: center !important;
}

#editor-stats {
    position: absolute;
    right: 0;
    bottom: 0;
    min-height: 50px;
}

#editor-stats-sl {
    position: absolute;
    right: 100%;
    top: -8px;
    white-space: nowrap;
}

#cameras {
    position: absolute;
    right: 0;
    bottom: 0;
}

.gui-box {
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.95) 0%, rgba(20, 20, 30, 0.95) 100%);
    padding: 12px;
    margin: 8px;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.gui-box:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.modal-box {
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.98) 0%, rgba(20, 20, 30, 0.98) 100%);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
}

.allow-user-select {
    -webkit-touch-callout: auto !important;
    -webkit-user-select: auto !important;
    -moz-user-select: auto !important;
    -ms-user-select: auto !important;
    user-select: auto !important;
}

#controls {
    position: relative;
    padding: 8px;
    overflow: hidden;
}

#stats {
    padding: 12px 12px 12px 0;
    width: 320px;
    line-height: 1.3;
}

#stats .heading {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #aaa;
    margin-bottom: 4px;
}

#stats .is-size-6 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#stats .units-button {
    cursor: pointer;
}

#config-box {
    position: absolute;
    top: 0;
    right: 0;
}

#show-config-box {
    display: flex;
    justify-content: center;
    align-items: center;
}

#gear {
    display: none;
    position: absolute;
    color: #aaa;
    font-weight: bold;
    font-size: 13px;
    top: 50%;
    margin-top: -8px;
    text-align: center;
    width: 100%;
    margin-left: -8px;
}

#brake, #gas {
    position: absolute;
    border: 63px solid;
    border-radius: 100%;
    width: 200%;
    height: 200%;
    bottom: -50%;
    box-sizing: border-box;
    clip-path: inset(50% 50% 0 50%);
}

#brake {
    left: -50%;
    border-color: red;
}

#gas {
    right: -50%;
    border-color: green;
}

#wheel-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
}

#wheel {
    width: 100px;
    height: 100px;
    mask-image: url('../images/wheel.png');
    mask-size: contain;
    -webkit-mask-image: url('../images/wheel.png');
    -webkit-mask-size: contain;
    background-color: hsl(0, 0%, 86%);
}

#wheel-marker {
    height: 4px;
    width: 3px;
    border-radius: 1px;
    background: #804000;
    position: absolute;
    top: 4px;
    left: 50%;
    margin-left: -1.5px;
}

#wheel-pie {
    height: 100%;
    width: 100%;
    clip-path: inset(0 0 0 50%);
    left: 0;
    position: absolute;
    top: 0;
    box-sizing: border-box;
}

#wheel-pie-left, #wheel-pie-right {
    height: 100%;
    width: 100%;
    border: 3px solid #ff6b35;
    border-radius: 50%;
    clip-path: inset(0 50% 0 0);
    left: 0;
    position: absolute;
    top: 0;
    box-sizing: border-box;
    filter: drop-shadow(0 0 4px rgba(255, 107, 53, 0.5));
}

/* Modern Button Styling */
.button.is-dark.is-outlined.is-inverted {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
    transition: all 0.2s ease;
}

.button.is-dark.is-outlined.is-inverted:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.button.is-dark.is-outlined.is-inverted.is-selected,
.button.is-dark.is-outlined.is-inverted:not(.is-outlined) {
    background: linear-gradient(135deg, #4a9eff 0%, #357abd 100%);
    border-color: #4a9eff;
    color: #fff;
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.4);
}

.button.is-small.is-info {
    background: linear-gradient(135deg, #4a9eff 0%, #357abd 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.3);
    transition: all 0.2s ease;
}

.button.is-small.is-info:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.5);
}

.button.is-small.is-success {
    background: linear-gradient(135deg, #48c774 0%, #3aa85c 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(72, 199, 116, 0.3);
    transition: all 0.2s ease;
}

.button.is-small.is-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(72, 199, 116, 0.5);
}

.button.is-small.is-warning {
    background: linear-gradient(135deg, #ffdd57 0%, #ffd433 100%);
    border: none;
    color: #333;
    box-shadow: 0 2px 8px rgba(255, 221, 87, 0.3);
    transition: all 0.2s ease;
}

.button.is-small.is-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 221, 87, 0.5);
}

.button.is-small.is-danger {
    background: linear-gradient(135deg, #f14668 0%, #dc2c4a 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(241, 70, 104, 0.3);
    transition: all 0.2s ease;
}

.button.is-small.is-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(241, 70, 104, 0.5);
}

.button.is-small.is-link {
    background: linear-gradient(135deg, #7a5fff 0%, #5a3fcc 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(122, 95, 255, 0.3);
    transition: all 0.2s ease;
}

.button.is-small.is-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(122, 95, 255, 0.5);
}

/* Modern Input Styling */
.input.is-small {
    background: rgba(40, 40, 50, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.input.is-small:focus {
    background: rgba(50, 50, 60, 0.9);
    border-color: #4a9eff;
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.2);
    outline: none;
}

.select.is-small select {
    background: rgba(40, 40, 50, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.select.is-small select:focus {
    background: rgba(50, 50, 60, 0.9);
    border-color: #4a9eff;
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.2);
    outline: none;
}

/* Traffic Light Card Styling */
.traffic-light-card {
    background: linear-gradient(135deg, rgba(0, 200, 100, 0.15) 0%, rgba(0, 150, 75, 0.1) 100%) !important;
    border-left: 3px solid #00cc66 !important;
    border-radius: 6px;
    padding: 12px !important;
    margin-bottom: 10px !important;
    transition: all 0.2s ease;
}

.traffic-light-card:hover {
    background: linear-gradient(135deg, rgba(0, 200, 100, 0.2) 0%, rgba(0, 150, 75, 0.15) 100%) !important;
    transform: translateX(2px);
}

/* AI Vehicle Spawn Card Styling */
.ai-spawn-card {
    background: linear-gradient(135deg, rgba(255, 136, 0, 0.15) 0%, rgba(200, 100, 0, 0.1) 100%) !important;
    border-left: 3px solid #ff8800 !important;
    border-radius: 6px;
    padding: 12px !important;
    margin-bottom: 10px !important;
    transition: all 0.2s ease;
}

.ai-spawn-card:hover {
    background: linear-gradient(135deg, rgba(255, 136, 0, 0.2) 0%, rgba(200, 100, 0, 0.15) 100%) !important;
    transform: translateX(2px);
}

/* Ego Vehicle Card Styling */
#editor-ego-spawn-form {
    background: linear-gradient(135deg, rgba(0, 170, 255, 0.15) 0%, rgba(0, 120, 200, 0.1) 100%);
    border-left: 3px solid #00aaff;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

#editor-ego-spawn-form:hover {
    background: linear-gradient(135deg, rgba(0, 170, 255, 0.2) 0%, rgba(0, 120, 200, 0.15) 100%);
    transform: translateX(2px);
}

/* Title Styling */
.title.is-5.has-text-grey-lighter {
    color: #e0e0e0;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Stats Display */
#editor-stats {
    font-size: 0.85rem;
}

#editor-stats .button.is-static {
    background: transparent;
    border: none;
    color: #bbb;
    padding: 4px 8px;
    margin-right: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

#editor-stats .button.is-static:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

#editor-stats b {
    color: #4a9eff;
    font-weight: 600;
}

/* Modern Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(20, 20, 30, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 100, 120, 0.6);
    border-radius: 4px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(120, 120, 140, 0.8);
}

/* Checkbox Styling */
input[type="checkbox"] {
    accent-color: #4a9eff;
    cursor: pointer;
}

input[type="checkbox"]:hover {
    accent-color: #5aaeff;
}

/* Better spacing for form elements */
.field {
    margin-bottom: 0.5rem;
}

.field.has-addons .control:not(:last-child) {
    margin-right: 0;
}

/* Icon improvements */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Smooth transitions for all interactive elements */
.button, .input, .select select, .checkbox {
    transition: all 0.2s ease;
}

/* Better focus states */
.button:focus, .input:focus, .select select:focus {
    outline: none;
}

/* Improved card hover effects */
.traffic-light-card, .ai-spawn-card, #editor-ego-spawn-form {
    transition: all 0.2s ease;
}

/* Better button group styling */
.buttons.has-addons .button:not(:last-child) {
    border-right: none;
}

.buttons.has-addons .button:not(:first-child) {
    border-left: none;
}

.buttons.has-addons .button:hover {
    z-index: 1;
}

/* Improved modal styling */
.modal-content {
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Help panel child elements transitions */
#editor-help > div {
    transition: opacity 0.2s ease;
}

/* Traffic density slider styling */
#editor-traffic-density {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    transition: background 0.2s ease;
}

#editor-traffic-density:hover {
    background: rgba(255, 255, 255, 0.15);
}

#editor-traffic-density::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #ffdd57 0%, #ffd433 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

#editor-traffic-density::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

#editor-traffic-density::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #ffdd57 0%, #ffd433 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

#editor-traffic-density::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}
