/* Verhindert das Standard-Scrollen beim Zoomen mit dem Mausrad */
body, html {
    overflow: hidden;
    user-select: none;
}

#map-viewport {
    cursor: grab;
}

#map-viewport:active {
    cursor: grabbing;
}

/* Styling für weiche Übergänge */
.map-point, .map-annotation {
    transition: transform 0.1s ease-out;
}

.map-point:hover {
    z-index: 50;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

.point-icon-visual {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center;
    pointer-events: none;
}

.point-icon-visual::before {
    content: "";
    position: absolute;
    inset: 10%;
    z-index: 2;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    opacity: 0;
    transform: scale(0);
    transform-origin: center;
    pointer-events: none;
}

.point-icon-visual svg {
    position: relative;
    z-index: 1;
    display: block;
    overflow: visible;
}

.points-pulse-active .point-icon-visual::before {
    will-change: transform, opacity;
    animation: digipos-point-pulse-dot 1.15s ease-in-out infinite;
    animation-delay: var(--point-pulse-delay, 0s);
}

@keyframes digipos-point-pulse-dot {
    0%, 100% {
        opacity: 0;
        transform: scale(0);
    }
    45% {
        opacity: 0.9;
        transform: scale(1);
    }
    70% {
        opacity: 0.38;
        transform: scale(0.7);
    }
}

@media (prefers-reduced-motion: reduce) {
    .points-pulse-active .point-icon-visual::before {
        animation: none;
        opacity: 0.75;
        transform: scale(0.65);
    }
}


/* Live-Ansicht: inaktive Positionen dezent darstellen */
.map-point-live-inactive {
    opacity: 0.22;
    filter: grayscale(0.8);
}

.map-point-live-inactive .point-label {
    opacity: 0.25 !important;
}

.sidebar-live-inactive {
    opacity: 0.52;
    background-color: rgba(31, 41, 55, 0.35) !important;
}

.sidebar-live-inactive .sidebar-icon-trigger {
    filter: grayscale(1);
    opacity: 0.55;
}


/* Statusfenster für Live-Ansicht und Zeitleiste */
.temporal-status {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 55;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: min(760px, calc(100vw - 32px));
    padding: 5px 12px;
    border: 1px solid rgba(34, 197, 94, 0.7);
    border-radius: 999px;
    background: rgba(20, 83, 45, 0.92);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.30);
    color: #dcfce7;
    text-align: center;
    pointer-events: none;
    backdrop-filter: blur(8px);
    white-space: nowrap;
}

.temporal-status.temporal-status-live {
    border-color: rgba(248, 113, 113, 0.78);
    background: rgba(127, 29, 29, 0.92);
    color: #fee2e2;
}

.temporal-status.temporal-status-timeline {
    border-color: rgba(34, 197, 94, 0.78);
    background: rgba(20, 83, 45, 0.92);
    color: #dcfce7;
}

.temporal-status-title {
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.02em;
}

.temporal-status-meta,
.temporal-status-counts {
    font-size: 0.72rem;
    color: inherit;
    opacity: 0.94;
}

.temporal-status-meta::before,
.temporal-status-counts::before {
    content: "·";
    margin-right: 8px;
    opacity: 0.75;
}

.map-annotation:hover {
    z-index: 50;
    filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.5));
}

/* Zeichnungen Interaktionen */
.map-drawing {
    transition: filter 0.2s ease;
}
.map-drawing.pointer-events-auto:hover {
    filter: drop-shadow(0 0 4px rgba(255,255,255,0.8));
}

/* Highlight Effekte für selektierte Elemente */
.selected-highlight {
    z-index: 55;
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 1)) drop-shadow(0 0 12px rgba(59, 130, 246, 0.8)) !important;
}

.selected-drawing-highlight {
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 1)) !important;
}

