/* ==================== Level Select ==================== */

.level-select {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    margin-right: 12px;
}

.level-select:hover {
    border-color: var(--accent);
}

.level-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

/* ==================== Navigation ==================== */

.view-nav {
    display: flex;
    gap: 4px;
    margin-left: 20px;
}

.nav-link {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-link.active {
    color: var(--accent);
    background: var(--accent-dim);
}

/* ==================== Breadcrumb ==================== */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.crumb {
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition);
}

.crumb:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.crumb.active {
    color: var(--text-primary);
    cursor: default;
}

.crumb-sep {
    color: var(--text-muted);
    font-size: 11px;
}

/* ==================== Map Container ==================== */

.map-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.map-view {
    display: none;
    flex: 1;
    position: relative;
    overflow: hidden;
}

.map-view.active {
    display: flex;
    flex-direction: column;
}

.map-svg {
    flex: 1;
    cursor: grab;
    background: var(--bg-primary);
}

.map-svg:active {
    cursor: grabbing;
}

/* ==================== SVG Building Styles ==================== */

.building-group {
    cursor: pointer;
}

.building-rect {
    fill: var(--bg-card);
    stroke: var(--border-light);
    stroke-width: 1.5;
    transition: fill 0.15s, stroke 0.15s;
}

rect.building-rect {
    rx: 4;
}

.building-group:hover .building-rect {
    fill: var(--bg-card-hover);
    stroke: var(--accent);
    stroke-width: 2;
}

