/* Base styles */
body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    background-color: #1a1a1a;
    color: white;
    min-height: 100vh;
    overflow: hidden;
}

#map {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 1;
}

/* Mobile toggle buttons */
.sidebar-toggle {
    display: none;
}

/* Sidebars */
.sidebar,
.right-sidebar {
    position: fixed;
    background: rgba(33, 33, 33, 0.95);
    color: #ffffff;
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 900;
}

.modal-pull-indicator {
    margin-bottom: 1px;
}

.sidebar {
    left: 0;
    bottom: 0;
    border-radius: 0;
    padding: 15px;
    width: 380px;
}

.right-sidebar {
    right: 20px;
    top: 80px;
    bottom: 20px;
    border-radius: 8px;
    margin-top: 15px;
    padding-top: 20px;
    padding-right: 15px;
    padding-bottom: 15px;
    padding-left: 15px;
    width: 350px;
}

/* Mobile styles */
@media (max-width: 768px) {
    .sidebar {
        width: 320px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .right-sidebar {
        width: 280px;
    }

    .resource-toggles-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
    }
}

/* Custom scrollbar styles */
.sidebar::-webkit-scrollbar,
.right-sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track,
.right-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb,
.right-sidebar::-webkit-scrollbar-thumb {
    background: rgba(33, 150, 243, 0.6);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.right-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(33, 150, 243, 0.8);
}

/* Resource toggles */
.resource-toggles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-top: 10px;
}

.resource-toggle {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    transition: all 0.2s;
    cursor: pointer;
    user-select: none;
}

.resource-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.resource-toggle input[type="checkbox"] {
    pointer-events: none;
}

.resource-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.resource-icon {
    margin-right: 4px;
    font-size: 14px;
    pointer-events: none;
}

/* Category header */
.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 8px;
}

.category-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
    color: #2196F3;
}

/* Map selector */
.map-selector h2 {
    margin: 0 0 15px 0;
    color: #ffffff;
    font-size: 22px;
}

/* Areas toggle section */
.areas-toggle {
    margin-bottom: 15px;
    margin-top: 15px;
    padding: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.areas-toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    width: 100%;
    box-sizing: border-box;
}

.areas-toggle-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
    color: #2196F3;
}

/* Dino selector */
.dino-selector {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.dino-selector h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: bold;
    color: #2196F3;
}

.dino-select {
    width: 100%;
    padding: 8px;
    background: rgba(33, 33, 33, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 15px;
    cursor: pointer;
}

.dino-select option {
    background: rgba(33, 33, 33, 0.95);
    color: white;
    padding: 8px;
}

/* Nest controls */
.nest-controls {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.nest-controls h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: bold;
    color: #2196F3;
}

.nest-button {
    background: #2196F3;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    height: 32px;
    line-height: 1;
}

.nest-button:hover {
    background: #1976D2;
}

.target-button {
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    padding: 8px 12px;
    height: 32px;
    line-height: 1;
    transition: background 0.2s;
}

.target-button:hover {
    background: #1976D2;
}

.nest-list {
    margin-top: 10px;
}

.nest-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px;
    margin: 5px 0;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nest-item-info {
    flex-grow: 1;
    margin-right: 10px;
}

.nest-item-actions {
    display: flex;
    gap: 5px;
}

/* Custom delete confirmation modal */
.delete-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(33, 33, 33, 0.95);
    padding: 20px;
    border-radius: 8px;
    z-index: 9002;
    width: 300px;
    display: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 90%;
}

.delete-modal h4 {
    margin: 0 0 15px 0;
    color: #ff4444;
    font-size: 16px;
}

.delete-modal p {
    margin: 0 0 20px 0;
    color: white;
    font-size: 14px;
    line-height: 1.4;
}

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

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

.delete-modal-button.confirm {
    background: #ff4444;
    color: white;
}

.delete-modal-button.confirm:hover {
    background: #cc0000;
}

.delete-modal-button.cancel {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.delete-modal-button.cancel:hover {
    background: rgba(255, 255, 255, 0.2);
}

.delete-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9001;
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar, .right-sidebar {
        width: 250px;
    }
    
    .info-panel {
        width: 250px;
    }
    
    .resource-toggles-grid {
        grid-template-columns: 1fr;
    }
}

/* POI Overlay Styles */
.poi-polygon {
    fill-opacity: 0.3 !important; /* Make polygons semi-transparent */
    stroke-width: 2px;
    transition: fill-opacity 0.2s;
}

.poi-polygon:hover {
    fill-opacity: 0.5 !important; /* Increase opacity on hover */
}

.poi-polygon.highlighted {
    stroke-width: 3px;
    stroke: #FFD700 !important; /* Golden stroke for highlighted POIs */
}

