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

/* centralize sidebar sizing so both sidebars are identical */
:root {
    --sidebar-width: 320px;
}

body {
    background-color: #0e0f12;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    color: #ffffff;
}

header {
    background-color: #1a1b1e;
    padding: 15px 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 20px;
    font-weight: 600;
}
/* Logo sizing for header */
.site-logo { height:28px; display:block }

.controls {
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 14px;
}

.zoom-info {
    background-color: #2a2b2e;
    padding: 5px 12px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Percentage-based 3-column layout: 20% / 60% / 20% */
#canvas-container {
    flex: 0 0 60%;
    max-width: 60%;
    min-width: 60%;
    overflow: hidden;
    /* subtle vertical grey gradient behind the graphics render */
    background: linear-gradient(0deg, #1f1d1d 0%, #000000 100%);
    cursor: grab;
    position: relative;
}

#canvas-container.grabbing {
    cursor: grabbing;
}

#display-canvas {
    display: block;
    background-color: #000;
    border: 1px solid #444;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#selection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    cursor: default;
    pointer-events: auto;
}


    /* Right sidebar for config/add elements */
    #config-panel {
        flex: 0 0 20%;
        max-width: 20%;
        min-width: 20%;
        background-color: #1a1b1e;
        border-left: 1px solid #333;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
/* Sidebar styles */
#sidebar {
    flex: 0 0 20%;
    max-width: 20%;
    min-width: 20%;
    background-color: #1a1b1e;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #333;
    font-weight: 600;
    font-size: 14px;
}

.sidebar-tabs {
    display: flex;
    gap: 6px;
    padding: 10px;
    border-bottom: 1px solid #333;
    background: #141516;
    align-items: center;
}

.sidebar-tab {
    background: transparent;
    color: #bbb;
    border: 1px solid transparent;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.sidebar-tab.active {
    background: #1a1b1e;
    color: #fff;
    border-color: #333;
}

#elements-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.element-item {
    padding: 10px;
    margin-bottom: 5px;
    background-color: #2a2b2e;
    border: 1px solid #333;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.element-item:hover {
    background-color: #353639;
}

.element-item.selected {
    background-color: #1a7fff;
    border-color: #0066ff;
}

.element-item-content {
    flex: 1;
}

.element-item-header {
    font-weight: 600;
    font-size: 12px;
    color: #bbb;
}

.element-item-details {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}

.element-item-delete {
    background-color: #7f2a2a;
    border: 1px solid #662222;
    color: #fff;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
    margin-left: 10px;
    display: none;
}

.element-item.selected .element-item-delete {
    display: block;
}

.element-item-delete:hover {
    background-color: #992a2a;
}

.element-item-delete:active {
    background-color: #662222;
}
.empty-placeholder {
    padding: 20px;
    color: #aaa;
    font-size: 13px;
    text-align: center;
    border: 1px dashed #333;
    border-radius: 6px;
    margin: 8px;
    background: transparent;
}

/* Drag-and-drop reordering visuals */
.floating-item {
    position: absolute;
    pointer-events: none;
    opacity: 0.95;
    transform: translate(-8px, -8px);
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

/* insertion-line removed: no visual indicator required */

/* Config panel styles */
#config-panel {
    background-color: #1a1b1e;
    border-top: 1px solid #333;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100px;
}


    .element-menu-tabs {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 10px;
        border-bottom: 1px solid #333;
        background: #141516;
        flex-shrink: 0;
}

.element-menu-tab {
    background: transparent;
    color: #bbb;
    border: 1px solid transparent;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.element-menu-tab.active {
    background: #1a1b1e;
    color: #fff;
    border-color: #333;
}

#add-element-content {
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex: 1;
}

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

.config-label {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 5px;
    display: block;
    font-weight: 600;
}

.config-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

/* Preview group for uploaded/processed images: stacked, left-aligned */
.config-preview-group {
    display: block;
    margin-bottom: 10px;
}

.config-preview-group .preview-filename {
    font-size: 12px;
    color: #cfd8e3;
    margin-bottom: 6px;
    text-align: left;
}

.config-preview-group img,
.config-preview-group canvas {
    display: block;
    margin: 0 0 8px 0; /* left aligned, stacked */
    max-width: 100%;
    max-height: 140px;
    border-radius: 6px;
    background: #021018;
}

.config-input {
    flex: 1;
    background-color: #2a2b2e;
    border: 1px solid #444;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.config-input:focus {
    outline: none;
    border-color: #0066ff;
    background-color: #333;
}

.config-input-small {
    width: 80px;
}

.config-checkbox-group {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    align-items: center;
}

.config-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #ccc;
    cursor: pointer;
}

.config-color-checkbox-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.config-color-checkbox-group input[type="color"] {
    width: 50px;
    height: 30px;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
}

.config-color-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #ccc;
    cursor: pointer;
    flex: 1;
    user-select: none;
}

.config-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.color-picker-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

#color-input {
    width: 50px;
    height: 35px;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
}

.config-button-group {
    display: flex;
    gap: 10px;
}

.config-btn {
    flex: 1;
    padding: 8px 12px;
    background-color: #2a2b2e;
    color: #fff;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

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

.config-btn.delete {
    background-color: #7f2a2a;
    border-color: #662222;
}
.config-btn.compact-btn {
    flex: 0 0 auto; /* don't grow */
    padding: 6px 8px;
    min-width: 36px;
    height: 32px;
}
.element-btn:active {
    background-color: #1a7fff;
    border-color: #0066ff;
}

/* Add-element menu: two rounded square buttons per row, square size follows container width */
#static-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
    padding: 6px 0;
}

.element-btn {
    width: 100%;
    aspect-ratio: 1 / 1; /* keep square */
    border-radius: 10px;
    background: linear-gradient(180deg, #242526 0%, #1a1b1e 100%);
    border: 1px solid #333;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* label sits at the bottom */
    align-items: center;
    padding-bottom: 10px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.element-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
}

/* label at bottom; if you want different sizing you can add a span inside the button */
/* keep the button's inner text at the bottom via flexbox; no ::after label needed */

#config-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
}

/* empty-config placeholder removed; add-element area now fills the sidebar */

/* Logo button reset (image wrapped in a button) */
.logo-button {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
.logo-button:focus { outline: 2px solid #0066ff; outline-offset: 2px; }

/* Confirm modal styles */
.confirm-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
}
.confirm-modal[hidden] { display: none; }
.confirm-modal__box {
    background: #111214;
    border: 1px solid #333;
    padding: 20px;
    width: 90%;
    max-width: 420px;
    border-radius: 8px;
    text-align: center;
    color: #fff;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.confirm-modal__box h2 { margin-bottom: 8px; font-size: 18px; }
.confirm-modal__box p { margin-bottom: 16px; color: #cfcfd2; }
.confirm-modal__actions { display:flex; gap:12px; justify-content:center; }
.confirm-btn {
    padding: 8px 14px;
    background: #1a7fff;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    border: 1px solid #0066ff;
    font-weight: 700;
}
.confirm-btn.cancel {
    background: transparent;
    border: 1px solid #444;
    color: #fff;
}
.confirm-btn:focus { outline: 2px solid #0066ff; outline-offset: 2px; }
