/* Framework */
[v-cloak] {
    display: none !important;
}

/* Theme variables */
:root {
    --accent: #42b983;
    --danger: #e74c3c;
    --border: #ccc;
    --bg-muted: #f5f5f5;
}

/* Base */
html,
body {
    font-family: Arial, sans-serif;
    height: 100%;
    margin: 0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Typography */
h1 {
    margin-top: 0;
    color: var(--accent);
}

/* Layout */
#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 40px;
}

.main-vis-container {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

/* UI primitives */
button {
    padding: 6px 12px;
    font-size: 16px;
    margin-left: 5px;
    cursor: pointer;
}

button:disabled {
    opacity: 0.5;
    pointer-events: none;
}

input {
    padding: 6px;
    font-size: 16px;
}

#new-key-input {
    margin-top: 10px;
    margin-bottom: 10px;
}

/* Header */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-bar label {
    font-size: 14px;
    display: flex;
    align-items: center;
}

.header-bar input {
    margin-right: 5px;
}

/* Controls */
.controls {
    margin-bottom: 20px;
}

/* Tabs */
.heap-tabs {
    margin-bottom: 10px;
}

.tab-btn {
    margin-right: 5px;
    border: 1px solid var(--border);
    background: var(--bg-muted);
}

.tab-btn.active {
    background: var(--accent);
    color: white;
}

.tab-btn.merge.selected {
    outline: 3px solid #ff9800;
    background-color: #fff3e0;
}

/* Cytoscape */
#heap-cy {
    flex: 1;
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--border);
}

#lists-cy {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border);
}

/* Status */
.status {
    margin-bottom: 10px;
    font-weight: bold;
    color: #e67e22;
    font-size: 16px;
}

/* Step log */
.step-log {
    padding: 10px;
    border: 1px solid var(--border);
    width: 300px;
    overflow-y: auto;
    background: #f9f9f9;
    font-family: monospace;
    flex-shrink: 0;
}

.step-log h3 {
    margin-top: 0;
    margin-bottom: 5px;
    color: var(--accent);
}

/* Modal */
.modal {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgb(0 0 0 / 40%);
}

.modal-content {
    background: #fff;
    padding: 20px;
    width: 250px;
    border-radius: 6px;
    text-align: center;
}

#close-modal {
    float: right;
    cursor: pointer;
}

.operation {
    margin-bottom: 15px;
}

.delete-btn {
    background-color: var(--danger);
    color: #fff;
    border: none;
}

.delete-btn:hover {
    background-color: #c0392b;
}

/* Drawer */
.drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #f0f0f0;
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 5px rgb(0 0 0 / 10%);
}

.fix-list-toolbar {
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 14px;
}

.fix-list-toolbar button {
    padding: 4px 8px;
    font-size: 13px;
}

.fix-list-toolbar button.collapsed {
    background-color: #e0e0e0;
    color: #666;
    border-color: #bbb;
}

.drawer-handle {
    height: 8px;
    cursor: ns-resize;
    background: var(--border);
    width: 100%;
    display: none;
}

.drawer.open .drawer-handle {
    display: block;
}

.drawer-toggle {
    width: 100%;
    font-weight: bold;
    background: #ddd;
    border: none;
}

.drawer-content {
    display: flex;
    justify-content: space-around;
    padding: 10px;
    flex-direction: column;
}

.drawer-body {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.gap-control {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.slider-sidebar {
    min-width: 180px;
    padding: 8px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: center;
}

.slider-sidebar .gap-control {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.slider-sidebar label {
    font-size: 14px;
    text-align: center;
}

.vertical-slider-wrapper {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vertical-slider {
    width: 140px;
    transform: rotate(-90deg);
    appearance: none;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, #ddd, #bbb);
    box-shadow: inset 0 0 2px rgb(0 0 0 / 20%);
}

.vertical-slider:focus {
    outline: none;
    box-shadow: 0 0 4px rgb(66 185 131 / 80%);
}

.vertical-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid var(--accent);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgb(0 0 0 / 25%);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.vertical-slider::-webkit-slider-thumb:hover,
.vertical-slider::-webkit-slider-thumb:active {
    transform: scale(1.08);
    box-shadow: 0 3px 8px rgb(0 0 0 / 35%);
}

.vertical-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid var(--accent);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgb(0 0 0 / 25%);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.vertical-slider::-moz-range-thumb:hover,
.vertical-slider::-moz-range-thumb:active {
    transform: scale(1.08);
    box-shadow: 0 3px 8px rgb(0 0 0 / 35%);
}

/* Legend */
.legend {
    display: flex;
    flex-direction: column;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.legend-color {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border: 1px solid #000;
}

.legend-color.red {
    background-color: red;
}

.legend-color.green {
    background-color: green;
}

.legend-color.blue {
    background-color: blue;
}