/* css/annotations.css — Annotation sidebar panel */

/* ── Sidebar panel ─────────────────────────────────────────────────────────── */
#annotation-sidebar {
    position: fixed;
    top: 52px;          /* below topbar */
    left: 0;
    width: 220px;
    bottom: 0;
    background: var(--bg);
    border-right: 1px solid var(--border);
    z-index: 850;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 2px 0 8px rgba(0,0,0,0.08);
    transition: transform 0.2s ease;
}

#annotation-sidebar.hidden {
    transform: translateX(-100%);
    pointer-events: none;
}

/* ── Sidebar header ────────────────────────────────────────────────────────── */
.ann-sidebar-header {
    padding: 12px 14px 8px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.ann-sidebar-title {
    font-family: 'DM Serif Display', serif;
    font-size: 13px;
    color: var(--text-1);
    letter-spacing: 0.02em;
    display: block;
    margin-bottom: 2px;
}

.ann-sidebar-hint {
    font-size: 10px;
    color: var(--text-3);
}

/* ── Scrollable content ────────────────────────────────────────────────────── */
.ann-sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 10px 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Section label ─────────────────────────────────────────────────────────── */
.ann-section {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 0 2px 4px;
}

/* ── Tool grid ─────────────────────────────────────────────────────────────── */
.ann-tool-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.ann-tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 7px 3px 6px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    cursor: pointer;
    font-size: 9px;
    color: var(--text-2);
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    line-height: 1.1;
    text-align: center;
}

.ann-tool-btn svg {
    flex-shrink: 0;
}

.ann-tool-btn:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.ann-tool-btn.active {
    background: var(--text-1);
    border-color: var(--text-1);
    color: var(--bg);
}

.ann-tool-btn.active svg {
    stroke: var(--bg);
}

/* ── Divider ───────────────────────────────────────────────────────────────── */
.ann-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
}

/* ── Property controls ─────────────────────────────────────────────────────── */
.ann-prop-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ann-prop-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ann-prop-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-2);
}

.ann-prop-value {
    font-size: 10px;
    color: var(--text-3);
    float: right;
}

/* Color swatches */
.ann-color-row {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
}

.ann-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.1s, transform 0.1s;
    flex-shrink: 0;
}

.ann-swatch:hover {
    transform: scale(1.15);
}

.ann-swatch.active {
    border-color: var(--text-1);
}

.ann-color-custom {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    flex-shrink: 0;
}

.ann-color-custom input[type="color"] {
    width: 28px;
    height: 28px;
    margin: -4px;
    border: none;
    padding: 0;
    cursor: pointer;
    opacity: 0;
    position: absolute;
}

.ann-color-custom-wrap {
    position: relative;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.ann-color-custom-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px dashed var(--border-strong);
    cursor: pointer;
    background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
}

.ann-color-custom-input {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
    border-radius: 50%;
}

/* Sliders */
.ann-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    outline: none;
    cursor: pointer;
}

.ann-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-1);
    cursor: pointer;
}

.ann-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-1);
    cursor: pointer;
    border: none;
}

/* Select */
.ann-select {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface);
    font-size: 11px;
    color: var(--text-1);
    outline: none;
    cursor: pointer;
}

.ann-select:focus {
    border-color: var(--accent);
}

/* Shape type toggle */
.ann-shape-toggle {
    display: flex;
    gap: 4px;
}

.ann-shape-btn {
    flex: 1;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface);
    font-size: 9px;
    color: var(--text-2);
    cursor: pointer;
    text-align: center;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.ann-shape-btn:hover {
    background: var(--surface-2);
}

.ann-shape-btn.active {
    background: var(--text-1);
    border-color: var(--text-1);
    color: var(--bg);
}

/* Unit toggle (ruler) */
.ann-unit-toggle {
    display: flex;
    gap: 4px;
}

.ann-unit-btn {
    flex: 1;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface);
    font-size: 10px;
    color: var(--text-2);
    cursor: pointer;
    text-align: center;
    transition: background 0.1s;
}

.ann-unit-btn.active {
    background: var(--text-1);
    border-color: var(--text-1);
    color: var(--bg);
}

/* ── Sticker grid ──────────────────────────────────────────────────────────── */
.ann-sticker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
}

.ann-sticker-btn {
    font-size: 16px;
    padding: 3px;
    border: 1.5px solid transparent;
    border-radius: 5px;
    background: none;
    cursor: pointer;
    text-align: center;
    line-height: 1;
    transition: background 0.1s, border-color 0.1s;
}

.ann-sticker-btn:hover {
    background: var(--surface-2);
}

.ann-sticker-btn.active {
    border-color: var(--text-1);
    background: var(--surface-2);
}

/* ── Object list ────────────────────────────────────────────────────────────── */
#ann-object-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ann-obj-item {
    border: 1px solid var(--border);
    border-radius: 7px;
    overflow: hidden;
    margin-bottom: 4px;
    background: var(--surface);
}

.ann-obj-header {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 7px;
    cursor: pointer;
    user-select: none;
    transition: background 0.1s;
}

.ann-obj-header:hover {
    background: var(--surface-2);
}

.ann-obj-type-icon {
    flex-shrink: 0;
    color: var(--text-3);
    display: flex;
    align-items: center;
}

.ann-obj-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.12);
}

.ann-obj-label {
    flex: 1;
    font-size: 10px;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.ann-obj-chevron {
    color: var(--border-strong);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.ann-obj-item:has(.ann-obj-panel:not(.hidden)) .ann-obj-chevron {
    transform: rotate(180deg);
}

.ann-obj-del {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--border-strong);
    padding: 2px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    transition: color 0.1s, background 0.1s;
}

.ann-obj-del:hover {
    color: var(--red);
    background: var(--red-lt);
}

.ann-obj-panel {
    padding: 6px 8px 8px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--surface-2);
}

.ann-obj-panel.hidden {
    display: none;
}

/* Annotation layer row in Active Layers card */
.layer-row--annotation {
    border-top: 1px solid var(--border);
    padding-top: 4px;
    margin-top: 2px;
}

.layer-thumb--ann {
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
}

/* Annotation layer control in Layer Controls card */
.lc-item--annotation {
    border-color: var(--border-strong);
    background: var(--surface-2);
}

/* ── Inline text input (placed on map canvas) ──────────────────────────────── */
.ann-text-input {
    position: absolute;
    background: rgba(255, 255, 255, 0.92);
    border: 1.5px solid var(--text-1);
    border-radius: 4px;
    padding: 3px 7px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-1);
    outline: none;
    min-width: 90px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    z-index: 1000;
    transform: translate(-2px, -2px);
}

/* ── Action buttons ────────────────────────────────────────────────────────── */
.ann-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ann-action-row {
    display: flex;
    gap: 5px;
}

.ann-btn {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    font-size: 10px;
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: background 0.1s, border-color 0.1s;
}

.ann-btn:hover:not(:disabled) {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.ann-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ann-btn--danger {
    border-color: var(--red-border);
    color: var(--red);
}

.ann-btn--danger:hover:not(:disabled) {
    background: var(--red-lt);
    border-color: var(--red);
}
