/* Full width and height for HTML and body */
html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f0f4f7;
}

/* Layout container */
.layoutcontainer {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header */
.header {
    width: 100%;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(90deg, #a5cc95, #187817);
    color: white;
    font-family: Arial, sans-serif;
    border-bottom: 2px solid #b3ade6;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.header img {
    max-height: 60px;
    margin-right: 10px;
}

/* Controls */
.layoutcontrols {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px;
    background-color: #efcc35;
    border-bottom: 2px solid #b3ade6;
    gap: 10px;
}

.layoutcontrols select {
    border-radius: 10px;
    padding: 5px 10px;
    margin-right: 15px;
    border: 1px solid #aaa;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.layoutcontrols select:hover {
    border-color: #187817;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.header-select-label {
    font-weight: bold;
    color: #000;
    margin-right: 5px;
}

/* Layout content */
.layoutcontent {
    display: flex;
    flex: 1;
    position: relative;
    gap: 10px;
}

/* Map and floating panels */
.layoutcontent>div:first-child {
    flex: 2;
    position: relative;
}

.layoutcontent>div:last-child {
    flex: 1;
}

/* Floating layout for counters and charts */
.layoutfloating {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 750px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Counters container */
.layoutcounters {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.counter-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    padding: 10px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 15px;
    min-width: 680px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease-in-out;
}

/* Individual counter cards */
.counter {
    flex: 1;
    min-width: 120px;
    padding: 15px 10px;
    margin: 5px;
    border-radius: 12px;
    text-align: center;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    background: linear-gradient(135deg, #4caf50, #81c784);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
}

.counter:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.35);
}

.counter>div:first-child {
    font-size: 22px;
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
}

.counter>div:last-child {
    font-size: 14px;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Charts container */
.layoutcharts {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 10px;
}

/* Individual charts (glassmorphic) */
#leftchart,
#rightchart {
    flex: 1 1 300px;
    min-height: 300px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 15px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(6px);
    transition: all 0.3s ease;
}

#leftchart:hover,
#rightchart:hover {
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
}

/* Map logo */
.vedas-logo {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 120px;
    opacity: 0.8;
}

/* Footer */
.footer,
.footer-mobile {
    background-color: #d2e593;
    text-align: center;
    padding: 8px;
    font-family: Arial, sans-serif;
    box-shadow: 0 -3px 6px rgba(0, 0, 0, 0.15);
}

/* Modal */
.modal {
    position: fixed;
    z-index: 999;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border-radius: 15px;
    width: 80%;
    max-width: 900px;
    max-height: 85%;
    overflow: auto;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Close button */
.close,
.chart-close {
    color: #3687d3;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.chart-close:hover {
    color: #031255;
}

/* Table */
table {
    font-family: Arial, sans-serif;
    border-collapse: collapse;
    width: 100%;
}

td,
th {
    border: 1px solid #dddddd;
    text-align: left;
    padding: 8px;
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

/* No data */
.no-data {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    color: #ff0000;
    margin-top: 10px;
}

/* ═══════════════════════════════════════════
   LAYER PANEL  — root level (NOT inside @media)
   ═══════════════════════════════════════════ */

.layer-panel {
    position: fixed;
    top: 70px;
    left: 10px;
    z-index: 999;
    background: #ffffff;
    border: 1px solid #d8e3d8;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.13);
    padding: 12px 14px;
    min-width: 190px;
    max-width: 240px;
    max-height: calc(109vh - 80vh);
    /* ✅ prevents full-height */
    overflow-y: auto;
    font-family: Arial, sans-serif;
    font-size: 13px;
}

/* Thin green top accent bar */
.layer-panel::before {
    content: "";
    display: block;
    height: 4px;
    background: linear-gradient(90deg, #4caf50, #187817);
    border-radius: 8px 8px 0 0;
    margin: -12px -14px 10px -14px;
}

/* ── Each layer block ── */
.lp-item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eef0ee;
}

.lp-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* ── Checkbox row (label + name + order buttons) ── */
.lp-check-label {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    color: #1a3a1a;
    user-select: none;
}

.lp-check-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    accent-color: #187817;
    /* ✅ green tick */
    cursor: pointer;
}

.lp-name {
    flex: 1;
}

/* ── Up / Down order buttons ── */
.lp-order-btns {
    display: flex;
    gap: 2px;
    margin-left: auto;
}

.lp-btn-order {
    background: #f0f4f0;
    border: 1px solid #b8ccb8;
    border-radius: 4px;
    padding: 1px 5px;
    cursor: pointer;
    font-size: 11px;
    color: #2e6b2e;
    line-height: 1.4;
    transition: background 0.15s;
}

.lp-btn-order:hover {
    background: #d4ecd4;
    border-color: #4caf50;
}

/* ── Legend colour + label row ── */
.lp-legend-row {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 5px;
    padding-left: 22px;
}

.lp-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.lp-legend-text {
    font-size: 12px;
    color: #444;
}

/* ── Date navigation row (Potato Mask) ── */
.lp-date-row {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 7px;
    padding-left: 22px;
    flex-wrap: wrap;
}

.lp-btn-nav {
    background: #f0f4f0;
    border: 1px solid #b8ccb8;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 11px;
    color: #2e6b2e;
    font-weight: bold;
    transition: background 0.15s;
}

.lp-btn-nav:hover {
    background: #d4ecd4;
    border-color: #4caf50;
}

.lp-date-select {
    border: 1px solid #b8ccb8;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 11px;
    max-width: 105px;
    flex: 1;
    color: #333;
    background: #f9fcf9;
    cursor: pointer;
}

.lp-date-select:focus {
    outline: none;
    border-color: #4caf50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
}

/* ── Scrollbar styling (webkit) ── */
.layer-panel::-webkit-scrollbar {
    width: 5px;
}

.layer-panel::-webkit-scrollbar-track {
    background: #f0f4f0;
    border-radius: 10px;
}

.layer-panel::-webkit-scrollbar-thumb {
    background: #b8d4b8;
    border-radius: 10px;
}

.layer-panel::-webkit-scrollbar-thumb:hover {
    background: #4caf50;
}

/* Responsive adjustments */
@media (max-width: 1150px) {
    .modal-content-presentations {
        width: 90%;
    }

    .layoutfloating {
        width: auto;
        right: 10px;
        top: 10px;
    }

    .counter-container {
        min-width: 100%;
    }

    #leftchart,
    #rightchart {
        flex: 1 1 100%;
    }
}

/* NDVI legend image */
.lp-legend-row--img {
    padding-left: 22px;
    margin-top: 6px;
}

.lp-legend-img {
    max-width: 100%;
    /* fits inside the 230px panel */
    height: auto;
    border-radius: 3px;
    border: 1px solid #d0d0d0;
    display: block;
}

.lp-row-label {
    font-size: 11px;
    color: #555;
    white-space: nowrap;
    flex-shrink: 0;
}

.lp-select--full {
    flex: 1;
    max-width: none;
}

/* Bottom Full-Width Chart Panel */
.bottom-chart-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    z-index: 3000;
    /* Stays above the map and footer */
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.2);
    border-top: 3px solid #187817;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

