/* Combined Gene Expression and Cell Boundary Viewer Styles */

/* Cell Search Modal */
.cell-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.cell-search-dialog {
    background: #1a1a1a;
    border: 2px solid #0066cc;
    border-radius: 8px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    color: white;
}

.cell-search-dialog h3 {
    margin-top: 0;
    color: #0066cc;
    text-align: center;
}

.cell-search-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #333;
    color: #fff;
    font-size: 16px;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.cell-search-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.cell-search-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.cell-search-btn.primary {
    background: #0066cc;
    color: white;
}

.cell-search-btn.primary:hover {
    background: #0052a3;
}

.cell-search-btn.secondary {
    background: #444;
    color: white;
}

.cell-search-btn.secondary:hover {
    background: #555;
}

.cell-search-status {
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
    min-height: 20px;
}

.cell-search-status.error {
    color: #ff6b6b;
}

.cell-search-status.success {
    color: #00ff88;
}

/* Base Styles */
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    overflow: hidden;
    background-color: #000;
    color: #fff;
}

#map {
    width: 100vw;
    height: 100vh;
}

/* Gene Panel Button */
#genePanelBtn {
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
}

#genePanelBtn:hover {
    color: #007bff;
}

/* Cell Class Panel Button */
#cellClassPanelBtn {
    background: url('./cluster_3.png') no-repeat center;
    /*background-size: 20px 20px;*/
    width: 22px;
    height: 22px;
    border: none;
    cursor: pointer;
    user-select: none;
    opacity: 0.9;
    transition: all 0.2s ease;
    font-size: 0; /* Hide text */
    filter: brightness(1.2);
}

#cellClassPanelBtn:hover {
    opacity: 1;
    filter: brightness(1.4);
}

/* Aggregated Classes Button */
#aggregatedClassesBtn {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: none;
    /*padding: 8px 12px;*/
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

#aggregatedClassesBtn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-1px);
}

/* Main Controls */
.main-controls {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 4px;
    backdrop-filter: blur(10px);
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

#planeSlider {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    appearance: none;
    outline: none;
}

#planeSlider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
}

#planeSlider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#planeLabel {
    min-width: 80px;
    text-align: center;
    font-weight: normal;
    color: rgba(255, 255, 255, 0.9);
    font-family: monospace;
}

.nav-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 4px 8px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}

.nav-btn:hover {
    color: #007bff;
    background: rgba(255, 255, 255, 0.1);
}

/* Minimal Layer Controls */
.minimal-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.0);
    /*padding: 8px 12px;*/
    padding: 4px 4px;
    z-index: 10;
    border-radius: 4px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: white;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.control-item input[type="checkbox"] {
    transform: scale(0.9);
    accent-color: #007bff;
}

.control-item label {
    font-size: 13px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.9);
    user-select: none;
}

.gene-size-item {
    gap: 4px;
}

.gene-size-item input[type="range"] {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    appearance: none;
    outline: none;
}

.gene-size-item input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
}

.gene-size-item input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.gene-size-item #geneSizeValue {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    min-width: 24px;
    text-align: center;
    font-family: monospace;
}

/* Polygon Opacity Slider */
.polygon-opacity-item {
    gap: 4px;
}

.polygon-opacity-item input[type="range"] {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    appearance: none;
    outline: none;
}

.polygon-opacity-item input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
}

.polygon-opacity-item input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.polygon-opacity-item #polygonOpacityValue {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    min-width: 24px;
    text-align: center;
    font-family: monospace;
}

/* Floating Gene Widget */
.widget-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    /* Removed backdrop-filter blur to keep main window sharp */
}

.gene-widget {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 400px;
    max-height: 500px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gene-widget.dragging {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.8);
    cursor: move;
    transition: none;
}

.gene-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: move;
    user-select: none;
}

.gene-widget-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.widget-header-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.gene-widget-title {
    color: white;
    font-size: 16px;
    font-weight: 600;
}

.widget-close-btn,
.widget-undock-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.widget-close-btn {
    font-size: 24px;
}

.widget-close-btn:hover,
.widget-undock-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.widget-undock-btn:hover {
    color: #007bff;
}

.gene-widget-search {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 12px;
    align-items: center;
}

.gene-widget-search input {
    flex: 1;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 14px;
    outline: none;
}

.toggle-all-btn {
    padding: 8px 16px;
    background: #007bff;
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease;
}

.toggle-all-btn:hover {
    background: #0056b3;
}

.toggle-all-btn.unselect {
    background: #dc3545;
}

.toggle-all-btn.unselect:hover {
    background: #c82333;
}

.gene-widget-search input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.gene-widget-search input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.gene-widget-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.gene-item {
    display: flex;
    align-items: center;
    padding: 8px 20px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    gap: 12px;
}

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

.gene-checkbox {
    transform: scale(1.1);
    accent-color: #007bff;
}

.gene-glyph {
    width: 20px;
    height: 20px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
}

.gene-name {
    color: white;
    font-size: 13px;
    font-family: monospace;
    flex: 1;
}

.hidden {
    display: none !important;
}

/* Removed old animation - using new slide-in effect */

/* Scrollbar styling for widget */
.gene-widget-content::-webkit-scrollbar {
    width: 6px;
}

.gene-widget-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.gene-widget-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.gene-widget-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}


/* Loading indicator */
.loading-indicator {
    position: absolute;
    top: 60px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 16px;
    border-radius: 6px;
    z-index: 10;
    display: none;
}

/* Minimize button */
.minimize-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #dc3545;
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-controls.minimized {
    height: 40px;
    overflow: hidden;
}

.layer-controls.minimized .control-section {
    display: none;
}

/* Tooltip */
#tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    display: none;
    white-space: nowrap;
    z-index: 1000;
    max-width: 300px;
}

/* Scale Bar */
.scale-bar {
    position: absolute;
    bottom: 15px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
    z-index: 10;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.scale-bar-line {
    width: 100px;
    height: 2px;
    background: white;
    border-radius: 1px;
}

.scale-bar-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: normal;
    white-space: nowrap;
}

/* Coordinate Display */
.coordinate-display {
    position: fixed;
    bottom: 15px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    z-index: 1000;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.coordinate-display span {
    color: rgba(255, 255, 255, 0.9);
}