canvas {
    display: block;
    cursor: grab;
}

canvas:active {
    cursor: grabbing;
}

/* Panel UI 
#ui-panel {
    position: absolute;
    top: 20px;
    left: 400px;
    background: var(--panel-bg);
    padding: 20px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    z-index: 100;
    width: 220px;
}*/


/* Nagłówek mapy - ustawia tytuł po lewej, a pasek narzędzi po prawej */
.header-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    width: 100%;
}

/* Map View Header & Side-Toolbar Refinement */
.map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.map-header-center {
    flex: 1;
    max-width: 500px;
}

.map-layout-vertical {
    display: flex;
    flex-direction: row;
    gap: 0; /* Sticky to map wrapper */
    height: calc(100vh - 200px);
    min-height: 550px;
}

#map-toolbar {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background: var(--panel-bg);
    width: 60px; /* Narrow icon-only width */
    padding: 20px 0;
    border: 1px solid var(--border);
    border-right: none; /* Stick to map wrapper */
    border-radius: 12px 0 0 12px;
    flex-shrink: 0;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    gap: 25px; /* Consistent spacing between groups */
    z-index: 100; /* Ensure tooltips trigger and aren't covered */
}

.map-toolbar-top, .map-toolbar-middle, .map-toolbar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.toolbar-divider {
    width: 40%;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 5px 0;
}

#map-toolbar button {
    width: 42px;
    height: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    transition: all 0.2s;
    font-size: 1.15rem;
}

#map-toolbar button:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

#map-toolbar button:active {
    background: var(--accent-light);
    color: white;
}

/* Custom Sidebar-style Tooltips for Map Toolbar */
#map-toolbar button {
    position: relative;
}

#map-toolbar button[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: #1e293b;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1001;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#map-toolbar button:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(15px);
}

#map-toolbar button.edit-active {
    background: #e74c3c;
    color: white;
    border-color: #c0392b;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.4);
}

/* Map Header Filter Group */
.map-filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 20px;
    padding-right: 20px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    height: 32px;
}

.map-filter-group i {
    color: var(--text-muted);
    font-size: 0.95rem;
    opacity: 0.8;
}

.map-header-select {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 140px;
}

.map-header-select:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-light);
    box-shadow: 0 0 10px rgba(100, 181, 246, 0.1);
}

.map-header-select:focus {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
}

.map-header-select option {
    background: #1e293b; /* Dark backdrop for options */
    color: white;
    padding: 10px;
}

/* Map Search container in its new header position */
.map-header .map-search-container {
    width: 100%;
    position: relative;
}

.map-header .search-dropdown {
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    z-index: 1001;
}

#map-wrapper {
    flex: 1;
    position: relative;
    background: var(--bg-color);
    border: 1px solid var(--border);
    border-radius: 0 12px 12px 0; /* Sticks to the left toolbar */
    overflow: hidden;
    height: 100%;
}

.btn-info-mini {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-info-mini:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-color);
}

.info-text {
    margin-top: 10px;
    color: #64748b;
    line-height: 1.4;
}

/* Tooltip */
#map-tooltip {
    position: fixed;
    background: #1e293b;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    pointer-events: none;
    display: none;
    z-index: 1000;
    border: 1px solid var(--accent);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content1 {
    background: var(--card-bg);
    border-radius: 16px;
    width: 450px;
    /* Slightly wider for better readability */
    max-width: 90vw;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbar for Modal Body to match the premium theme */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
}

.info-item label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    font-weight: 700;
}

.info-item span {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    display: block;
    word-break: break-all;
}

.info-item span.ip-field {
    color: #3b82f6;
    font-family: 'Monaco', monospace;
}

.btn-danger:hover {
    background-color: #dc2626 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.context-menu {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    min-width: 180px;
    padding: 5px 0;
}

.context-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.context-menu li {
    padding: 10px 15px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.context-menu li:hover {
    background: rgba(255, 255, 255, 0.05);
}

.context-menu li.menu-danger {
    color: #f87171;
}

.context-menu li.menu-danger:hover {
    background: rgba(248, 113, 113, 0.1);
}

/* --- Map Search Styles --- */
.map-search-container {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    margin-left: 10px;
    transition: all 0.2s;
}

.map-search-container:focus-within {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.map-search-container input {
    background: none;
    border: none;
    color: var(--text);
    padding: 8px;
    width: 200px;
    font-size: 0.9rem;
}

.map-search-container input:focus {
    outline: none;
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.search-item .type-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

/* --- Minimap Styles --- */
#minimap-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 200px;
    height: 120px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 100;
    cursor: crosshair;
}

#minimapCanvas {
    width: 100%;
    height: 100%;
}

#minimap-viewport {
    position: absolute;
    border: 1.5px solid #ef4444;
    background: rgba(239, 68, 68, 0.1);
    pointer-events: none;
    z-index: 101;
}

/* --- Blueprint Styles --- */
.blueprint-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.blueprint-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.blueprint-info h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-main);
}

.blueprint-info p {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.blueprint-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.btn-blueprint-use {
    background: var(--accent);
    color: white;
    flex-grow: 1;
    justify-content: center;
    padding: 6px;
    font-size: 0.8rem;
}

.btn-blueprint-delete {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
    padding: 6px 10px;
}

.btn-blueprint-delete:hover {
    background: rgba(239, 68, 68, 0.2);
}
