:root {
    --bg-color: #f5f7fa;
    --sidebar-bg: #ffffff;
    --text-color: #1a3a5f;
    --accent-color: #2b5797;
    --accent-light: rgba(43, 87, 151, 0.1);
    --border-color: #c5d3e8;
    --bid-color: #1e88e5;
    --ask-color: #e53935;
    --price-color: #ff6f00;
    --grid-color: rgba(43, 87, 151, 0.15);
    --grid-color-strong: rgba(43, 87, 151, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Architects Daughter', 'Comic Sans MS', cursive;
    background-color: var(--bg-color);
    /* Graph paper effect */
    background-image:
        linear-gradient(var(--grid-color-strong) 2px, transparent 2px),
        linear-gradient(90deg, var(--grid-color-strong) 2px, transparent 2px),
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
    background-position: -2px -2px, -2px -2px, -1px -1px, -1px -1px;
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 320px;
    min-width: 320px;
    background-color: var(--sidebar-bg);
    border-right: 3px solid var(--accent-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    z-index: 10;
    box-shadow: 5px 0 20px rgba(43, 87, 151, 0.1);
    overflow-y: auto;
}

.logo-area {
    text-align: center;
    padding-bottom: 1rem;
    border-bottom: 2px dashed var(--accent-color);
}

h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-color);
    font-weight: bold;
    letter-spacing: 0.5px;
}

select,
input[type="range"],
input[type="number"],
input[type="datetime-local"] {
    font-family: 'Architects Daughter', cursive;
}

select {
    background: #fff;
    color: var(--text-color);
    border: 2px solid var(--accent-color);
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

select:hover {
    border-color: var(--bid-color);
    box-shadow: 0 2px 8px rgba(43, 87, 151, 0.2);
}

select:focus {
    border-color: var(--bid-color);
    box-shadow: 0 0 0 3px rgba(30, 136, 229, 0.2);
}

input[type="number"],
input[type="datetime-local"] {
    background: #fff;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0.4rem;
    border-radius: 4px;
    outline: none;
    font-size: 0.8rem;
    width: 100%;
}

input[type="number"]:focus,
input[type="datetime-local"]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-light);
}

/* Slider styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, var(--accent-light), var(--accent-color));
    outline: none;
    cursor: pointer;
}

.action-btn {
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 0.8rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Architects Daughter', cursive;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    margin-top: 0.5rem;
}

.action-btn:hover {
    background: var(--bid-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(43, 87, 151, 0.2);
}

.action-btn:active {
    transform: translateY(0);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider-value {
    font-size: 0.75rem;
    color: #666;
    text-align: center;
}

/* Dual range container */
.range-container {
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
    margin: 0.5rem 0;
}

.range-container input[type="range"] {
    position: absolute;
    width: 100%;
    pointer-events: none;
    background: transparent;
}

.range-container input[type="range"]::-webkit-slider-thumb {
    pointer-events: all;
}

.range-values {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.65rem;
    color: #888;
}

.precise-inputs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.input-with-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
}

.input-with-label span {
    font-size: 0.7rem;
    color: #666;
}

/* Stats */
.stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e8f0f8 100%);
    padding: 1rem;
    border-radius: 8px;
    border: 2px dashed var(--accent-color);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.stat-item .label {
    color: #666;
}

.stat-item .value {
    font-weight: 600;
    color: var(--accent-color);
}

/* Legend */
.legend {
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.legend h3 {
    font-size: 0.85rem;
    color: var(--accent-color);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.legend-color {
    width: 24px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.legend-color.bids {
    background: linear-gradient(to right, rgba(30, 136, 229, 0.3), var(--bid-color));
}

.legend-color.asks {
    background: linear-gradient(to right, var(--ask-color), rgba(229, 57, 53, 0.3));
}

.legend-color.price {
    background: var(--price-color);
    height: 4px;
    border-radius: 2px;
}

.legend-color.volume {
    background: #000000;
    height: 4px;
    border-radius: 2px;
}

/* Instructions */
.instructions {
    font-size: 0.75rem;
    color: #666;
    line-height: 1.6;
    background: var(--accent-light);
    padding: 1rem;
    border-radius: 8px;
}

.instructions h3 {
    margin-bottom: 0.5rem;
    color: var(--accent-color);
    font-size: 0.85rem;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    margin-bottom: 0.25rem;
}

/* Chart container */
.chart-container {
    flex: 1;
    position: relative;
    background-color: #fff;
    /* Graph paper for chart area too */
    background-image:
        linear-gradient(var(--grid-color-strong) 2px, transparent 2px),
        linear-gradient(90deg, var(--grid-color-strong) 2px, transparent 2px),
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
    background-position: -2px -2px, -2px -2px, -1px -1px, -1px -1px;
}

#plot-area {
    width: 100%;
    height: 100%;
}

/* Axis labels overlay */
.axis-labels {
    position: absolute;
    bottom: 20px;
    left: 20px;
    pointer-events: none;
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: bold;
}

.axis-label {
    display: block;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: auto;
    padding: 1.5rem;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 8px;
    border: 2px solid var(--bid-color);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(30, 136, 229, 0.2);
    border-top: 3px solid var(--bid-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

#loading-text {
    font-size: 0.85rem;
    color: var(--accent-color);
    text-align: center;
}

/* Hidden state for loading */
.loading.hidden {
    display: none;
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        width: 280px;
        min-width: 280px;
        padding: 1rem;
    }

    h1 {
        font-size: 1.2rem;
    }
}