/* Viewport — Roadmap visual editor (settings bar + chart) */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

/* Settings bar — matches capability map topbar */
.vr-settings-bar {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    min-height: 64px;
    background: #040d16;
    border-bottom: 1px solid #0c2133;
    flex-shrink: 0;
    font-family: 'DM Sans', sans-serif;
    gap: 1rem;
}

.vr-info { min-width: 0; }
.vr-acct-name {
    font-size: 1.8rem;
    font-weight: 600;
    color: #deeef8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
}
.vr-acct-meta {
    font-size: 0.7rem;
    color: #3a5a72;
    margin-top: 1px;
}

/* From/To controls — hidden until hover */
.vr-tb-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
}
.vr-settings-bar:hover .vr-tb-right {
    opacity: 1;
}

.vr-setting-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.vr-setting-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #5a8aaa;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.vr-setting-sm { gap: 0.3rem; }

.vr-input, .vr-select {
    padding: 0.28rem 0.55rem;
    border: 1px solid #0c2133;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: inherit;
    color: #c5d9e8;
    background: #050f1a;
}
.vr-input:focus, .vr-select:focus {
    outline: none;
    border-color: #7dd3fc;
    box-shadow: 0 0 0 2px rgba(125,211,252,0.12);
}
.vr-input-year { width: 4.5rem; }

/* Editor main area */
.vr-editor {
    flex: 1;
    padding: 1.25rem;
    overflow: auto;
    background: #020e18;
    display: flex;
    flex-direction: column;
    --vr-title-scale: 1;
    --vr-item-scale: 1;
}

.vr-editor-inner {
    margin: auto 0;
    min-width: max-content;
}

/* Font scale application */
.vr-cat-name { font-size: calc(1.1rem * var(--vr-title-scale)); }
.vr-item-label { font-size: calc(0.72rem * var(--vr-item-scale)); }

/* Zoom-style size controls in settings bar */
.vr-size-group {
    display: flex;
    align-items: center;
    border: 1px solid #0c2133;
    border-radius: 5px;
    overflow: hidden;
}
.vr-size-label-prefix {
    padding: 0 0.4rem;
    background: #050f1a;
    color: #3a5a72;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    height: 26px;
    display: flex;
    align-items: center;
    border-right: 1px solid #0c2133;
    white-space: nowrap;
}
.vr-size-btn {
    width: 24px;
    height: 26px;
    background: #050f1a;
    color: #5a8aaa;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .12s;
    flex-shrink: 0;
}
.vr-size-btn:hover { background: #0a2035; color: #7dd3fc; }
.vr-size-val {
    padding: 0 0.35rem;
    background: #050f1a;
    color: #3a5a72;
    font-size: 0.62rem;
    font-weight: 500;
    white-space: nowrap;
    border-left: 1px solid #0c2133;
    border-right: 1px solid #0c2133;
    height: 26px;
    display: flex;
    align-items: center;
    min-width: 34px;
    justify-content: center;
}

/* Chart wrapper */
.vr-chart-wrapper {
    position: relative;
    box-shadow: 0 0 0 2.5px rgba(255,255,255,0.75);
    border-radius: 6px;
}

/* Timeline header */
.vr-timeline-header {
    display: flex;
    color: #fff;
    font-weight: 600;
    background: #032D42;
    border-radius: 6px 6px 0 0;
    border: 1px solid rgba(255,255,255,0.3);
    border-bottom: none;
}

.vr-hdr-right-area { flex-direction: column; }
.vr-hdr-sub-row { display: flex; width: 100%; }
.vr-hdr-quarters-row { border-top: 1px solid rgba(255,255,255,0.3); }

.vr-label-col {
    width: 200px;
    min-width: 200px;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    font-size: 1rem;
    border-right: 1px solid rgba(255,255,255,0.3);
}

.vr-timeline-area {
    flex: 1;
    display: flex;
    min-width: 600px;
    flex-direction: column;
}

.vr-year-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    padding: 0.35rem 0;
}

.vr-quarter-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    padding: 0.25rem 0;
}

/* Category rows */
.vr-categories { position: relative; }

.vr-category-row {
    display: flex;
    border: 1px solid rgba(255,255,255,0.3);
    border-top: none;
    min-height: 90px;
    position: relative;
}

/* Full-height gridlines overlay */
.vr-gridlines-overlay {
    position: absolute;
    top: 0;
    left: 200px;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 3;
}

.vr-gridline-full {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255,255,255,0.2);
}

.vr-cat-label {
    width: 200px;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 0.75rem;
    position: relative;
    border-right: 1px solid rgba(255,255,255,0.3);
    opacity: 1;
}

.vr-cat-icon {
    font-size: 1.8rem;
    opacity: 1;
    cursor: pointer;
    width: 2.2rem;
    text-align: center;
    color: #fff;
}
.vr-cat-icon:hover { opacity: 0.8; }