.bottom-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: #f4f7f4;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
    color: #187817;
}

.bottom-panel-header .close-btn {
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    color: #555;
    transition: color 0.2s;
}

.bottom-panel-header .close-btn:hover {
    color: red;
}

.bottom-panel-body {
    padding: 10px;
    width: 100%;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* --- Core Variables --- */
:root {
    --lp-bg: #ffffff;
    --lp-item-bg: #f8fafc;
    --lp-border: #e2e8f0;
    --lp-border-hover: #cbd5e1;
    --lp-text-main: #1e293b;
    --lp-text-muted: #64748b;
    --lp-accent: #2563eb;
    --lp-radius-lg: 12px;
    --lp-radius-md: 8px;
    --lp-radius-sm: 6px;
    --lp-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --lp-transition: all 0.2s ease-in-out;
}

/* --- Panel Container --- */
.layer-panel {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--lp-bg);
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius-lg);
    box-shadow: var(--lp-shadow);
    padding: 16px;
    width: 100%;
    max-width: 360px;
    /* Adjust based on your layout */
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--lp-text-main);
}

/* --- Individual Layer Items --- */
.lp-item {
    background: var(--lp-bg);
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius-md);
    padding: 12px;
    transition: var(--lp-transition);
}

.lp-item:hover {
    border-color: var(--lp-border-hover);
    background: var(--lp-item-bg);
    box-shadow: 0 2px 4px rgb(0 0 0 / 0.02);
}

/* --- Checkbox Header Row --- */
.lp-check-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.lp-check-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--lp-accent);
    cursor: pointer;
}

.lp-name {
    flex-grow: 1;
}

/* --- Order Buttons (Up/Down) --- */
.lp-order-btns {
    display: flex;
    gap: 4px;
    opacity: 0.6;
    transition: var(--lp-transition);
}

.lp-check-label:hover .lp-order-btns {
    opacity: 1;
}

.lp-btn-order {
    background: transparent;
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius-sm);
    color: var(--lp-text-muted);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 12px;
    transition: var(--lp-transition);
}

.lp-btn-order:hover {
    background: #e2e8f0;
    color: var(--lp-text-main);
}

/* Greys the arrow out once a layer is at the top/bottom of the stack, so it's
   clear the button reached its limit rather than silently doing nothing. */
.lp-btn-order:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: transparent;
}

.lp-btn-order:disabled:hover {
    background: transparent;
    color: var(--lp-text-muted);
}

/* --- Controls / Date Rows --- */
.lp-date-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--lp-border);
    font-size: 13px;
}

.lp-row-label {
    font-weight: 500;
    color: var(--lp-text-muted);
    min-width: 65px;
}

/* --- Navigation Buttons (<, >, y<, >y) --- */
.lp-btn-nav {
    background: #fff;
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius-sm);
    color: var(--lp-text-main);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    transition: var(--lp-transition);
}

.lp-btn-nav:hover {
    background: var(--lp-item-bg);
    border-color: var(--lp-accent);
    color: var(--lp-accent);
}

/* --- Select Dropdowns --- */
.lp-date-select {
    flex-grow: 1;
    padding: 4px 8px;
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius-sm);
    background-color: #fff;
    color: var(--lp-text-main);
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: var(--lp-transition);
}

.lp-date-select:focus {
    border-color: var(--lp-accent);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.lp-select--full {
    width: 100%;
}

/* --- Legend Rows --- */
.lp-legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-left: 26px;
    /* Align with text, bypassing checkbox */
    font-size: 13px;
    color: var(--lp-text-muted);
}

.lp-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

/* --- Legend Image Specifics --- */
.lp-legend-row--img {
    padding-left: 0;
    margin-top: 12px;
    justify-content: center;
}

.lp-legend-img {
    max-width: 100%;
    height: auto;
    border-radius: var(--lp-radius-sm);
    border: 1px solid var(--lp-border);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}
/* --- Panel Title --- */
.lp-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--lp-text-main);
    margin-bottom: 4px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--lp-border);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}