@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap");
:root {
    --background-color: #ecedff;
}
.m-content {
    grid-template-rows: auto 1fr;
    grid-template-columns: 240px 1fr;
    grid-template-areas: "topbar topbar" "sidebar main";
    min-height: 100vh;
    flex-direction: column;
}
.top-status-bar {
    grid-area: statusbar;
    background-color: #ccc; /* Silver */
    color: #333;
    padding: 5px 20px;
    display: flex;
    justify-content: flex-end; /* Aligns content to the right */
    align-items: center;
    font-size: 13px;
    z-index: 1001;
}
.top-status-bar a {
    color: #333;
    text-decoration: none;
    font-weight: 600;
}
.top-status-bar a:hover {
    text-decoration: underline;
}

/* Collapse sidebar by switching the first column to 0 */
.m-content.sidebar-closed {
    grid-template-columns: 0 1fr;
}

/* Collapse sidebar on small screens by default */
@media (max-width: 950px) {
    .m-content { grid-template-columns: 0 1fr; }
}

.m-navbar { grid-area: topbar; }
.sidebar { grid-area: sidebar; }
.main--content { grid-area: main; padding-top: 0; }

input.bd-date[readonly] {
    background-color: #fff !important;
    cursor: pointer !important;
    opacity: 1 !important;
    color: #212529 !important;
}
.fas.fa-trash-alt:hover {
    color: #dc3545 !important;
}

/* Loading Spinner Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #fff;
    font-size: 16px;
    margin-top: 15px;
    text-align: center;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

/* Screen vs Print specific images */
.screen-only {
    display: block;
}

.print-only {
    display: none;
}

@media print {
    .screen-only {
        display: none;
    }
    
    .print-only {
        display: block;
    }
}

#infoModal .modal-header .close {
    margin: 0;
    padding: 0.5rem 0.75rem;
    line-height: 1;
}
.custom-tooltip-upazila {
    font-weight: bold;
    box-shadow: none;
    background: none;
    border: none;
    text-shadow:
        -1px -1px 0 white,
        1px -1px 0 white,
        -1px 1px 0 white,
        1px 1px 0 white,
        -2px 0 0 white,
        2px 0 0 white,
        0 -2px 0 white,
        0 2px 0 white;
}
.custom-tooltip-union {
    box-shadow: none;
    background: none;
    border: none;
}
.custom-tooltip-depth {
    background: none;
    border: none;
    box-shadow: none;
    fill: black;
    paint-order: stroke;
    stroke: white;
    stroke-width: 2px;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.custom-tooltip-river {
    font-weight: light;
    border: none;
    box-shadow: none;
    color: black;
    letter-spacing: 3px;
    padding: 0px 5px;
    background-color: white;
}
.custom-font {
    font-size: 0.8rem;
}

/* Toggle Switch */
.switch-container {
    display: inline;
}
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}
.slider::before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--primary-color);
}
input:checked + .slider::before {
    transform: translateX(25px);
}
input:focus + .slider,
.switch:hover .slider {
    box-shadow: 0 0 1px #2196f3;
}
.slider::after {
    content: "Off";
    color: #333;
    position: absolute;
    font-size: 14px;
    top: 5.5px;
    right: 10px;
    font-weight: bold;
}
input:checked + .slider::after {
    content: "On";
    left: 10px;
    right: auto;
    color: #fff;
}

/* FIRST AQUIFER TOGGLE SWITCH ------------------------- */
#firstAquiferToggle + .slider {
    width: 85px;
}
#firstAquiferToggle + .slider::after {
    content: "FIRST";
    right: 10px;
}
#firstAquiferToggle:checked + .slider::before {
    transform: translateX(51px);
}
#firstAquiferToggle:checked + .slider::after {
    content: "FIRST";
    left: 10px;
    right: auto;
}

