/* Style for the canvas */
body {
    touch-action: none;
    overflow: hidden;
}
canvas {
    touch-action: none;
    -webkit-touch-callout: none;
    user-select: none;
    display: block;
    width: 100%;
    height: 100vh;
    position: fixed;
    top: 0;
    right: 0;
    z-index: -1;
}
            
.controller {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
    
.btn {
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
}

/* Relocated grave info to lower right */
#graveInfo {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 10px;
    max-width: 320px;
    width: 100%;
}

.grave-box {
    border: 1px solid #e0e0e0;
    padding: 20px;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.grave-box:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.grave-name {
    margin: 0 0 12px 0;
    font-size: 22px;
    color: #333;
    font-weight: bold;
}

.grave-dates {
    margin: 6px 0;
    color: #666;
    font-size: 16px;
}

.grave-block-lot {
    margin-top: 10px;
    font-weight: bold;
    font-size: 15px;
    color: #444;
}

.grave-owner-label {
    margin-top: 18px;
    font-weight: bold;
    color: #444;
    font-size: 16px;
}

.grave-owner-name {
    margin: 6px 0;
    color: #777;
    font-size: 15px;
}

/* Search section styles */
.search-section {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.search-section h2 {
    margin: 0 0 15px 0;
    color: #333;
    font-weight: 600;
}

#graveSearchForm {
    width: 100%;
    display: flex;
    z-index: 10;
    margin-bottom: 15px;
}

#searchBox {
    touch-action: manipulation;
    padding: 6px;
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 6px 0 0 6px;
    font-size: 14px;
    outline: none;
    transition: border 0.3s;
}

#searchBox:focus {
    border-color: #4CAF50;
}

#graveSearchForm button {
    padding: 5px 10px;
    border: none;
    background-color: #4CAF50;
    color: white;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

#graveSearchForm button:hover {
    background-color: #45a049;
}

/* Recent searches box */
.recent-searches {
    margin-top: 15px;
    background-color: #f5f5f5;
    border-radius: 6px;
    padding: 10px;
}

.recent-searches h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #666;
}

.recent-searches ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recent-searches li {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s;
}

.recent-searches li:last-child {
    border-bottom: none;
}

.recent-searches li:hover {
    color: #4CAF50;
}

.sidebar-panel {
    position: fixed;
    left: 0; /* Show by default */
    width: 300px;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transition: left 0.3s ease;
    z-index: 1000;
}

.sidebar-panel.collapsed {
    left: -290px;
}

.sidebar-collapse-btn {
    position: absolute;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 80px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #666;
    transition: all 0.3s ease;
    z-index: 1001;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 1);
    color: #333;
}

.collapse-text {
    writing-mode: vertical-rl;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1px;
    color: #666;
}

/* Arrow for collapsed state */
.collapse-arrow {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.sidebar-panel.collapsed .collapse-arrow {
    transform: rotate(180deg);
}

/* Instructions section */
.instructions-section {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.instructions-section h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-weight: 600;
}

.instructions-content {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}

.instructions-content ul {
    padding-left: 18px;
    margin-top: 10px;
}

.instructions-content li {
    margin-bottom: 8px;
}

/* Autocomplete styles */
.search-wrapper {
    position: relative;
    flex: 1;
}

#autocompleteDropdown {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    border-top: 1px solid #ddd;
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background-color: #e8f5e9;
}

.autocomplete-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    font-size: 14px;
}

.autocomplete-details {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 12px;
}

.autocomplete-type {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
}

.deceased-block {
    background-color: #e3f2fd;
    color: #1976d2;
}

.deceased-apartment {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.autocomplete-location {
    color: #666;
    font-weight: 500;
}

.no-suggestions {
    padding: 15px;
    text-align: center;
    color: #999;
    font-style: italic;
}

#autocompleteDropdown::-webkit-scrollbar {
    width: 6px;
}

#autocompleteDropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#autocompleteDropdown::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#autocompleteDropdown::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Image Panel Styles */
#blockImagePanel {
    position: fixed;
    top: 100px;
    right: 20px;
    width: 350px;
    min-height: 300px;
    max-height: calc(100vh - 120px);
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #333;
    border-radius: 10px;
    padding: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
    font-family: 'Poppins', sans-serif;
    transition: transform 0.3s ease;
    overflow: hidden;
}

#imagePanelHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid #ddd;
}

#imagePanelHeader h3 {
    margin: 0;
    color: #333;
    font-size: 16px;
}

#blockImagePanel.collapsed {
    top: auto;
    bottom: 0;
    right: 20px;
    height: auto;
    min-height: 0;
    padding: 0;
    max-height: none;
    overflow: hidden;
    border-radius: 10px 10px 0 0;
}

#blockImagePanel.collapsed #imagePanelHeader {
    padding: 10px 15px;
    border-bottom: none;
}

#blockImagePanel.collapsed #imagePanelContent {
    display: none;
}

#blockImagePanel {
    transition: top 0.3s, bottom 0.3s, max-height 0.3s, min-height 0.3s;
}

.panel-close-btn {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#imagePanelContent {
    padding: 15px;
    transition: opacity 0.3s;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

#imagePanelContent::-webkit-scrollbar {
    width: 8px;
}

#imagePanelContent::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#imagePanelContent::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#imagePanelContent::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.grave-info-header {
    text-align: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.grave-info-header h2 {
    margin: 0 0 5px 0;
    color: #2c3e50;
    font-size: 18px;
}

.grave-info-header p {
    margin: 0;
    color: #7f8c8d;
    font-size: 14px;
}

