/* Scoped styles for embeddability */
body {
    margin: 0px;
    padding: 0px;
}

body.board-viewer-standalone {
    background: grey;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

#controls {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    background: #2a2a2a;
    padding: 8px 16px;
    border-bottom: 2px solid #444;
    flex-shrink: 0;
}

#layer-controls,
#flip-controls,
#zoom-controls,
#marker-controls,
#named-marker-controls,
#view-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-right: 1px solid #555;
}

#view-controls {
    border-right: none;
    margin-left: auto;
}

#wrapper {
    position: relative;
    flex: 1;
    background: grey;
    overflow: hidden;
}

/* Forces the fullscreened container to actually fill the screen, overriding
   any fixed width/height the host page applies to it (e.g. an embed box). */
.board-viewer-fullscreen-root:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    background: grey;
}

#canvas {
    display: block;
}

#layer-info,
#marker-info {
    color: white;
    font-size: 14px;
    font-family: Arial, sans-serif;
    min-width: 90px;
    text-align: center;
}

#marker-info {
    min-width: auto;
}

#controls button {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #333;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 36px;
    font-weight: bold;
}

#controls button:hover {
    background: white;
    transform: scale(1.05);
}

#controls button:active {
    transform: scale(0.95);
}

#controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#btn-toggle-named-mode.active {
    background: #4CAF50;
    color: white;
}

/* Named Markers Panel */
#named-markers-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 280px;
    max-height: 80%;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 6px;
    overflow: hidden;
    z-index: 100;
}

#panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid #555;
}

#panel-header h3 {
    margin: 0;
    color: white;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

#btn-toggle-panel {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 0 5px;
}

#panel-content {
    max-height: 600px;
    overflow-y: auto;
    padding: 8px;
}

#panel-content.collapsed {
    display: none;
}

#named-markers-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.named-marker-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 10px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.named-marker-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.marker-item-info {
    flex: 1;
    color: white;
    font-size: 13px;
    font-family: Arial, sans-serif;
}

.marker-item-name {
    font-weight: bold;
    margin-bottom: 2px;
}

.marker-item-coords {
    font-size: 11px;
    opacity: 0.7;
}

.marker-item-actions {
    display: flex;
    gap: 4px;
}

.marker-item-actions button {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.2s;
}

.marker-item-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal Dialog */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #2a2a2a;
    padding: 20px;
    border-radius: 8px;
    min-width: 300px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin: 0 0 15px 0;
    color: white;
    font-family: Arial, sans-serif;
}

#marker-name-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #1a1a1a;
    color: white;
    font-size: 14px;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

#marker-name-input:focus {
    outline: none;
    border-color: #4CAF50;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: flex-end;
}

.modal-buttons button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

#btn-save-marker {
    background: #4CAF50;
    color: white;
}

#btn-save-marker:hover {
    background: #45a049;
}

#btn-cancel-marker {
    background: #666;
    color: white;
}

#btn-cancel-marker:hover {
    background: #777;
}