/* SECOND AQUIFER TOGGLE SWITCH ------------------------ */
#secondAquiferToggle + .slider {
    width: 105px;
}
#secondAquiferToggle + .slider::after {
    content: "SECOND";
    right: 10px;
}
#secondAquiferToggle:checked + .slider::before {
    transform: translateX(71px);
}
#secondAquiferToggle:checked + .slider::after {
    content: "SECOND";
    left: 10px;
    right: auto;
}

/* RIVER TOGGLE SWITCH ------------------------ */
#riverToggle + .slider {
    width: 85px;
}
#riverToggle + .slider::before {
    width: 26px;
    height: 26px;
}
#riverToggle + .slider::after {
    content: "RIVER";
    right: 10px;
}
#riverToggle:checked + .slider::before {
    transform: translateX(50px);
}
#riverToggle:checked + .slider::after {
    content: "RIVER";
}

/* Disabled state styling */
.switch input:disabled + .slider {
    opacity: 0.5;
    cursor: not-allowed;
}
.switch input:disabled + .slider::before {
    cursor: not-allowed;
}

/* Map Legend Control */
.legend-control {
    border: 1px solid #000;
    padding: 10px;
    font-family: Arial, sans-serif;
    font-size: 12px;
    line-height: 1.3;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
}
.legend-control h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    padding: 2px 0;
    border-bottom: 1px solid #ddd;
}
.legend-content {
    transition: max-height 0.3s ease-out;
    overflow: hidden;
}
.legend-control.collapsed .legend-content {
    max-height: 0;
}
.legend-item {
    margin: 3px 0;
    display: flex;
    align-items: center;
}
.legend-symbol {
    margin-right: 5px;
    flex-shrink: 0;
}
.legend-section {
    margin: 6px 0;
}
.legend-section-title {
    font-weight: bold;
    margin-bottom: 3px;
    font-size: 11px;
}

.capture-mode .leaflet-control,
.capture-mode .legend-control,
.capture-mode .leaflet-control-zoom,
.capture-mode .leaflet-control-attribution {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.leaflet-control-map-layers-btn a {
    width: 34px;
    height: 34px;
    line-height: 34px;
    text-align: center;
    display: block;
    background: #fff;
    color: #333;
    font-size: 16px;
    text-decoration: none;
}

.leaflet-control-map-layers-btn a:hover {
    background: #f2f2f2;
    color: #000;
}

.leaflet-control-map-layers-btn a.active {
    background: #eaf3ff;
    color: #0056b3;
}

#trace_content.map-layer-panel {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #c7d3e0;
    box-shadow: 0 6px 14px rgba(21, 41, 62, 0.18);
    padding: 10px 12px;
    margin-top: 8px;
    min-width: 220px;
    max-width: 260px;
    max-height: min(50vh, 320px);
    overflow-y: auto;
}

#trace_content.map-layer-panel .layer-panel-title {
    font-size: 12px;
    font-weight: 700;
    color: #24476b;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #dbe6f2;
}

#trace_content.map-layer-panel .layer-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#trace_content.map-layer-panel .form-check {
    margin-bottom: 0;
    padding-left: 1.35rem;
}

#trace_content.map-layer-panel .form-check-label {
    font-size: 13px;
    line-height: 1.2;
    color: #1f2f3f;
    cursor: pointer;
}

#trace_content.map-layer-panel .form-check-input {
    margin-top: 0.2rem;
}

/* Show aquifer images in capture mode (for Leaflet print plugin) */
.capture-mode #firstAquiferImage:not(.d-none),
.capture-mode #secondAquiferImage:not(.d-none) {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Print Styles */
@media print {
    /* Show aquifer images in print, but only if not hidden by d-none */
    #firstAquiferImage:not(.d-none),
    #secondAquiferImage:not(.d-none) {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        margin-top: 10px !important;
        page-break-inside: avoid;
    }
    
    /* Ensure the map container stays together with images */
    .col-md-7 {
        page-break-inside: avoid;
    }
}
