@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;600;700&family=Share+Tech+Mono&display=swap');

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

:root {
    --bg:       #080B14;
    --surface:  #0f1220;
    --surface2: #171b2e;
    --border:   #252840;
    --accent:   #7027CF;
    --accent2:  #A368FF;
    --indigo:   #2D4FCC;
    --text:     #DDE8FF;
    --muted:    #5a6080;
    --danger:   #e05050;
    --btn24:    #2D4FCC;
    --btn30:    #7027CF;
}

html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: 'Rajdhani', sans-serif; font-size: 14px; }

/* ── APP ── */
.app { display: flex; flex-direction: column; height: 100vh; }
.app__body { display: flex; flex: 1; overflow: hidden; }

/* ── HEADER ── */
.header {
    display: flex; align-items: center; gap: 12px;
    height: 42px; padding: 0 16px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.logo-svg { height: 28px; width: auto; display: block; }
.logo { font-size: 17px; font-weight: 700; letter-spacing: 3px; color: var(--accent2); }
.logo__sub { font-size: 10px; font-weight: 400; letter-spacing: 2px; color: var(--muted); margin-left: 8px; }
.header__spacer { flex: 1; }
.header__tag { font-family: 'Share Tech Mono', monospace; font-size: 11px; color: var(--muted); }

/* ── SIDEBAR ── */
.sidebar {
    width: 18%; min-width: 210px;
    background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0;
}

/* ── CANVAS AREA ── */
.canvas-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.canvas-wrap {
    flex: 1; position: relative; overflow: hidden;
    background: var(--bg);
    background-image: radial-gradient(circle at 1px 1px, #1a1d2e 1px, transparent 0);
    background-size: 24px 24px;
}
#canvas-bg {
position: absolute; top: 0; left: 0;
width: 100%; height: 100%;
display: flex; align-items: center; justify-content: center;
pointer-events: none;
}
#canvas-bg img {
max-width: 90%; max-height: 90%;
object-fit: contain;
opacity: 0.9;
}
#canvas-buttons { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* ── GRID OVERLAY ── */
.grid-active .canvas-wrap {
    background-image:
    linear-gradient(to right, #1e2235 1px, transparent 1px),
    linear-gradient(to bottom, #1e2235 1px, transparent 1px);
    background-size: 20px 20px;
}

/* ── PROPS POPOVER (flottant) ── */
.props-popover {
    position: absolute;
    z-index: 1000;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    min-width: 170px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: none;
}
.props-popover.is-visible {
    display: block;
}
.props-popover__title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--accent2);
    text-transform: uppercase;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    cursor: move;
    user-select: none;
}
.props-popover.is-dragging {
    opacity: 0.9;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}
.props-popover.is-dragging .props-popover__title {
    cursor: grabbing;
}

/* ── TOOLBAR ── */
.toolbar {
    display: flex; align-items: center; gap: 5px;
    height: 38px; padding: 0 10px;
    background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.toolbar__sep { width: 1px; height: 16px; background: var(--border); margin: 0 3px; }
.toolbar__spacer { flex: 1; }

/* ── STATUS BAR ── */
.statusbar {
    display: flex; align-items: center; gap: 16px;
    height: 24px; padding: 0 12px;
    background: var(--surface); border-top: 1px solid var(--border);
    font-family: 'Share Tech Mono', monospace; font-size: 10px; color: var(--muted);
    flex-shrink: 0;
}
.statusbar span { color: var(--accent2); }
.statusbar__spacer { flex: 1; }

/* ── PANEL ROW (Gauche + Droite côte à côte) ── */
.panel-row {
    display: flex;
}
.panel--half {
    flex: 1;
    border-bottom: none;   /* le parent gère la bordure basse */
    min-width: 0;          /* permet le shrink dans flex */
}
.panel--half:first-child {
    border-right: 1px solid var(--border);
}

/* ── PANEL ── */
.panel { border-bottom: 1px solid var(--border); padding: 10px 12px; }
.panel__title { font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--accent2); text-transform: uppercase; text-align: center; margin-bottom: 8px; }