/* Scrollbar Styling für die Seitenleiste */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #1f2937; 
}
::-webkit-scrollbar-thumb {
    background: #4b5563; 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #6b7280; 
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Modal Backdrop */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

/* Drag & Drop Styles */
.sidebar-draggable-row {
    position: relative;
}
.drag-over {
    outline: 2px dashed #3b82f6 !important;
    outline-offset: -2px;
    background-color: rgba(59, 130, 246, 0.16) !important;
}
.drag-over-top,
.drag-over-bottom {
    border-color: transparent !important;
}
.drag-over-top::before,
.drag-over-bottom::after {
    content: "";
    position: absolute;
    left: 6px;
    right: 6px;
    height: 4px;
    background: #3b82f6;
    border-radius: 999px;
    box-shadow: 0 0 0 1px rgba(191, 219, 254, 0.95), 0 0 10px rgba(59, 130, 246, 0.95);
    pointer-events: none;
    z-index: 25;
}
.drag-over-top::before {
    top: -3px;
}
.drag-over-bottom::after {
    bottom: -3px;
}
.dragging {
    opacity: 0.45;
    cursor: grabbing !important;
}
.sidebar-drop-section-active {
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.45);
    border-radius: 8px;
}

.sidebar-icon-trigger > * {
    pointer-events: none;
}

.drawing-measure-label {
    position: absolute;
    padding: 3px 8px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    transform-origin: center center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}


.interaction-mode-disabled {
    opacity: 0.45;
    cursor: default !important;
}

.interaction-mode-disabled .sidebar-drag-surface,
.interaction-mode-disabled [draggable="true"] {
    cursor: default !important;
}

.selection-box {
    position: absolute;
    border: 1px dashed rgba(59, 130, 246, 0.95);
    background-color: rgba(59, 130, 246, 0.15);
    pointer-events: none;
    z-index: 80;
    display: none;
}

.sidebar-drag-ready {
    outline: 1px solid rgba(59, 130, 246, 0.8);
    outline-offset: -1px;
}

#scale-text {
    text-shadow:
        -1px -1px 0 #000,
         1px -1px 0 #000,
        -1px  1px 0 #000,
         1px  1px 0 #000,
         0 0 4px rgba(0,0,0,0.9);
}

.context-menu {
    position: fixed;
    min-width: 230px;
    max-width: 320px;
    background: rgba(17, 24, 39, 0.98);
    border: 1px solid rgba(75, 85, 99, 0.95);
    border-radius: 10px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.45);
    padding: 6px;
    z-index: 200;
    backdrop-filter: blur(6px);
}

.context-menu-separator {
    height: 1px;
    background: rgba(75, 85, 99, 0.7);
    margin: 6px 4px;
}

.context-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #e5e7eb;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.context-menu-item:hover {
    background: rgba(55, 65, 81, 0.95);
}

.context-menu-item:disabled {
    opacity: 0.45;
    cursor: default;
}

.context-menu-item:disabled:hover {
    background: transparent;
}

.context-menu-item i {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.context-menu-item-label {
    flex: 1;
    min-width: 0;
}

/* Live-Tutorial / Coachmarks direkt in der echten Oberfläche */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    pointer-events: none;
}

.tutorial-spotlight {
    position: fixed;
    border: 2px solid rgba(34, 211, 238, 0.95);
    border-radius: 16px;
    background: rgba(14, 165, 233, 0.06);
    box-shadow:
        0 0 0 9999px rgba(2, 6, 23, 0.36),
        0 0 0 8px rgba(56, 189, 248, 0.14),
        0 0 34px rgba(56, 189, 248, 0.9);
    transition: left 0.18s ease, top 0.18s ease, width 0.18s ease, height 0.18s ease;
    pointer-events: none;
}

.tutorial-bubble {
    position: fixed;
    width: min(360px, calc(100vw - 24px));
    border: 1px solid rgba(125, 211, 252, 0.55);
    border-radius: 18px;
    padding: 16px;
    color: #e5f3ff;
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.97));
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.45), 0 0 32px rgba(14, 165, 233, 0.25);
    pointer-events: auto;
}

