/* Global Layout Settings */
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-color: #1a1a1a;
}

#openclosenavbar {
    position: fixed;
    top: 100px;
    left: 320px;
    z-index: 1200;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 173, 181, 0.35);
    border-radius: 0 18px 18px 0;
    padding: 12px;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.35);
    color: #002544;
    width: auto;
}

#navbar {
    z-index: 1000;
}

#navbar.hidden {
    display: none;
}

#eventhistory {
    z-index: 1100;
}

#eventhistory.hidden {
    display: none;
}

/* Sidebar Styles */
.sidebar {
    width: 320px;
    background: #002d55;
    color: #eceff1;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
    padding: 20px;
    background: #393e46;
    border-bottom: 2px solid #2197d3;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.5px;
}

.sidebar-header .subtitle {
    font-size: 11px;
    color: #2197d3;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid #393e46;
}

.sidebar-section h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 14px;
    color: #b2bec3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tool-palette {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1200;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 173, 181, 0.35);
    border-radius: 18px;
    padding: 12px;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.35);
    color: #002544;
}

.history-panel {
    height: 100%;
    background: #7dacda;
    border: 1px solid rgba(0, 173, 181, 0.35);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.history-back-btn {
    padding: 10px 14px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
}

.history-title {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.history-play-btn {
    white-space: nowrap;
}

.history-note-panel {
    display: grid;
    gap: 10px;
}

.history-note-input {
    min-height: 88px;
    resize: vertical;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #3d5772;
    background: #597da1;
    color: #f5f8ff;
    width: -webkit-fill-available;
}

.history-list {
    overflow-y: auto;
    max-height: 50vh;
    display: grid;
    gap: 10px;
    padding-right: 4px;
}

.history-event-item {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e6e6e6;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.history-event-item:hover,
.history-event-item.selected {
    background: rgba(0, 173, 181, 0.16);
    transform: translateX(2px);
}

.history-event-title {
    font-size: 13px;
    font-weight: 700;
    color: #f4f4f4;
}

.history-event-meta {
    font-size: 11px;
    color: #ffffff;
    margin-top: 4px;
}

.history-event-note {
    white-space: pre-wrap;
    margin-top: 8px;
    font-size: 14px;
    color: #ffffff;
}

.history-event-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.history-event-delete {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #ff7f7f;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
}

.history-footer {
    bottom: 20px !important;
}

.history-status {
    font-size: 12px;
    color: #000986;
    flex: 1;
    margin-bottom: 10px;
}

.history-next-btn {
    width: 142px;
}

.tool-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.tool-btn {
    width: 100%;
    margin: 10px 0px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #f1f4f8;
    padding: 0;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover,
.tool-btn.active {
    background: rgba(0, 173, 181, 0.18);
    transform: translateY(-1px);
}

.tool-btn > img {
    width: 24px;
    height: 24px;
    color: white;
}

.tool-settings {
    display: grid;
    gap: 10px;
    margin-top: 8px;
}

.tool-settings.hidden {
    display: none;
}

.tool-row {
    display: grid;
    gap: 6px;
}

.color-palette {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

#customBrushColor {
    width: 100%;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: #fff;
}

.tool-palette input[type="number"],
.tool-palette input[type="range"] {
    width: 100%;
}

footer#pageFooter {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: end;
    gap: 10px;
    padding: 5px 20px;
    background: #c0392b;
    color: #fff;
    z-index: 1;
    font-size: 13px;
}

footer#pageFooter a,
.footer-link {
    color: #fff;
    text-decoration: none;
    margin-right: 12px;
    background: rgba(255, 255, 255, 0.08);
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

footer#pageFooter a:hover,
.footer-link:hover {
    background: rgba(255, 255, 255, 0.16);
}

.modal.hidden {
    display: none;
}

.modal-body {
    color: #e6e6e6;
}

.modal-body a {
    color: #7dacda;
}

/* UI Elements */
.form-control {
    width: 100%;
    padding: 10px;
    background: #393e46;
    border: 1px solid #4f5660;
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: #7dacda;
    background: #4f5660;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #7dacda;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.unit-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-unit {
    background: #393e46;
    color: #fff;
    border: 1px solid #2197d3;
    text-align: left;
}

.btn-unit:hover {
    background: #2197d3;
    color: #002d55;
}

.btn-primary {
    background: #2197d3;
    color: #2197d3;
    font-weight: 600;
}

.btn-primary:hover {
    background: #002d55;
}

.btn-secondary {
    background: #393e46;
    color: #7dacda;
    border: 1px solid #7dacda;
}

.btn-secondary:hover {
    background: #7dacda;
    color: #002d55;
}

.btn-danger {
    background: #d63031;
    color: white;
}

.btn-danger:hover {
    background: #ff7675;
}

.bottom-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.music-control {
    display: flex;
    gap: 8px;
    align-items: center;
}

.music-control select {
    flex-grow: 1;
}

.btn-music {
    padding: 12px 16px;
    background: #7dacda;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

.btn-music:hover {
    background: #0093a1;
}

.btn-music.playing {
    background: #2ecc71;
}

.modal-wide {
    width: min(700px, 95vw);
    max-height: 80vh;
    overflow-y: auto;
}

.guide-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.guide-section h4 {
    margin: 0 0 8px 0;
    font-size: 15px;
    color: #7dacda;
}

.guide-section p {
    margin: 0;
    font-size: 13px;
    color: #cbd5e1;
    line-height: 1.5;
}

.guide-checkbox {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.guide-checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #cbd5e1;
}

.guide-checkbox input {
    cursor: pointer;
    accent-color: #7dacda;
}

/* Selection and Grouping Styles */
.selection-box {
    position: absolute;
    border: 2px dashed #7dacda;
    background: rgba(125, 172, 218, 0.1);
    pointer-events: none;
    z-index: 999;
}

.leaflet-marker-icon.selected {
    filter: drop-shadow(0 0 8px #7dacda);
    opacity: 0.9;
}

.group-modal {
    position: fixed;
    bottom: 20px;
    left: 350px;
    background: rgba(22, 29, 43, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px;
    color: #f1f4f8;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
    z-index: 1100;
    min-width: 220px;
}

.group-modal.hidden {
    display: none;
}

.group-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
}

.group-modal-content .btn {
    width: 100%;
    margin-top: 8px;
}

/* Blob/Cluster Styles */
.cluster-blob {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.cluster-blob:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.6);
}

.cluster-blob-icon {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.cluster-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(22, 29, 43, 0.98);
    border: 1px solid rgba(0, 173, 181, 0.3);
    border-radius: 12px;
    padding: 0;
    color: #f1f4f8;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    z-index: 1200;
    min-width: 300px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.cluster-modal.hidden {
    display: none;
}

.cluster-modal-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cluster-modal-header h3 {
    margin: 0;
    color: #7dacda;
    font-size: 16px;
}

.cluster-members-list {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cluster-member-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(125, 172, 218, 0.2);
}

.cluster-member-item:hover {
    background: rgba(125, 172, 218, 0.1);
    border-color: rgba(125, 172, 218, 0.5);
    transform: translateX(4px);
}

.cluster-member-item img {
    border-radius: 4px;
    object-fit: cover;
}

.cluster-member-item span {
    font-size: 13px;
    font-weight: 500;
}

.laser-dot {
    position: absolute;
    z-index: 9999;
}


/* Map Container */
#map {
    flex-grow: 1;
    height: 100%;
    background: #f5f0e6;
    z-index:0;
}

/* Interactive Popup controls inside map */
.unit-popup-container {
    min-width: 160px;
    padding: 5px 0;
}

.unit-popup-title {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 14px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 4px;
}

.unit-popup-control {
    margin-bottom: 10px;
}

.unit-popup-control label {
    font-size: 11px;
    color: #666;
    display: block;
    margin-bottom: 3px;
}

.slider-input {
    width: 100%;
}

.btn-popup-action,
.btn-popup-delete {
    color: white;
    border: none;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    font-size: 12px;
    text-align: center;
}

.btn-popup-action {
    background: #00adb5;
    margin-bottom: 8px;
}

.btn-popup-action:hover {
    background: #0093a1;
}

.btn-popup-delete {
    background: #e74c3c;
}

.btn-popup-delete:hover {
    background: #c0392b;
}

/* Akkordeon Styling */
.accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.accordion-item {
    border: 1px solid #393e46;
    border-radius: 4px;
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    padding: 12px;
    background: #2e3440;
    color: #fff;
    border: none;
    cursor: pointer;
    text-align: left;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.accordion-header:hover {
    background: #3b4252;
}

.accordion-header .arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
    color: #7dacda;
}

/* Inhalt standardmäßig versteckt */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out, padding 0.25s ease-out;
    background: #1a1c23;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 10px;
}

/* Wenn das Akkordeon aktiv ist */
.accordion-item.active .accordion-content {
    max-height: 400px; /* Groß genug für die längste Liste, scrollt falls nötig */
    overflow-y: auto;
    padding: 10px;
}

.accordion-item.active .accordion-header .arrow {
    transform: rotate(180deg);
}

/* Scrollbar für lange Akkordeon-Listen */
.accordion-content::-webkit-scrollbar {
    width: 4px;
}
.accordion-content::-webkit-scrollbar-thumb {
    background: #7dacda;
    border-radius: 2px;
}

/* Timer Overlay and Modal Styles */
.timer-area {
    position: absolute;
    right: 20px;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1100;
    pointer-events: none;
}

.timer-card {
    pointer-events: auto;
    min-width: 260px;
    background: rgba(22, 29, 43, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #f1f4f8;
    padding: 12px;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
}

.timer-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.timer-label {
    font-size: 13px;
    font-weight: 700;
}

.timer-time {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
}

.timer-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.timer-edit-btn,
.timer-abort-btn-text,
.timer-abort-btn {
    border: none;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    background: #2f3b56;
    color: #f1f4f8;
    font-size: 13px;
}

.timer-abort-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.timer-edit-btn:hover,
.timer-abort-btn-text:hover,
.timer-abort-btn:hover {
    background: #1e2a40;
}

.timer-adjust-menu {
    margin-top: 10px;
    padding: 10px;
    background: rgba(33, 44, 65, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    display: grid;
    gap: 8px;
}

.timer-adjust-menu.hidden {
    display: none;
}

.timer-adjust-group {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.timer-adjust-group button {
    padding: 8px 6px;
    border: none;
    border-radius: 6px;
    background: #0f1723;
    color: #f1f4f8;
    cursor: pointer;
    font-size: 12px;
}

.timer-adjust-group button:hover {
    background: #1d273d;
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1200;
}

.modal.hidden {
    display: none;
}

.modal-card {
    width: min(520px, 100%);
    background: #152133;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 24px 55px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #f1f4f8;
}

.modal-close {
    background: transparent;
    border: none;
    color: #f1f4f8;
    font-size: 22px;
    cursor: pointer;
}

.modal-body {
    padding: 18px 22px;
    display: grid;
    gap: 16px;
}

.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #e9eef5;
}

.radio-group input {
    accent-color: #7dacda;
}

.modal-actions {
    padding: 18px 22px 22px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-primary {
    background: #7dacda;
    color: #fff;
}

.btn-secondary {
    background: #1f324d;
    color: #fff;
}

.btn-primary:hover,
.btn-secondary:hover {
    opacity: 0.95;
}

.modal-form-row {
    display: grid;
    gap: 10px;
}

.modal-form-row label {
    font-size: 13px;
    color: #cbd5e1;
}

.modal-form-row input,
.modal-form-row select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #1a2536;
    color: #f1f4f8;
}

.modal-form-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.message-toast {
    position: absolute;
    left: 50%;
    top: 16px;
    transform: translateX(-50%);
    background: rgba(15, 33, 55, 0.95);
    color: #f1f4f8;
    padding: 12px 16px;
    border-radius: 999px;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.2);
    z-index: 1300;
    transition: opacity 0.25s ease;
}

.message-toast.hidden {
    opacity: 0;
    pointer-events: none;
}

.laser-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 80, 80, 0.95);
    box-shadow: 0 0 18px rgba(255, 80, 80, 0.85);
    pointer-events: none;
/*    animation: laserFade 2s ease-out forwards;*/
}

@keyframes laserFade {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.8); }
}

.shape-handle-icon {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #7dacda;
    border: 2px solid #fff;
    box-shadow: 0 0 12px rgba(125, 172, 218, 0.6);
}

.transfer-target-circle {
    width: 24px;
    height: 24px;
    border-color: #6ee7b7;
    background: rgba(110, 231, 183, 0.35);
    position: relative;
}

.transfer-target-circle::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: rgba(110, 231, 183, 0.75);
    animation: pulse 1.4s ease-out infinite;
}

@keyframes pulse {
    0% { transform: scale(0.7); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}
