/**
 * Dermatology body mapping workstation
 */

.pf-der-workstation {
    --pf-der-accent: #6366f1;
    --pf-der-radius: 12px;
    width: 100%;
    max-width: none;
    padding: 0;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    border: 1px solid #e2e8f0;
    border-radius: var(--pf-der-radius);
    overflow: hidden;
}

.pf-der-ws-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.5rem 0.65rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    align-items: center;
}

.pf-der-ws-toolbar .btn,
.pf-der-ws-toolbar .form-select {
    font-size: 0.72rem;
}

.pf-der-ws-mode.is-active,
.pf-der-ws-view-btn.active {
    background: var(--pf-der-accent) !important;
    border-color: var(--pf-der-accent) !important;
    color: #fff !important;
}

.pf-der-ws-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

@media (min-width: 992px) {
    .pf-der-ws-layout {
        grid-template-columns: minmax(0, 1fr) 200px;
    }
}

.pf-der-ws-map-col {
    padding: 0.5rem;
    min-width: 0;
}

.pf-der-ws-viewport.is-child .pf-der-ws-zoom {
    transform: scale(0.88);
}

.pf-der-ws-viewport {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    touch-action: none;
    min-height: 420px;
    max-height: min(72vh, 640px);
}

.pf-der-ws-zoom {
    position: absolute;
    inset: 0;
    transform-origin: center center;
    transition: transform 0.12s ease;
}

.pf-der-ws-stage {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 420px;
    cursor: crosshair;
}

.pf-der-ws-canvas {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pf-der-ws-canvas .pf-der-body-svg,
.pf-der-ws-canvas .pf-der-face-svg,
.pf-der-ws-canvas .pf-der-scalp-svg {
    width: auto;
    height: 100%;
    max-height: 100%;
    max-width: 100%;
}

.pf-der-silhouette {
    pointer-events: none;
}

.pf-der-region {
    fill: rgba(232, 212, 196, 0.72);
    stroke: #c9a88f;
    stroke-width: 0.75;
    transition: fill 0.15s, stroke 0.15s, filter 0.15s;
    cursor: pointer;
}

.pf-der-child-proportions .pf-der-region {
    stroke-width: 0.65;
}

.pf-der-region:hover {
    fill: rgba(99, 102, 241, 0.22);
    stroke: var(--pf-der-accent);
    stroke-width: 1.2;
}

.pf-der-region.is-highlight {
    fill: rgba(99, 102, 241, 0.35);
    stroke: var(--pf-der-accent);
}

/* Default / psoriasis */
.pf-der-ws-canvas.pf-der-hm-psoriasis .pf-der-region.is-heatmap-light {
    fill: rgba(253, 230, 138, 0.55);
}

.pf-der-ws-canvas.pf-der-hm-psoriasis .pf-der-region.is-heatmap-moderate {
    fill: rgba(249, 115, 22, 0.5);
}

.pf-der-ws-canvas.pf-der-hm-psoriasis .pf-der-region.is-heatmap-severe {
    fill: rgba(220, 38, 38, 0.55);
}

/* Eczema — pink inflammatory */
.pf-der-ws-canvas.pf-der-hm-eczema .pf-der-region.is-heatmap-light {
    fill: rgba(254, 205, 211, 0.65);
}

.pf-der-ws-canvas.pf-der-hm-eczema .pf-der-region.is-heatmap-moderate {
    fill: rgba(244, 114, 182, 0.55);
}

.pf-der-ws-canvas.pf-der-hm-eczema .pf-der-region.is-heatmap-severe {
    fill: rgba(219, 39, 119, 0.58);
}

/* Vitiligo — depigmented */
.pf-der-ws-canvas.pf-der-hm-vitiligo .pf-der-region.is-heatmap-light {
    fill: rgba(255, 255, 255, 0.75);
    stroke: #cbd5e1;
}

.pf-der-ws-canvas.pf-der-hm-vitiligo .pf-der-region.is-heatmap-moderate {
    fill: rgba(226, 232, 240, 0.85);
    stroke: #94a3b8;
}

.pf-der-ws-canvas.pf-der-hm-vitiligo .pf-der-region.is-heatmap-severe {
    fill: rgba(148, 163, 184, 0.75);
    stroke: #64748b;
}

/* Burn */
.pf-der-ws-canvas.pf-der-hm-burn .pf-der-region.is-heatmap-light {
    fill: rgba(254, 240, 138, 0.55);
}

.pf-der-ws-canvas.pf-der-hm-burn .pf-der-region.is-heatmap-moderate {
    fill: rgba(234, 88, 12, 0.52);
}

.pf-der-ws-canvas.pf-der-hm-burn .pf-der-region.is-heatmap-severe {
    fill: rgba(124, 58, 237, 0.5);
}

/* Rosacea */
.pf-der-ws-canvas.pf-der-hm-rosacea .pf-der-region.is-heatmap-light {
    fill: rgba(254, 202, 202, 0.6);
}

.pf-der-ws-canvas.pf-der-hm-rosacea .pf-der-region.is-heatmap-moderate {
    fill: rgba(239, 68, 68, 0.52);
}

.pf-der-ws-canvas.pf-der-hm-rosacea .pf-der-region.is-heatmap-severe {
    fill: rgba(185, 28, 28, 0.55);
}

.pf-der-heatmap-panel[hidden] {
    display: none !important;
}

.pf-der-heatmap-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.pf-der-heatmap-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.6rem;
    color: #64748b;
}