.tutorial-bubble-arrow {
    position: absolute;
    width: 14px;
    height: 14px;
    background: rgba(15, 23, 42, 0.98);
    border-left: 1px solid rgba(125, 211, 252, 0.45);
    border-top: 1px solid rgba(125, 211, 252, 0.45);
    transform: rotate(45deg);
}

.tutorial-placement-bottom .tutorial-bubble-arrow {
    top: -8px;
    left: 50%;
    margin-left: -7px;
}

.tutorial-placement-top .tutorial-bubble-arrow {
    bottom: -8px;
    left: 50%;
    margin-left: -7px;
    transform: rotate(225deg);
}

.tutorial-placement-right .tutorial-bubble-arrow {
    left: -8px;
    top: 50%;
    margin-top: -7px;
    transform: rotate(-45deg);
}

.tutorial-placement-left .tutorial-bubble-arrow {
    right: -8px;
    top: 50%;
    margin-top: -7px;
    transform: rotate(135deg);
}

.tutorial-bubble-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.tutorial-step-icon {
    width: 38px;
    height: 38px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ecfeff;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.95), rgba(6, 182, 212, 0.88));
    box-shadow: 0 12px 26px rgba(8, 145, 178, 0.35);
}

.tutorial-eyebrow {
    color: #67e8f9;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.tutorial-title {
    color: #ffffff;
    font-size: 1.08rem;
    font-weight: 900;
    line-height: 1.15;
    margin-top: 2px;
}

.tutorial-close {
    width: 30px;
    height: 30px;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 999px;
    color: #cbd5e1;
    background: rgba(51, 65, 85, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.2);
    transition: background 0.18s ease, color 0.18s ease;
}

.tutorial-close:hover {
    color: #ffffff;
    background: rgba(71, 85, 105, 0.96);
}

.tutorial-description {
    color: #dbeafe;
    font-size: 0.9rem;
    line-height: 1.55;
    margin-bottom: 12px;
}

.tutorial-tips {
    display: grid;
    gap: 7px;
    margin: 0 0 14px;
}

.tutorial-tips li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: #bae6fd;
    font-size: 0.8rem;
    line-height: 1.4;
    padding: 8px 9px;
    border-radius: 11px;
    background: rgba(8, 47, 73, 0.46);
    border: 1px solid rgba(56, 189, 248, 0.16);
}

.tutorial-tips li::before {
    content: "";
    width: 6px;
    height: 6px;
    margin-top: 6px;
    border-radius: 999px;
    background: #22d3ee;
    flex-shrink: 0;
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.13);
}

.tutorial-progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.tutorial-progress-track {
    height: 7px;
    flex: 1;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(51, 65, 85, 0.95);
}

.tutorial-progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #22d3ee);
    transition: width 0.22s ease;
}

.tutorial-step-count {
    color: #93c5fd;
    font-size: 0.72rem;
    font-weight: 900;
    min-width: 42px;
    text-align: right;
}

