/* ═══════════════════════════════════════════════════════════════════════════
 * marker.css — Drawing / Marker tool modal
 * ══════════════════════════════════════════════════════════════════════════ */

/* ── Full-screen overlay ────────────────────────────────────────────────── */

.ii-marker-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    padding: 16px;
    box-sizing: border-box;
}

.ii-marker-modal.is-open {
    opacity: 1;
}

/* ── Inner wrapper ──────────────────────────────────────────────────────── */

.ii-marker-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-height: 100%;
    width: 100%;
}

/* ── Canvas area ────────────────────────────────────────────────────────── */

.ii-marker-canvas-wrapper {
    position: relative;
    display: inline-block;
    max-width: 90vw;
    max-height: calc(100svh - 140px);
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    cursor: none; /* hide default cursor while drawing */
    flex-shrink: 1;
}

.ii-marker-source-img {
    display: block;
    max-width: 90vw;
    max-height: calc(100svh - 140px);
    object-fit: contain;
    user-select: none;
    pointer-events: none;
    border-radius: 10px;
}

.ii-marker-canvas {
    position: absolute;
    inset: 0;
    cursor: none;
    touch-action: none;
    border-radius: 10px;
}

/* ── Custom circular cursor ────────────────────────────────────────────── */

.ii-marker-cursor {
    --cursor-color: rgba(239, 68, 68, 0.65);
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--cursor-color);
    pointer-events: none;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
    transition: background 0.15s ease;
    will-change: left, top;
    left: -100px; /* hidden initially */
    top: -100px;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */

.ii-marker-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(20, 20, 26, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 10px 14px;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    flex-wrap: nowrap;
    width: min(96vw, 620px);
    box-sizing: border-box;
    flex-shrink: 0;
}

/* ── Color swatches ─────────────────────────────────────────────────────── */

.ii-marker-colors {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ii-marker-swatch {
    --swatch-color: rgba(239, 68, 68, 0.65);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--swatch-color);
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    outline: none;
    flex-shrink: 0;
    position: relative;
    transition: transform 0.15s ease, border-color 0.15s ease;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), inset 0 1px 2px rgba(255,255,255,0.2);
}

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

.ii-marker-swatch.is-active {
    border-color: #fff;
    transform: scale(1.2);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ── Tool buttons (undo / clear) ────────────────────────────────────────── */

.ii-marker-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0 12px;
}

.ii-marker-tool-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, color 0.15s, transform 0.1s;
}

.ii-marker-tool-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: translateY(-1px);
}

.ii-marker-tool-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ── Action buttons ─────────────────────────────────────────────────────── */

.ii-marker-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.ii-marker-btn {
    height: 36px;
    padding: 0 16px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    transition: background 0.15s, color 0.15s, transform 0.1s;
    white-space: nowrap;
}

.ii-marker-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    transform: translateY(-1px);
}

.ii-marker-btn--primary {
    background: var(--ii-accent, #2563EB);
    border-color: transparent;
    color: #fff;
}

.ii-marker-btn--primary:hover {
    background: var(--ii-accent-hover, #1d4ed8);
    transform: translateY(-1px);
}

.ii-marker-btn--primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ── Marker chip (amber / orange tint) ──────────────────────────────────── */

.ii-asset-chip--marker {
    border-color: rgba(245, 158, 11, 0.4) !important;
    background: rgba(245, 158, 11, 0.08) !important;
}

.ii-asset-chip--marker:hover {
    border-color: rgba(245, 158, 11, 0.65) !important;
    background: rgba(245, 158, 11, 0.14) !important;
}

.ii-asset-chip--marker .ii-asset-chip-title {
    color: #d97706 !important;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ii-asset-chip--marker .ii-asset-chip-thumb {
    border-radius: 4px;
    outline: 1.5px solid rgba(245, 158, 11, 0.4) !important;
}

[data-theme="dark"] .ii-asset-chip--marker {
    border-color: rgba(251, 191, 36, 0.35) !important;
    background: rgba(245, 158, 11, 0.1) !important;
}

[data-theme="dark"] .ii-asset-chip--marker:hover {
    border-color: rgba(251, 191, 36, 0.6) !important;
    background: rgba(245, 158, 11, 0.18) !important;
}

[data-theme="dark"] .ii-asset-chip--marker .ii-asset-chip-title {
    color: #fbbf24 !important;
}

/* ── Draw button in image-actions overlay ───────────────────────────────── */

.ii-marker-action-btn svg {
    width: 14px;
    height: 14px;
}

/* ── Edit toolbar Draw button ────────────────────────────────────────────── */

.ii-marker-edit-btn {
    background: rgba(245, 158, 11, 0.1) !important;
    border: 1px solid rgba(245, 158, 11, 0.25) !important;
    color: rgba(245, 158, 11, 0.9);
}

.ii-marker-edit-btn:hover {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #f59e0b !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
}

/* ── Mobile responsive ───────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .ii-marker-toolbar {
        gap: 8px;
        padding: 8px 10px;
        flex-wrap: wrap;
    }

    .ii-marker-colors {
        gap: 6px;
    }

    .ii-marker-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }

    .ii-marker-btn {
        height: 32px;
        padding: 0 12px;
        font-size: 12px;
    }

    .ii-marker-toolbar-actions {
        padding: 0 8px;
    }
}