.vr-cat-name {
    font-weight: 600;
    line-height: 1.2;
    cursor: text;
    padding: 2px 4px;
    border-radius: 3px;
    min-width: 40px;
    outline: none;
    color: #fff;
}
.vr-cat-name:hover { background: rgba(255,255,255,0.15); }
.vr-cat-name:focus { background: rgba(255,255,255,0.3); box-shadow: 0 0 0 2px #3b82f6; color: #fff; }

.vr-cat-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}
.vr-category-row:hover .vr-cat-actions { opacity: 1; }

.vr-cat-action-btn {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.vr-cat-action-btn:hover { background: rgba(255,255,255,0.35); color: #fff; }
.vr-cat-action-btn.danger:hover { background: #fecaca; color: #dc2626; }

/* Timeline items area */
.vr-cat-timeline {
    flex: 1;
    position: relative;
    min-width: 600px;
    min-height: 90px;
}

.vr-gridline {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255,255,255,0.15);
    pointer-events: none;
    z-index: 0;
}

/* Item bars */
.vr-item {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: grab;
    z-index: 1;
    padding: 2px 0;
}
.vr-item:active { cursor: grabbing; }
.vr-item.dragging { opacity: 0.7; z-index: 10; }

.vr-item-label {
    color: #fff;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    cursor: text;
    padding: 1px 3px;
    border-radius: 2px;
    outline: none;
    line-height: 1.3;
}
.vr-item-label:hover { background: rgba(255,255,255,0.1); }
.vr-item-label:focus { background: rgba(0,0,0,0.4); box-shadow: 0 0 0 2px #3b82f6; cursor: text; color: #fff; }

.vr-item-bar {
    height: 7px;
    border-radius: 4px;
    position: relative;
    flex-shrink: 0;
}

.vr-item-dot {
    position: absolute;
    top: -2px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
}
.vr-item-dot-start { left: -5.5px; }
.vr-item-dot-end { right: -5.5px; }

/* Resize handles */
.vr-resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: ew-resize;
    z-index: 2;
}
.vr-resize-handle.left { left: -4px; }
.vr-resize-handle.right { right: -4px; }

/* Item delete button */
.vr-item-delete {
    position: absolute;
    top: -2px;
    right: -6px;
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3;
}
.vr-item:hover .vr-item-delete { display: flex; }

/* Add item button */
.vr-add-item-btn {
    position: absolute;
    bottom: 4px;
    right: 8px;
    background: rgba(255,255,255,0.1);
    border: 1px dashed rgba(255,255,255,0.3);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.15s;
}
.vr-category-row:hover .vr-add-item-btn { opacity: 1; }
.vr-add-item-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }

/* Add category button */
.vr-add-cat-btn {
    margin-top: 0.5rem;
    width: 100%;
    justify-content: center;
    border-style: dashed;
    border-color: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.5);
    padding: 0.6rem;
    background: transparent;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: inherit;
}
.vr-add-cat-btn:hover { border-color: #3b82f6; color: #3b82f6; background: rgba(59,130,246,0.1); }

/* Zoom controls */
.vr-zoom-group {
    display: flex;
    align-items: center;
    border: 1px solid #0c2133;
    border-radius: 5px;
    overflow: hidden;
}
.vr-zoom-btn {
    width: 24px;
    height: 26px;
    background: #050f1a;
    color: #5a8aaa;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .12s;
    flex-shrink: 0;
}
.vr-zoom-btn:hover { background: #0a2035; color: #7dd3fc; }
.vr-zoom-label {
    padding: 0 0.4rem;
    background: #050f1a;
    color: #3a5a72;
    font-size: 0.65rem;
    font-weight: 500;
    white-space: nowrap;
    border-left: 1px solid #0c2133;
    border-right: 1px solid #0c2133;
    height: 26px;
    display: flex;
    align-items: center;
    min-width: 36px;
    justify-content: center;
}
.vr-zoom-fit-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    background: #050f1a;
    border: 1px solid #0c2133;
    border-radius: 5px;
    color: #5a8aaa;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .12s;
    flex-shrink: 0;
}
.vr-zoom-fit-btn:hover { background: #0a2035; color: #7dd3fc; }

/* Color picker popover — rendered at body level with fixed positioning */
.vr-color-picker {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.vr-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
}
.vr-color-swatch:hover { border-color: #3b82f6; }
.vr-color-swatch.active { border-color: #1e293b; }

/* Icon picker popover — rendered at body level with fixed positioning */
.vr-icon-picker {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.3rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    max-height: 200px;
    overflow-y: auto;
}
.vr-icon-option {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    color: #475569;
}
.vr-icon-option:hover { background: #f1f5f9; color: #1e293b; }
.vr-icon-option.active { background: #dbeafe; color: #2563eb; }

/* Drag-over visual (category row reorder) */
.vr-category-row.drag-over {
    outline: 2px dashed #3b82f6;
    outline-offset: -2px;
}

/* Cross-lane drop target highlight */
.vr-cat-timeline.vr-drop-target {
    outline: 2px solid #7dd3fc;
    outline-offset: -2px;
    background-blend-mode: screen;
}

/* Not-owned item — stadium outline drawn as inline SVG by viewport-roadmap.js
   (_buildUnownedSVG). Fixed-radius caps + variable-length middle lines so the
   circles never distort at any bar width. Same helper also renders the legend
   swatch, keeping bar and legend in lockstep. */
.vr-item--not-owned .vr-item-bar {
    background: transparent !important;
    border: none;
    border-radius: 0;
    overflow: visible;
}
/* Legend not-owned swatch is inline SVG too — no dedicated CSS needed */

/* Legend bar */
.vr-legend-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.35rem 1rem;
    background: #040d16;
    border-bottom: 1px solid #0c2133;
    flex-shrink: 0;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.7rem;
    color: #5a8aaa;
}

.vr-legend-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #94a3b8;
    font-size: 0.7rem;
}

.vr-legend-swatch {
    width: 28px;
    height: 7px;
    border-radius: 4px;
    flex-shrink: 0;
    position: relative;
}

.vr-legend-swatch::before,
.vr-legend-swatch::after {
    content: '';
    position: absolute;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    top: -2px;
}
.vr-legend-swatch::before { left: -5px; }
.vr-legend-swatch::after  { right: -5px; }

.vr-legend-swatch--owned {
    background: #deeef8;
}
.vr-legend-swatch--owned::before,
.vr-legend-swatch--owned::after {
    background: #deeef8;
}

/* .vr-legend-swatch--not-owned replaced by inline SVG in legend bar HTML */

.vr-legend-hint {
    margin-left: auto;
    font-size: 0.65rem;
    color: #2a4a62;
    font-style: italic;
}

/* Ownership auto-map popup */
.vr-automap-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'DM Sans', sans-serif;
}

.vr-automap-modal {
    background: #071523;
    border: 1px solid #0c2133;
    border-radius: 8px;
    width: 720px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}

.vr-automap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #0c2133;
    font-size: 1rem;
    font-weight: 600;
    color: #deeef8;
    flex-shrink: 0;
}

.vr-automap-close {
    background: none;
    border: none;
    color: #5a8aaa;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.25rem;
}
.vr-automap-close:hover { color: #deeef8; }

.vr-automap-desc {
    padding: 0.6rem 1.25rem 0;
    margin: 0;
    font-size: 0.75rem;
    color: #3a5a72;
    flex-shrink: 0;
}

.vr-automap-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1.25rem;
}

.vr-automap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.vr-automap-table th {
    text-align: left;
    padding: 0.4rem 0.6rem;
    color: #3a5a72;
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid #0c2133;
}

.vr-automap-row {
    cursor: pointer;
    border-bottom: 1px solid #071f30;
    transition: background 0.1s;
}
.vr-automap-row:hover { background: #0a1e2e; }

.vr-automap-row td {
    padding: 0.55rem 0.6rem;
    vertical-align: middle;
}

.vr-automap-td-label {
    color: #c5d9e8;
    font-weight: 500;
    width: 45%;
}

.vr-automap-td-status {
    width: 20%;
}

.vr-automap-td-reason {
    color: #3a5a72;
    font-size: 0.72rem;
    width: 35%;
}

.vr-automap-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
}

.vr-automap-row--owned .vr-automap-toggle-owned {
    color: #4ade80;
    font-weight: 600;
}
.vr-automap-row--owned .vr-automap-toggle-sep,
.vr-automap-row--owned .vr-automap-toggle-not {
    color: #1e3a52;
}

.vr-automap-row--not-owned .vr-automap-toggle-not {
    color: #f87171;
    font-weight: 600;
}
.vr-automap-row--not-owned .vr-automap-toggle-sep,
.vr-automap-row--not-owned .vr-automap-toggle-owned {
    color: #1e3a52;
}

.vr-automap-footer {
    display: flex;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid #0c2133;
    flex-shrink: 0;
    justify-content: flex-end;
}

.vr-automap-apply {
    padding: 0.45rem 1.25rem;
    background: #0ea5e9;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.vr-automap-apply:hover { background: #38bdf8; }

.vr-automap-cancel {
    padding: 0.45rem 1.25rem;
    background: transparent;
    color: #5a8aaa;
    border: 1px solid #0c2133;
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}
.vr-automap-cancel:hover { color: #deeef8; border-color: #1e3a52; }