/* ── BUTTONS UI ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    height: 28px; padding: 0 9px;
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--text); font-family: 'Rajdhani', sans-serif;
    font-size: 12px; font-weight: 600; letter-spacing: 0.5px;
    cursor: pointer; transition: border-color .12s, color .12s;
    border-radius: 3px; white-space: nowrap;
}
.btn:hover { border-color: var(--accent2); color: var(--accent2); }
.btn.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.is-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.is-primary:hover { background: var(--accent2); border-color: var(--accent2); }
.btn.is-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.is-disabled { opacity: .3; pointer-events: none; }
.btn--full { width: 100%; }

/* ── FORM ── */
select, input[type="text"] {
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--text); font-family: 'Rajdhani', sans-serif;
    font-size: 12px; padding: 5px 7px; border-radius: 3px; width: 100%; outline: none;
}
select:focus, input[type="text"]:focus { border-color: var(--accent); }
input[type="color"] { width: 100%; height: 26px; border: 1px solid var(--border); border-radius: 3px; cursor: pointer; padding: 2px; background: var(--surface2); }

/* ── PROP ROWS ── */
.prop-row { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.prop-label { font-size: 10px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.hint { font-size: 11px; color: var(--muted); text-align: center; padding: 14px 10px; line-height: 1.6; }
.gap-4 { display: flex; flex-direction: column; gap: 4px; }
.row-5 { display: flex; gap: 5px; }
.mt-6 { margin-top: 6px; }

/* ── LAYOUT LIST ── */
.layout-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 8px; border: 1px solid var(--border); border-radius: 3px;
    background: var(--surface2); cursor: pointer; transition: border-color .12s;
    font-size: 12px; font-weight: 600; margin-bottom: 4px;
}
.layout-item:hover { border-color: var(--accent); }
.layout-item.is-active { border-color: var(--accent); color: var(--accent2); background: #120d1e; }
.layout-item__id { font-size: 10px; color: var(--muted); font-family: 'Share Tech Mono', monospace; }

/* ── BOUTONS CANVAS ── */
.cbutton {
    position: absolute;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: grab;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    overflow: visible;
    font-size: 11px;
    color: #fff;
    border: 2px solid rgba(255,255,255,0.25);
    user-select: none;
    transition: box-shadow .12s, border-color .12s;
    text-align: center;
    line-height: 1.1;
}
.cbutton.size-24 { background: radial-gradient(circle at 35% 35%, #3a60e0, #1a3490); }
.cbutton.size-30 { background: radial-gradient(circle at 35% 35%, #8a3de8, #4a15a0); }
.cbutton.is-selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--accent2), 0 0 16px var(--accent);
    z-index: 100;
    cursor: grabbing;
}
.cbutton:hover { border-color: rgba(255,255,255,0.6); z-index: 50; }
.cbutton.is-dragging { cursor: grabbing; z-index: 200; transition: none; }

/* ── CROIX SUPPRESSION SUR BOUTON ── */
.cbutton__label { pointer-events: none; }
.cbutton__delete {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--danger);
    border: 1.5px solid #ff9090;
    color: #fff;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity .15s, transform .15s;
    z-index: 300;
    padding: 0;
    font-family: sans-serif;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    pointer-events: none;
}
.cbutton.is-selected .cbutton__delete {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}
.cbutton__delete:hover {
    background: #ff2020;
    border-color: #fff;
    transform: scale(1.15) !important;
}

/* ── TAILLE SELECTOR ── */
.size-selector { display: flex; gap: 5px; }
.size-btn {
    flex: 1; height: 28px; border-radius: 3px; border: 1px solid var(--border);
    background: var(--surface2); color: var(--text);
    font-family: 'Rajdhani', sans-serif; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: all .12s;
    display: flex; align-items: center; justify-content: center; gap: 5px;
}
.size-btn .dot { border-radius: 50%; background: currentColor; flex-shrink: 0; }
.size-btn:hover { border-color: var(--accent2); color: var(--accent2); }
.size-btn.is-active { border-color: var(--accent); background: #120d1e; color: var(--accent2); }
