/* ==========================================================================
   Drawing Floating Toolbar — Professional dark theme with animations
   ========================================================================== */

/* ── Main toolbar ──────────────────────────────────────── */
#drawing-toolbar-float {
    display: none;
    z-index: 9200;
    background: rgba(30, 33, 43, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3);
    padding: 4px 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    user-select: none;
    align-items: center;
    gap: 2px;
    flex-direction: row;
    height: var(--drawing-controls-height, 44px);
    min-height: var(--drawing-controls-height, 44px);
    box-sizing: border-box;
    color: #d1d4dc;
    /* Animation */
    opacity: 0;
    transform: translateY(4px) scale(0.97);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}
#drawing-toolbar-float .dt-name,
#drawing-toolbar-float .dt-width-label {
    color: inherit;
}
#drawing-toolbar-float .dt-sep {
    background: rgba(255, 255, 255, 0.1);
}
#drawing-toolbar-float .dt-btn svg {
    color: inherit;
}
#drawing-toolbar-float.dt-visible {
    display: flex;
    opacity: 1;
    transform: none;
    pointer-events: auto;
}
#drawing-toolbar-float.dt-hiding {
    display: flex;
    opacity: 0;
    transform: translateY(4px) scale(0.97);
    pointer-events: none;
}

/* ── Drawing name tag ──────────────────────────────────── */
.dt-name {
    display: none;
}

/* ── Divider (floating toolbar only) ────────────────────── */
#drawing-toolbar-float .dt-sep {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 4px;
    flex-shrink: 0;
}

/* ── Toolbar button — floating toolbar only ─────────────── */
#drawing-toolbar-float .dt-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #b0b4bc;
    padding: 4px 6px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
    position: relative;
    flex-shrink: 0;
    min-width: 28px;
    justify-content: center;
    line-height: 1;
}
#drawing-toolbar-float .dt-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e5e7eb;
}
#drawing-toolbar-float .dt-btn.active {
    background: rgba(41, 98, 255, 0.18);
    color: #29b6f6;
}

/* ── Color swatch circle ───────────────────────────────── */
.dt-color-swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2962FF;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    display: inline-block;
    flex-shrink: 0;
    transition: background 0.15s;
}
#drawing-toolbar-float .dt-btn:hover .dt-color-swatch {
    border-color: rgba(255, 255, 255, 0.35);
}

/* ── Delete button ─────────────────────────────────────── */
#drawing-toolbar-float .dt-btn-del:hover {
    background: rgba(239, 83, 80, 0.15) !important;
    color: #ef5350 !important;
}

/* ── Width label ───────────────────────────────────────── */
.dt-width-label {
    font-size: 11px;
    color: #787b86;
    min-width: 20px;
}

/* ═══════════════════════════════════════════════════════════
   COLOR PICKER PANEL
   ═══════════════════════════════════════════════════════════ */
.dt-color-panel {
    display: none;
    position: fixed;
    z-index: 9400;
    background: rgba(30, 33, 43, 0.96);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    padding: 10px;
    width: 180px;
}
.dt-color-panel.open { display: block; }
.dt-color-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}
.dt-color-opt {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s;
    justify-self: center;
}
.dt-color-opt:hover { transform: scale(1.15); }
.dt-color-opt.dt-active {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(41, 98, 255, 0.5);
}
.dt-color-custom {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.dt-color-custom-label {
    font-size: 11px;
    color: #787b86;
}
.dt-color-custom input[type="color"] {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
}

/* ═══════════════════════════════════════════════════════════
   LINE WIDTH PANEL
   ═══════════════════════════════════════════════════════════ */
.dt-width-panel {
    display: none;
    position: fixed;
    z-index: 9400;
    background: rgba(30, 33, 43, 0.96);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    padding: 4px;
    min-width: 80px;
}
.dt-width-panel.open { display: block; }
.dt-width-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 10px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    color: #b0b4bc;
    font-size: 12px;
    font-family: inherit;
    transition: background 0.1s;
    white-space: nowrap;
}
.dt-width-opt:hover { background: rgba(255, 255, 255, 0.06); }
.dt-width-opt.dt-active {
    background: rgba(41, 98, 255, 0.15);
    color: #29b6f6;
}
.dt-width-line {
    width: 24px;
    border-radius: 2px;
    background: currentColor;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   LINE STYLE PANEL
   ═══════════════════════════════════════════════════════════ */
.dt-style-panel {
    display: none;
    position: fixed;
    z-index: 9400;
    background: rgba(30, 33, 43, 0.96);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    padding: 4px;
    min-width: 100px;
}
.dt-style-panel.open { display: block; }
.dt-style-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 10px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    color: #b0b4bc;
    font-size: 12px;
    font-family: inherit;
    transition: background 0.1s;
    white-space: nowrap;
}
.dt-style-opt:hover { background: rgba(255, 255, 255, 0.06); }
.dt-style-opt.dt-active {
    background: rgba(41, 98, 255, 0.15);
    color: #29b6f6;
}
.dt-style-preview {
    width: 28px;
    height: 2px;
    flex-shrink: 0;
    border-radius: 1px;
}
.dt-style-preview.dt-dashed {
    background: repeating-linear-gradient(
        90deg, currentColor 0, currentColor 8px, transparent 8px, transparent 12px
    );
    height: 2px;
}
.dt-style-preview.dt-dotted {
    background: repeating-linear-gradient(
        90deg, currentColor 0, currentColor 2px, transparent 2px, transparent 6px
    );
    height: 2px;
}

/* ═══════════════════════════════════════════════════════════
   MORE OPTIONS PANEL
   ═══════════════════════════════════════════════════════════ */
.dt-more-panel {
    display: none;
    position: fixed;
    z-index: 9400;
    background: rgba(30, 33, 43, 0.96);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    padding: 4px;
    min-width: 150px;
}
.dt-more-panel.open { display: block; }
.dt-more-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 10px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    color: #b0b4bc;
    font-size: 12px;
    font-family: inherit;
    transition: background 0.1s;
    white-space: nowrap;
}
.dt-more-opt:hover { background: rgba(255, 255, 255, 0.06); }
.dt-more-opt.dt-del:hover {
    background: rgba(239, 83, 80, 0.12);
    color: #ef5350;
}
.dt-more-sep {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 3px 0;
}

#drawing-toolbar-float.dt-docked-top {
    position: static;
    left: auto;
    top: auto;
    right: auto;
    bottom: auto;
    transform: none;
}

/* ═══════════════════════════════════════════════════════════
   INFO LINE / MEASUREMENT PANEL
   ═══════════════════════════════════════════════════════════ */
#info-line-panel {
    display: none;
    position: fixed;
    z-index: 9100;
    background: rgba(30, 33, 43, 0.92);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    padding: 6px 10px;
    color: #d1d4dc;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 11px;
    line-height: 1.55;
    pointer-events: none;
    white-space: nowrap;
    max-width: 280px;
}
#info-line-panel.visible { display: block; }
.il-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.il-label {
    color: #787b86;
    font-weight: 500;
    min-width: 58px;
}
.il-value {
    color: #d1d4dc;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.il-value.positive { color: #26a69a; }
.il-value.negative { color: #ef5350; }
.il-row + .il-row {
    margin-top: 2px;
}

/* ── Legacy popup hide (replaced by #drawing-toolbar-float) ── */
#drawing-popup { display: none !important; }
