:root {
    --bg-dark: #0b0b0b;
    --panel-bg: #1a1a1a;
    --accent: #3498db;
    --accent-hover: #2980b9;
    --text: #e0e0e0;
    --danger: #e74c3c;
    --border: #333;
}

* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    background: var(--bg-dark);
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

#app-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* SIDEBAR */

#sidebar {
    width: 320px;
    background: var(--panel-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    gap: 15px;
}

h2 {
    font-size: 11px;
    letter-spacing: 1px;
    color: #888;
    margin: 0 0 10px 0;
    text-transform: uppercase;
}

.panel-section {
    border-bottom: 1px solid #222;
    padding-bottom: 10px;
}

/* Inputs */

.input-group {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

input[type="text"] {
    flex: 1;
    background: #222;
    border: 1px solid var(--border);
    color: white;
    padding: 8px;
    border-radius: 4px;
}

input[type="file"] {
    flex: 1;
    color: #ccc;
    font-size: 12px;
}

input[type="color"] {
    width: 40px;
    height: 34px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: #222;
    padding: 0;
}

/* Buttons */

button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: 0.15s;
    white-space: nowrap;
}

button:hover {
    background: var(--accent-hover);
}

button.active {
    background: #fff;
    color: #000;
    box-shadow: 0 0 10px rgba(255,255,255,0.3);
}

button.danger {
    background: var(--danger);
}

button.primary {
    background: #2ecc71;
}

button.full-width {
    width: 100%;
}

/* Tools grid (half-width buttons) */

.tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

/* Sliders */

.control-group {
    margin-bottom: 10px;
}

label {
    display: block;
    font-size: 11px;
    margin-bottom: 5px;
    color: #777;
}

input[type="range"] {
    width: 100%;
    cursor: pointer;
}

/* Label list */

#label-list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border);
    padding: 8px;
    border-radius: 4px;
    background: #111;
}

.label-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: #222;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.label-pill:hover {
    background: #2a2a2a;
}

.label-pill.active-pill {
    border-color: var(--accent);
    background: #2a3b4d;
}

.label-pill .edit-btn {
    padding: 4px 6px;
    font-size: 11px;
}

/* MAIN VIEWPORT */

#canvas-container {
    flex: 1;
    position: relative;
    background: radial-gradient(circle, #1a1a1a 1px, transparent 1px);
    background-size: 30px 30px;
    overflow: hidden;
}

canvas {
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    border: 1px solid #333;
    display: block;
}

/* Loader */

#loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #333;
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#loader p {
    margin-top: 12px;
    font-size: 13px;
    color: #ccc;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Scrollbar styling (optional) */

#sidebar::-webkit-scrollbar,
#label-list::-webkit-scrollbar {
    width: 8px;
}

#sidebar::-webkit-scrollbar-thumb,
#label-list::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}