/* Hover info */
.hover-info {
    display: none;
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
    transform: translate(-50%, -100%);
    margin-top: -10px;
}

.hover-content {
    text-align: center;
}

.hover-content strong {
    color: #2196F3;
}

/* CRITICAL FIX: Completely disable hover effects for POI layers */
.ol-layer canvas {
    pointer-events: auto !important;
}

/* Force POI layers to be non-interactive */
[data-poi-layer="true"] {
    pointer-events: none !important;
}

/* Ensure POI polygons don't change on hover */
.poi-polygon:hover {
    fill-opacity: 0.3 !important;
    stroke-width: 2px !important;
    cursor: default !important;
}

/* Override any OpenLayers hover effects */
.ol-selectable {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    pointer-events: auto !important;
}

/* Modal styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9000;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--card-bg, #2a2a2a);
    padding: 25px;
    border: 1px solid var(--border-color, #333333);
    border-radius: 8px;
    width: 80%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    color: var(--text-color, #e6e6e6);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%);
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close:hover,
.close:focus {
    color: var(--primary-color, #ff763c);
    text-decoration: none;
}

.modal h2 {
    margin-top: 0;
    color: var(--primary-color, #ff763c);
    border-bottom: 1px solid var(--border-color, #333333);
    padding-bottom: 10px;
}

.modal p {
    margin: 20px 0;
    line-height: 1.5;
}

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

/* Form styling */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-control {
    background-color: #2c2c2c;
    border: 1px solid var(--border-color, #333333);
    color: var(--text-color, #e6e6e6);
    padding: 8px 12px;
    border-radius: 4px;
    width: 100%;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

/* Button Styles */
.sidebar .btn,
.right-sidebar .btn,
.modal .btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.sidebar .btn-primary,
.right-sidebar .btn-primary,
.modal .btn-primary {
    background-color: var(--primary-color, #ff763c);
    color: white;
}

.sidebar .btn-primary:hover,
.right-sidebar .btn-primary:hover,
.modal .btn-primary:hover {
    background-color: var(--secondary-color, #e66a35);
}

.sidebar .btn-secondary,
.right-sidebar .btn-secondary,
.modal .btn-secondary {
    background-color: #555;
    color: white;
}

.sidebar .btn-secondary:hover,
.right-sidebar .btn-secondary:hover,
.modal .btn-secondary:hover {
    background-color: #444;
}

/* OpenLayers Map Controls */
.ol-zoom {
    position: fixed !important;
    right: 10px !important;
    bottom: 10px !important;
    left: auto !important;
    top: auto !important;
}

.ol-zoom .ol-zoom-in,
.ol-zoom .ol-zoom-out {
    background: rgba(33, 33, 33, 0.95) !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    margin: 2px !important;
    transition: background 0.2s !important;
}

.ol-zoom .ol-zoom-in:hover,
.ol-zoom .ol-zoom-out:hover {
    background: rgba(50, 50, 50, 0.95) !important;
}

/* Area styles */
.area {
    fill-opacity: 0.5;
    stroke: rgba(255, 255, 255, 0.3);
    stroke-width: 1;
}

.area-preferred {
    fill: rgba(0, 255, 0, 0.3) !important;
    stroke: rgba(0, 255, 0, 0.8) !important;
}

.area-disliked {
    fill: rgba(255, 0, 0, 0.3) !important;
    stroke: rgba(255, 0, 0, 0.8) !important;
}

/* POI Info Panel */
.info-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 300px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.info-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: rgba(50, 50, 50, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.info-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

.close-button {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.info-panel-content {
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.poi-info-item {
    margin-bottom: 10px;
}

.poi-info-item:last-child {
    margin-bottom: 0;
}

.poi-info-item strong {
    display: inline-block;
    margin-right: 5px;
    color: #FFD700;
}

/* Map container */
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* Resource toggles */
.resource-category {
    margin-bottom: 15px;
    padding: 0 15px;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.category-header h3 {
    margin: 0;
    font-size: 16px;
}

.resource-toggle {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
}

.resource-toggle input[type="checkbox"] {
    margin-right: 8px;
}

.resource-icon {
    margin-right: 8px;
    font-size: 16px;
}

.resource-toggles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.resource-toggle.toggle-all {
    margin: 0;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.toggle-all-checkbox {
    margin: 0 8px 0 0;
    pointer-events: none;
}

.toggle-all-label {
    font-size: 14px;
    pointer-events: none;
    white-space: nowrap;
    color: #ffffff;
}

/* Nest Modal Styles */
.nest-modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9500;
}

.nest-modal-container {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    background: rgba(33, 33, 33, 0.95);
    padding: 25px;
    border-radius: 8px;
    width: 350px;
    color: white;
    z-index: 9501;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    max-width: 90%;
}

.nest-modal-content {
    width: 100%;
}

.nest-modal-container h3 {
    margin: 0 0 15px 0;
    color: #2196F3;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

/* Mobile sidebar toggle buttons */
.left-sidebar-toggle,
.right-sidebar-toggle {
    display: none;
}

/* Update font loading to use system fonts instead of Google Fonts */
body, .navbar, .nav-link, .dino-link, .markdown-content {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

/* Force POI layers to be non-interactive */
.ol-layer-vector-poi {
    pointer-events: none !important;
}

/* Map layers control - floating box */
.map-layers-control {
    position: absolute;
    top: 120px; /* Increased from 70px to add more space from navbar */
    left: 10px;
    z-index: 1000;
    background: rgba(26, 26, 26, 0.95);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 15px;
    min-width: 180px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.map-layers-control h3 {
    margin: 0 0 12px 0;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

/* Hide the old sidebars on desktop */
.left-sidebar {
    display: none;
}

.left-sidebar-toggle {
    display: none !important;
}

/* Updated right sidebar styles - override existing ones */
.right-sidebar {
    position: absolute;
    right: 10px;
    top: 120px;
    bottom: 20px;
    width: 320px;
    background: rgba(26, 26, 26, 0.95);
    border: 1px solid #444;
    border-radius: 8px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Remove old padding */
    padding: 0;
}

.right-sidebar-toggle {
    position: absolute;
    top: 120px;
    right: 10px;
    z-index: 1000;
    background: rgba(26, 26, 26, 0.95);
    color: white;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    display: none; /* Hidden by default, shown on mobile */
}

/* Visibility toggle styles */
.visibility-toggle {
    margin-bottom: 10px;
}

.visibility-toggle:last-child {
    margin-bottom: 0;
}

.toggle-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: #444;
    border-radius: 20px;
    margin-right: 10px;
    transition: background-color 0.3s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-container input[type="checkbox"] {
    display: none;
}

.toggle-container input[type="checkbox"]:checked + .toggle-slider {
    background-color: #4CAF50;
}

.toggle-container input[type="checkbox"]:checked + .toggle-slider::after {
    transform: translateX(20px);
}

.toggle-label {
    color: #fff;
    font-size: 14px;
}

/* Tab styles */
.tab-navigation {
    display: flex;
    background: rgba(40, 40, 40, 0.95);
    border-bottom: 1px solid #555;
}

.tab-button {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
}

.tab-button:hover {
    background: rgba(60, 60, 60, 0.5);
}

.tab-button.active {
    color: #fff;
    border-bottom: 2px solid #4CAF50;
}

.tab-content {
    padding: 15px;
    flex: 1;
    min-height: 0; /* Important for flexbox overflow */
    display: flex;
    flex-direction: column;
}

.tab-pane {
    display: none !important; /* Force hide inactive tabs */
    height: 100%;
}

.tab-pane.active {
    display: flex !important; /* Force show active tab */
    flex-direction: column;
    height: 100%;
}

/* Character list styles */
.character-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* Important for flexbox overflow */
}

/* Nest list styles */
.nest-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

#characters-tab h3 {
    margin: 0 0 15px 0;
    color: #fff;
    flex-shrink: 0; /* Prevent h3 from shrinking */
}

/* Ensure tab content fills parent */
#characters-tab {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#nests-tab {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.character-item {
    background: rgba(40, 40, 40, 0.5);
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.character-item:hover {
    background: rgba(50, 50, 50, 0.7);
    border-color: #666;
}

.character-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.character-name {
    font-weight: bold;
    color: #fff;
}

.character-species {
    font-size: 12px;
    color: #aaa;
}

.character-emoji {
    font-size: 24px;
}

.target-button {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid #4CAF50;
    color: #4CAF50;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.target-button:hover {
    background: rgba(76, 175, 80, 0.4);
    transform: scale(1.1);
}

#nests-tab .nest-button {
    margin: 15px 15px 10px 15px;
    flex-shrink: 0;
}

#nests-tab .nest-list {
    padding: 0 15px 15px 15px;
}

/* Mobile styles */
@media (max-width: 768px) {
    .left-sidebar-toggle,
    .right-sidebar-toggle {
        display: block;
    }
    
    .left-sidebar,
    .right-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .right-sidebar {
        transform: translateX(100%);
    }
    
    .left-sidebar.active {
        transform: translateX(0);
    }
    
    .right-sidebar.active {
        transform: translateX(0);
    }
}

/* Map loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Map preview layer */
.map-preview-layer {
    image-rendering: optimizeSpeed;
    image-rendering: -webkit-optimize-contrast;
}