:root {
    --primary-color: #007bff;
    --danger-color: #dc3545;
    --bg-light: #f8f9fa;
    --border-color: #dee2e6;
    --drawer-width: 320px;
  }
  
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
  }
  
  /* Base App Layout (Full Desktop Viewport) */
  .app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
  }
  
  .map-viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
  }
  
  #map {
    width: 100%;
    height: 100%;
  }
  
  /* Collapsible Side Drawers */
  .sidebar-left,
  .sidebar-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: var(--drawer-width);
    background: var(--bg-light);
    padding: 15px;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease-in-out;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
  }
  
  .sidebar-left {
    left: 0;
    border-right: 1px solid var(--border-color);
    transform: translateX(-100%);
  }
  
  .sidebar-left.open {
    transform: translateX(0);
  }
  
  .sidebar-right {
    right: 0;
    border-left: 1px solid var(--border-color);
    transform: translateX(100%);
  }
  
  .sidebar-right.open {
    transform: translateX(0);
  }
  
  /* Drawer Toggle Triggers */
  .drawer-toggle-btn {
    position: absolute;
    top: 15px;
    z-index: 90;
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
  }
  
  #toggle-left-drawer {
    left: 15px;
  }
  
  #toggle-right-drawer {
    bottom: 20px;
    right: 20px;
    top: auto;
  }
  
  /* Close Buttons Inside Sidebars */
  .drawer-close-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    font-weight: bold;
    color: #64748b;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
  }
  
  .drawer-close-btn:hover {
    color: var(--danger-color);
  }
  
  /* Headers & Divider */
  .sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
  }
  
  .divider {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 10px 0;
  }
  
  /* Form Controls & Checkboxes */
  .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0;
  }
  
  .checkbox-label,
  .radio-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    margin: 6px 0;
  }
  
  .checkbox-label input[type="checkbox"],
  .radio-container input[type="radio"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
  }
  
  /* Accordion Controls */
  .accordion-item {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
  }
  
  .accordion-header {
    width: 100%;
    background: #f1f5f9;
    border: none;
    padding: 10px;
    text-align: left;
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
  }
  
  .accordion-content {
    padding: 10px;
    display: none;
    background: #ffffff;
  }
  
  .accordion-content.active {
    display: block;
  }
  
  /* Buttons */
  .btn-clear-all {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
  }
  
  .btn-explorer,
  .primary-btn,
  .secondary-btn {
    width: 100%;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    margin-top: 8px;
    border: none;
  }
  
  .btn-explorer,
  .primary-btn {
    background: var(--primary-color);
    color: white;
  }
  
  .secondary-btn {
    background: #28a745;
    color: white;
  }
  
  /* Floating Map Tools */
  .layer-switcher {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: white;
    padding: 6px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
    display: flex;
    gap: 6px;
  }
  
  .switcher-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
  }
  
  .switcher-btn.active {
    background: var(--primary-color);
    color: white;
  }
  
  /* Dynamic Legend Container & Items */
  .map-dynamic-legend {
    position: absolute;
    bottom: 70px;
    right: 20px;
    z-index: 80;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #2c3e50;
    border-radius: 6px;
    padding: 10px 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 250px;
    overflow-y: auto;
    min-width: 190px;
  }
  
  .map-dynamic-legend .legend-header {
    font-weight: bold;
    font-size: 13px;
    color: #2c3e50;
    border-bottom: 1px solid #cbd5e1;
    padding-bottom: 5px;
    margin-bottom: 8px;
  }
  
  .legend-row {
    display: flex !important;
    align-items: center !important;
    margin-bottom: 6px;
    font-size: 12px;
    color: #334155;
  }
  
  .legend-color-box {
    width: 18px !important;
    height: 12px !important;
    margin-right: 8px !important;
    border: 1px solid #000000;
    display: inline-block !important;
    flex-shrink: 0;
  }
  
  /* Modals */
  .modal-overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
  }
  
  .modal-dialog {
    background: white;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    border-radius: 8px;
    padding: 20px;
    overflow-y: auto;
    position: relative;
  }
  
  .modal-close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 24px;
    cursor: pointer;
    font-weight: bold;
  }
  
  /* Responsive Fixes for Mobile Only */
  @media (max-width: 768px) {
    :root {
      --drawer-width: 85vw;
    }
  }

/* File Explorer Modal */
/* Image Preview Lightbox Modifications */
#viewerModal .modal-dialog.image-modal-dialog {
    background: rgba(15, 23, 42, 0.95);
    max-width: 90vw;
    max-height: 90vh;
    padding: 40px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
  }
  
  .lightbox-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1200;
    line-height: 1;
    transition: color 0.2s ease;
  }
  
  .lightbox-close-btn:hover {
    color: #ef4444;
  }
  
  .image-preview-container {
    width: 100%;
    max-height: 75vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto; /* Allows smooth panning if image exceeds viewport */
  }
  
  #imgPreview {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  }
  
  .lightbox-caption {
    color: #f8fafc;
    margin-top: 12px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
  }

  /* Explorer Modal 4-Column Layout */
.modal-dialog.explorer-modal-dialog {
    max-width: 1100px;
    width: 92%;
    max-height: 85vh;
  }
  
  .explorer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 15px;
  }
  
  .explorer-column {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    max-height: 60vh;
  }
  
  .column-title {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: 10px;
  }
  
  .explorer-column .file-tree {
    overflow-y: auto;
    padding-left: 0;
    margin: 0;
  }
  
  .explorer-column .file-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
  }
  
  .explorer-column .file-item span {
    word-break: break-all;
    font-size: 12px;
    color: #334155;
  }
  
  .explorer-column .file-actions {
    display: flex;
    gap: 4px;
    width: 100%;
  }
  
  .explorer-column .file-actions button,
  .explorer-column .file-actions a {
    margin-left: 0;
    flex: 1;
    text-align: center;
  }
  
  /* Responsive fallback for smaller screens */
  @media (max-width: 992px) {
    .explorer-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  
  @media (max-width: 576px) {
    .explorer-grid {
      grid-template-columns: 1fr;
    }
  }