.building-label {
    fill: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

.building-meta {
    fill: var(--text-secondary);
    font-size: 10px;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

.building-icon {
    fill: var(--accent);
    font-size: 18px;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

/* ==================== SVG Container Styles ==================== */

.container-group {
    cursor: pointer;
}

.container-rect {
    fill: var(--bg-tertiary);
    stroke: var(--border);
    stroke-width: 1;
    rx: 3;
    transition: fill 0.15s, stroke 0.15s;
}

.container-group:hover .container-rect {
    fill: var(--accent-dim);
    stroke: var(--accent);
    stroke-width: 1.5;
}

.container-group.unconfirmed .container-rect {
    stroke-dasharray: 3 2;
    opacity: 0.5;
}

.container-group.unconfirmed .container-capacity {
    opacity: 0.5;
}

.container-group.active .container-rect {
    fill: var(--accent-dim);
    stroke: var(--accent);
    stroke-width: 2;
}

.container-label {
    fill: var(--text-primary);
    font-size: 11px;
    font-weight: 500;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

.container-count {
    fill: var(--text-muted);
    font-size: 9px;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

.container-capacity {
    fill: var(--text-primary);
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

.container-icon-img {
    pointer-events: none;
}

/* ==================== Floor Tabs ==================== */

.interior-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.floor-tabs {
    display: flex;
    gap: 4px;
}

.floor-tab {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.floor-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.floor-tab.active {
    color: var(--accent);
    background: var(--accent-dim);
    border-color: rgba(124, 110, 240, 0.3);
}

/* ==================== Tooltip ==================== */

.map-tooltip {
    display: none;
    position: absolute;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 10px 14px;
    pointer-events: none;
    z-index: 50;
    box-shadow: var(--shadow);
    max-width: 250px;
}

.map-tooltip.visible {
    display: block;
}

.map-tooltip .tt-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.map-tooltip .tt-detail {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ==================== Container Panel ==================== */

.container-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 380px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 40;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.container-panel.hidden {
    transform: translateX(100%);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.panel-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
}

.panel-close:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.panel-grid {
    padding: 16px 20px;
    overflow-x: auto;
}

.panel-items {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 16px;
}

/* ==================== Grid (reused from main) ==================== */

.panel-grid .inv-grid {
    display: inline-grid;
    gap: 2px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px;
}

.panel-grid .inv-cell {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.panel-grid .inv-cell.occupied {
    background: var(--accent-dim);
    border: 1px solid rgba(124, 110, 240, 0.25);
}

.panel-grid .inv-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    image-rendering: pixelated;
    position: absolute;
    top: 2px;
    left: 2px;
}

.panel-grid .qty {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
    text-shadow: 0 0 3px rgba(0,0,0,0.8);
    align-self: flex-end;
    margin-left: auto;
}

/* Wall lines in interior */
.interior-wall {
    fill: none;
    stroke: var(--border-light);
    stroke-width: 2;
    stroke-dasharray: 6 3;
    rx: 8;
}

.interior-floor {
    fill: rgba(30, 32, 48, 0.6);
    stroke: var(--border);
    stroke-width: 1;
    rx: 8;
}

/* Grid lines */
.grid-line {
    stroke: var(--border);
    stroke-width: 0.5;
    opacity: 0.3;
}

/* Player marker */
.player-marker { pointer-events: none; }
.player-pulse {
    animation: player-pulse 2s ease-in-out infinite;
}
@keyframes player-pulse {
    0%, 100% { opacity: 0.3; r: 6; }
    50% { opacity: 0.6; r: 8; }
}

/* Map search highlights */
.building-group.search-match .building-rect {
    fill: rgba(251, 191, 36, 0.3);
    stroke: #fbbf24;
    stroke-width: 2;
}
.building-group.search-dim {
    opacity: 0.3;
}
.container-group.search-match .container-rect {
    fill: rgba(251, 191, 36, 0.3);
    stroke: #fbbf24;
}
.container-group.search-dim {
    opacity: 0.3;
}
.search-badge {
    fill: #fbbf24;
    font-size: 4px;
    font-weight: bold;
    text-anchor: end;
    pointer-events: none;
}

/* Structures (walls, fences, gates) */
.structure {
    stroke-width: 0.5;
    pointer-events: none;
}
.struct-wall, .struct-brickwall {
    fill: rgba(139, 90, 43, 0.4);
    stroke: rgba(139, 90, 43, 0.8);
}
.struct-stonewall {
    fill: rgba(130, 130, 140, 0.4);
    stroke: rgba(130, 130, 140, 0.8);
}
.struct-palisade {
    fill: rgba(101, 67, 33, 0.4);
    stroke: rgba(101, 67, 33, 0.8);
}
.struct-polefence, .struct-logfence, .struct-fence {
    fill: rgba(160, 120, 60, 0.25);
    stroke: rgba(160, 120, 60, 0.6);
}
.struct-gate {
    fill: rgba(180, 140, 60, 0.35);
    stroke: rgba(180, 140, 60, 0.9);
}
.struct-structure {
    fill: rgba(100, 100, 110, 0.3);
    stroke: rgba(100, 100, 110, 0.6);
}

/* Pavement tiles */
.pavement {
    stroke: none;
    pointer-events: none;
}
.pave-brick {
    fill: rgba(178, 102, 68, 0.35);
}
.pave-stone {
    fill: rgba(160, 160, 170, 0.3);
}
.pave-other {
    fill: rgba(140, 130, 110, 0.3);
}

/* ==================== Plot Controls ==================== */

.plot-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
}
.plot-toggle input {
    accent-color: var(--accent);
}

.plot-btn {
    padding: 5px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 12px;
}
.plot-btn:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}
.plot-btn-finish {
    border-color: var(--green);
    color: var(--green);
}
.plot-btn-finish:hover:not(:disabled) {
    background: var(--green-dim);
}
.plot-btn-finish:disabled {
    opacity: 0.4;
    cursor: default;
}
.plot-btn-cancel {
    border-color: var(--red);
    color: var(--red);
}
.plot-btn-cancel:hover {
    background: var(--red-dim);
}

.hidden {
    display: none !important;
}

.plot-polygon {
    cursor: pointer;
    transition: opacity var(--transition);
}
.plot-polygon:hover {
    opacity: 0.9;
}
.plot-label {
    pointer-events: none;
}