.tutorial-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.tutorial-primary-btn,
.tutorial-secondary-btn {
    border: 0;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 850;
    transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.tutorial-primary-btn {
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb, #0891b2);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.24);
}

.tutorial-secondary-btn {
    color: #cbd5e1;
    background: rgba(51, 65, 85, 0.9);
}

.tutorial-primary-btn:hover,
.tutorial-secondary-btn:hover {
    transform: translateY(-1px);
}

.tutorial-secondary-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.tutorial-target-active {
    position: relative;
    border-radius: 12px;
    outline: 3px solid rgba(34, 211, 238, 0.98) !important;
    outline-offset: 5px;
    box-shadow:
        0 0 0 10px rgba(34, 211, 238, 0.14),
        0 0 28px rgba(34, 211, 238, 0.95) !important;
}

@media (max-width: 760px) {
    .tutorial-bubble {
        width: calc(100vw - 24px);
        left: 12px !important;
        right: 12px;
        max-height: calc(100vh - 24px);
        overflow-y: auto;
    }
}

.temporal-status.hidden {
    display: none;
}

/* Branding / Custom logo */
.app-branding-custom {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-width: 74px;
    max-width: 150px;
    line-height: 1;
}

.app-custom-logo {
    max-width: 150px;
    max-height: 34px;
    object-fit: contain;
}

.app-powered-by {
    font-size: 0.55rem;
    color: #94a3b8;
    white-space: nowrap;
}

.app-powered-logo {
    color: #3b82f6;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.custom-logo-preview img {
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
}

/* Settings tabs */
.settings-tab-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-tab-btn {
    flex: 0 0 auto;
    border-radius: 999px;
    border: 1px solid rgba(75, 85, 99, 0.9);
    background: rgba(17, 24, 39, 0.72);
    color: #d1d5db;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 700;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.settings-tab-btn:hover,
.settings-tab-btn.active {
    border-color: rgba(96, 165, 250, 0.8);
    background: rgba(37, 99, 235, 0.28);
    color: #eff6ff;
}

/* Keep toolbars and modals usable on smaller viewports */
.timeline-controls {
    flex: 1 1 12rem;
    min-width: 0;
    max-width: min(26rem, 34vw);
}

.timeline-slider {
    width: 100%;
    min-width: 7rem;
}

.modal-backdrop {
    padding: 0.75rem;
}

.modal-backdrop > div {
    max-width: calc(100vw - 1.5rem);
    max-height: calc(100vh - 1.5rem);
    overflow-y: auto;
}

.modal-window {
    position: fixed !important;
    resize: both;
    overflow: auto;
    min-width: 320px;
    min-height: 220px;
    z-index: 80;
}

@media (max-width: 900px) {
    .timeline-controls {
        flex-basis: 9rem;
        max-width: 42vw;
    }

    .app-custom-logo {
        max-width: 110px;
    }
}

/* DIGI brand colors shared by DIGIPOS/DIGISYSTEMS-style wordmarks */
.brand-prefix {
    color: #3b82f6;
}

.brand-suffix {
    color: #94a3b8;
}

.app-powered-logo {
    color: inherit;
}

.change-log-list {
    max-height: min(24rem, calc(100vh - 18rem));
    overflow-y: auto;
}

.change-log-entry:nth-child(even) {
    background: rgba(15, 23, 42, 0.32);
}

.mass-positions-table-wrap {
    max-height: min(28rem, calc(100vh - 16rem));
}

.mass-positions-table th,
.mass-positions-table td {
    padding: 0.45rem;
    text-align: left;
    vertical-align: middle;
}

.mass-input,
.mass-input-color {
    background: #1f2937;
    border: 1px solid #4b5563;
    border-radius: 0.375rem;
    color: #fff;
    padding: 0.35rem 0.45rem;
    outline: none;
}

.mass-input:focus,
.mass-input-color:focus {
    border-color: #3b82f6;
}

.mass-input-color {
    width: 3.2rem;
    height: 2rem;
    padding: 0.1rem;
}

/* Log tab: keep long histories fully readable inside the settings modal */
.settings-tab-panel[data-settings-tab="log"] {
    min-height: 0;
}

.settings-tab-panel[data-settings-tab="log"]:not(.hidden) {
    display: flex;
    flex-direction: column;
}

.settings-tab-panel[data-settings-tab="log"] > div {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
}

.change-log-list {
    height: min(32rem, calc(100vh - 24rem));
    max-height: min(32rem, calc(100vh - 24rem));
    min-height: 12rem;
    overflow-y: auto !important;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

#map-layers img {
    max-width: none;
    transform-origin: top left;
}

#map-layer-edit-actions {
    backdrop-filter: blur(8px);
}

.map-layer-edit-panel {
    width: min(62rem, calc(100vw - 2rem));
}

.map-layer-edit-controls {
    display: grid;
    grid-template-columns: repeat(5, minmax(7.5rem, 1fr));
    gap: 0.55rem;
}

.map-layer-edit-control {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.map-layer-edit-control > span {
    color: #9ca3af;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.map-layer-edit-control > div {
    display: grid;
    grid-template-columns: 1.75rem minmax(0, 1fr) 1.75rem;
    overflow: hidden;
    border: 1px solid rgba(75, 85, 99, 0.95);
    border-radius: 0.65rem;
    background: rgba(17, 24, 39, 0.9);
}

.map-layer-edit-control input {
    width: 100%;
    min-width: 0;
    border: 0;
    border-left: 1px solid rgba(75, 85, 99, 0.95);
    border-right: 1px solid rgba(75, 85, 99, 0.95);
    background: rgba(31, 41, 55, 0.95);
    color: #fff;
    padding: 0.4rem 0.45rem;
    text-align: center;
    outline: none;
}

.map-layer-edit-control button {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a5f3fc;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.map-layer-edit-control button:hover {
    background: rgba(8, 145, 178, 0.3);
    color: #fff;
}

@media (max-width: 900px) {
    .map-layer-edit-controls {
        grid-template-columns: repeat(2, minmax(7.5rem, 1fr));
    }
}

.map-layer-edit-target {
    outline: 2px solid rgba(34, 211, 238, 0.95);
    box-shadow: 0 0 0 1px rgba(8, 47, 73, 0.8), 0 0 18px rgba(34, 211, 238, 0.35);
    cursor: move;
}

.map-layer-resize,
.map-layer-rotate-handle {
    position: absolute;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #083344;
    background: #22d3ee;
    color: #083344;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
}

.map-layer-resize {
    width: 24px;
    height: 24px;
    border-radius: 999px;
}

.map-layer-resize-nw { left: -12px; top: -12px; cursor: nwse-resize; }
.map-layer-resize-n { left: 50%; top: -12px; transform: translateX(-50%); cursor: ns-resize; }
.map-layer-resize-ne { right: -12px; top: -12px; cursor: nesw-resize; }
.map-layer-resize-e { right: -12px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.map-layer-resize-se { right: -12px; bottom: -12px; cursor: nwse-resize; }
.map-layer-resize-s { left: 50%; bottom: -12px; transform: translateX(-50%); cursor: ns-resize; }
.map-layer-resize-sw { left: -12px; bottom: -12px; cursor: nesw-resize; }
.map-layer-resize-w { left: -12px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

.map-layer-rotate-handle {
    left: 50%;
    top: -54px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    transform: translateX(-50%);
    cursor: grab;
}

.map-layer-rotate-handle:active {
    cursor: grabbing;
}

.mass-position-card-cell {
    padding: 0.55rem !important;
}

.mass-position-grid {
    display: grid;
    grid-template-columns: minmax(12rem, 2fr) minmax(4.5rem, 0.6fr) repeat(2, minmax(8.5rem, 1fr)) repeat(2, minmax(7rem, 0.8fr)) minmax(8rem, 1fr) minmax(4.5rem, 0.5fr) minmax(5rem, 0.5fr) auto;
    gap: 0.5rem;
    align-items: end;
}

.mass-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.2rem;
}

.mass-field span {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #9ca3af;
}

.mass-field .mass-input,
.mass-field .mass-input-color {
    width: 100%;
    min-width: 0;
}

.mass-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.2rem;
    padding-bottom: 0.2rem;
}

@media (max-width: 1100px) {
    .mass-position-grid {
        grid-template-columns: minmax(12rem, 2fr) minmax(4.5rem, 0.6fr) repeat(2, minmax(8.5rem, 1fr)) auto;
    }

    .mass-field-name {
        grid-column: span 2;
    }
}

.map-annotation-live-inactive,
.map-drawing-live-inactive {
    opacity: 0.22;
    filter: grayscale(0.8);
}

#versionSelect option {
    background: #111827;
    color: #f9fafb;
}
