* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #1e1e1e;
    color: #e0e0e0;
    overflow: hidden;
    height: 100vh;
}

.container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background-color: #252525;
    border-right: 1px solid #3a3a3a;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.logo {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #3a3a3a;
}

.logo h1 {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 11px;
    color: #666;
}

.subtitle a {
    color: #666;
    text-decoration: underline;
}

.control-section {
    margin-bottom: 15px;
}

.info-section {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #3a3a3a;
}

.info-section h3 {
    font-size: 12px;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 8px;
}

.info-section p {
    font-size: 12px;
    color: #888;
    margin-bottom: 5px;
    word-break: break-word;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 10px 12px;
    background-color: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    text-align: left;
}

.btn.btn-primary {
    font-size: 14px;
    font-weight: bold;
    background-color: #2a2a2a;
}

.btn:hover {
    background-color: #3a3a3a;
}

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

.btn-primary {
    font-weight: bold;
    background-color: #2a2a2a;
}

/* Sub-controls */
.sub-controls {
    margin-top: 8px;
    margin-left: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sub-btn {
    padding: 6px 10px;
    background-color: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    text-align: left;
    transition: all 0.2s;
}

.sub-btn:hover {
    background-color: #4a4a4a;
}

/* Slider Control */
.slider-control {
    margin-top: 8px;
    margin-left: 8px;
    padding: 8px;
    background-color: #3a3a3a;
    border-radius: 3px;
}

.slider-control label {
    display: block;
    font-size: 11px;
    margin-bottom: 6px;
    color: #999;
}

.slider-control input[type="range"] {
    width: 80%;
    cursor: pointer;
}

#sliderValue {
    font-size: 11px;
    color: #999;
    margin-left: 8px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Image and Vectorscope Wrapper */
.image-vectorscope-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background-color: #1a1a1a;
    overflow: hidden;
    height: auto;
    min-height: 0; /* allow flex child to shrink when histogram/legend visible */
    border-bottom: 1px solid #3a3a3a;
    gap: 15px;
    padding: 15px;
}

/* Image Container */
.image-container {
    flex: 1;
    position: relative;
    background-color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
    height: 100%;
}

.placeholder {
    position: absolute;
    text-align: center;
    color: #666;
    font-size: 16px;
    font-weight: bold;
    pointer-events: none;
}

.image-canvas {
    display: none;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

.image-canvas.visible {
    display: block;
}

/* Vectorscope Container */
.vectorscope-container {
    flex-shrink: 0;
    width: 320px;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

#vectorscopeCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Color Palette Container */
.palette-container {
    flex-shrink: 0;
    width: 60px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: center;
}

.palette-swatch {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    border: 2px solid #3a3a3a;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.palette-swatch:hover {
    border-color: #4CAF50;
    transform: scale(1.05);
}

.palette-swatch::after {
    content: attr(data-hex);
    position: absolute;
    font-size: 10px;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 4px 6px;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.palette-swatch:hover::after {
    opacity: 1;
}

/* Histogram Container */
.histogram-container {
    height: 150px;
    background-color: #2a2a2a;
    border-top: 1px solid #3a3a3a;
    padding: 10px;
}

#histogramCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Legend Container */
.legend-container {
    height: 80px;
    background-color: #2a2a2a;
    border-top: 1px solid #3a3a3a;
    padding: 10px;
    width: 60%;
    margin: 0 auto;
    display: block;
}

#legendCanvas {
    height: 100%;
    width: 100%;
    display: block;
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

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

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

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 180px;
        padding: 15px;
    }

    .vectorscope-container {
        max-width: 250px;
        max-height: 250px;
    }
}