.pf-der-heatmap-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.pf-der-ws-shades {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.pf-der-ws-pins {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.pf-der-marker {
    position: absolute;
    width: 28px;
    height: 28px;
    margin-left: -14px;
    margin-top: -14px;
    border-radius: 50%;
    border: 2.5px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
    z-index: 3;
}

.pf-der-marker.is-selected {
    transform: scale(1.15);
    z-index: 5;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.45);
}

.pf-der-marker[data-progress="Improving"] {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.55);
}

.pf-der-marker[data-progress="Worsening"] {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.55);
}

.pf-der-marker[data-progress="Stable"] {
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.55);
}

.pf-der-marker[data-progress="Resolved"] {
    opacity: 0.55;
    box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.35);
}

.pf-der-ws-ghost-pins {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.pf-der-marker-ghost {
    width: 22px;
    height: 22px;
    margin-left: -11px;
    margin-top: -11px;
    background: rgba(148, 163, 184, 0.45) !important;
    border: 2px dashed #94a3b8;
    color: #475569;
    font-size: 9px;
    opacity: 0.85;
}

.pf-der-photo-tabs {
    display: flex;
    gap: 0.2rem;
}

.pf-der-photo-tab {
    flex: 1;
    font-size: 0.62rem;
    padding: 0.2rem 0.25rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.pf-der-photo-tab.is-active {
    background: var(--pf-der-accent);
    color: #fff;
    border-color: var(--pf-der-accent);
}

.pf-der-photo-thumb-wrap {
    text-align: center;
}

.pf-der-photo-thumb {
    max-width: 100%;
    max-height: 72px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    margin-top: 0.25rem;
}

.pf-der-photo-chip {
    font-size: 0.62rem;
    padding: 0.15rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.pf-der-ws-sidebar {
    padding: 0.5rem 0.65rem;
    background: #fafafa;
    border-top: 1px solid #e2e8f0;
    max-height: 280px;
    overflow-y: auto;
}

@media (min-width: 992px) {
    .pf-der-ws-sidebar {
        border-top: none;
        border-left: 1px solid #e2e8f0;
        max-height: min(72vh, 640px);
    }
}

.pf-der-marker-palette {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.3rem;
}

.pf-der-marker-opt {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.4rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.pf-der-marker-opt.is-active {
    border-color: var(--pf-der-accent);
    background: #eef2ff;
}

.pf-der-marker-swatch {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.pf-der-progress-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.pf-der-progress-btn {
    font-size: 0.65rem;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #fff;
    cursor: pointer;
}

.pf-der-progress-btn.is-active {
    background: #334155;
    color: #fff;
    border-color: #334155;
}

.pf-der-ws-zoom-controls {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pf-der-ws-zoom-controls .btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
}

.pf-der-explain-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    z-index: 20;
    padding: 1rem;
    overflow: auto;
    display: none;
}

.pf-der-explain-overlay.is-open {
    display: block;
}

.pf-der-timeline-strip {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    padding: 0.35rem 0.65rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.pf-der-timeline-pill {
    flex: 0 0 auto;
    font-size: 0.68rem;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #fff;
    cursor: pointer;
}

.pf-der-timeline-pill.is-active {
    background: var(--pf-der-accent);
    color: #fff;
    border-color: var(--pf-der-accent);
}

.pf-der-ws-hint {
    font-size: 0.7rem;
    color: #64748b;
    margin: 0 0 0.35rem;
}

.pf-der-cosmetic-dot {
    fill: rgba(99, 102, 241, 0.55);
    stroke: #fff;
    stroke-width: 1;
    cursor: pointer;
}

.pf-layout.pf-der-form .pf-body-map.pf-der-workstation {
    max-width: none;
}

.pf-der-form .pf-section-panel[data-pf-section-panel="lesions"] .row {
    align-items: flex-start;
}

@media (max-width: 991.98px) {
    .pf-der-form .pf-section-panel[data-pf-section-panel="lesions"] .col-md-5,
    .pf-der-form .pf-section-panel[data-pf-section-panel="lesions"] .col-md-7 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}