.block-image {
    width: 100%;
    max-height: 250px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.image-placeholder {
    display: none;
    text-align: center;
    padding: 20px;
    background: #f0f0f0;
    border-radius: 5px;
    color: #666;
}

.image-description {
    font-size: 12px;
    color: #666;
    font-style: italic;
    margin-bottom: 10px;
}

.no-image-placeholder {
    text-align: center;
    padding: 20px;
    background: #f0f0f0;
    border-radius: 5px;
    color: #666;
    margin-bottom: 15px;
}

#blockImageContainer {
    max-height: 80vh;
    overflow-y: auto;
    padding-right: 10px;
}

#blockImageContainer::-webkit-scrollbar {
    width: 8px;
}

#blockImageContainer::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#blockImageContainer::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#blockImageContainer::-webkit-scrollbar-thumb:hover {
    background: #555;
}

#otherDeceasedList {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 10px;
}


.coordinates-info {
    margin-bottom: 15px;
    font-size: 12px;
    color: #666;
}

.path-controls {
    margin-top: 15px;
}

.path-btn {
    margin: 2px;
    padding: 5px 10px;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.path-btn.start { background: #4CAF50; }
.path-btn.stop { background: #f44336; }
.path-btn.speed { background: #2196F3; }


/* Coordinates Display */
.coords-display {
    position: absolute;
    top: 10px;
    left: 10px;
    color: white;
    background: rgba(0,0,0,0.5);
    padding: 5px;
    font-family: monospace;
    z-index: 10;
}


/* CSS for deceased navigation controls */
.deceased-navigation {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    margin: 10px 0;
    text-align: center;
}

.nav-info {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.nav-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.nav-buttons button {
    background: #007bff;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    min-width: 70px;
}

.nav-buttons button:hover:not(:disabled) {
    background: #0056b3;
}

.nav-buttons button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* View Others Button Section */
.view-others-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.view-others-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
    min-width: 150px;
    justify-content: center;
}

.view-others-btn:hover {
    background: #218838;
}

.view-others-icon {
    font-size: 16px;
}

/* View Others Button Section */
.view-others-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.view-others-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
    min-width: 150px;
    justify-content: center;
}

.view-others-btn:hover {
    background: #218838;
}

.view-others-icon {
    font-size: 16px;
}

/* Others List Styles */
.others-list {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    animation: slideDown 0.3s ease-out;
    max-height: 400px;
    display: flex;
    flex-direction: column;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.others-list h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 16px;
    text-align: center;
}

.others-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Style scrollbar for the deceased grid */
.others-grid::-webkit-scrollbar {
    width: 6px;
}

.others-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.others-grid::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 3px;
}

.others-grid::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.others-grid::after {
    content: "";
    position: absolute;
    bottom: 45px;
    right: 15px;
    left: 15px;
    height: 10px;
    background: linear-gradient(transparent, rgba(248, 249, 250, 0.8));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.others-list:hover .others-grid::after {
    opacity: 1;
}

.other-deceased-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid #6c757d;
}

.other-deceased-card:hover {
    background: #e9ecef;
    border-left-color: #007bff;
    transform: translateX(2px);
}

.deceased-name {
    font-weight: bold;
    color: #343a40;
    margin-bottom: 4px;
    font-size: 14px;
}

.deceased-dates {
    color: #6c757d;
    font-size: 12px;
}

.hide-others-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    width: 100%;
    transition: background-color 0.2s ease;
    margin-top: auto;
    flex-shrink: 0;
}

.hide-others-btn:hover {
    background: #5a6268;
}



/* Current deceased info styling */
.current-deceased-info {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 12px;
    margin: 10px 0;
    border-radius: 4px;
}

.current-deceased-info h3 {
    margin: 0 0 5px 0;
    color: #1976d2;
    font-size: 16px;
}

.current-deceased-info p {
    margin: 0;
    color: #424242;
    font-size: 13px;
}

.lot-count {
    font-size: 13px;
    color: #757575;
    font-weight: normal;
    margin: 5px 0 0 0;
}


/* Add responsiveness for smaller screens */
@media (max-width: 768px) {
     #blockImagePanel {
        top: 70px;
        right: 10px;
        left: 10px;
        width: auto;
        max-height: calc(100vh - 90px);
    }
    
    #imagePanelContent {
        max-height: calc(100vh - 170px);
    }
    
    .others-grid {
        max-height: 250px;
    }

    .sidebar-panel {
        width: 280px;
        left: -280px;
    }
    
    .sidebar-panel.mobile-active {
        left: 0;
    }
    
    .sidebar-collapse-btn {
        right: -45px;
        width: 45px;
        height: 60px;
        border-radius: 0 12px 12px 0;
    }
    
    .collapse-text {
        font-size: 10px;
    }
    
    .controller {
        right: 15px;
        gap: 8px;
    }
    
    .btn {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    
    #graveInfo {
        bottom: 20px;
        right: 20px;
        max-width: calc(100% - 40px);
        left: 20px;
        width: auto;
    }
    
    #blockImagePanel {
        top: 70px;
        right: 10px;
        left: 10px;
        width: auto;
        max-height: calc(100vh - 90px);
    }

}

@media (max-width: 480px) {
    .sidebar-panel {
        width: 260px;
        left: -260px;
    }
    
    .sidebar-collapse-btn {
        right: -40px;
        width: 40px;
        height: 50px;
    }
    
    #graveInfo {
        bottom: 15px;
        right: 15px;
        left: 15px;
        max-width: none;
    }
    
    .reset{
        display: none;
    }
}