.interactive-map-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    box-sizing: border-box;
    width: 100%;
}

.interactive-map-container *,
.interactive-map-container *::before,
.interactive-map-container *::after {
    box-sizing: border-box;
}

.map-wrapper {
    flex: 3;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

/* Quick Island Selector Dropdown (Great for mobile touch) */
.map-mobile-helper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f8faf8;
    border: 1px solid #dceddc;
    padding: 0.6rem 1rem;
    border-radius: 8px;
}

.map-dropdown-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #2e7d32;
    white-space: nowrap;
    margin: 0;
}

.map-select-wrap {
    flex: 1;
    position: relative;
}

.island-select-dropdown {
    width: 100%;
    min-height: 42px;
    padding: 6px 36px 6px 12px;
    font-size: 0.9rem;
    color: #222222;
    background-color: #ffffff;
    border: 1px solid #c8e6c9;
    border-radius: 6px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%232e7d32' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.island-select-dropdown:focus {
    border-color: #2e7d32;
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2);
}

.map {
    width: 100%;
    position: relative;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.map svg {
    width: 100%;
    height: auto;
    display: block;
    max-height: 85vh;
}

svg path.selected,
svg polygon.selected {
    stroke: #000000;
    stroke-width: 1.5px;
    fill: #2e7d32;
    opacity: 0.85;
}

/* Ensure grid lines, frame, sea, and non-island layers do not block island clicks */
svg line,
svg polyline,
svg #FRAME,
svg #SEA,
svg #MERIDIANS,
svg #OTHER_CAPTIONS,
svg #CAPTIONS_SEA,
svg #CAPTIONS_HYDROGRAPHY,
svg #CAPTIONS_COUNTRIES {
    pointer-events: none;
}

svg #CAPTIONS_ISLANDS,
svg #CAPTIONS_ISLANDS text,
svg #CAPTIONS_ISLANDS tspan,
svg #CAPTIONS_TOWNS,
svg #CAPTIONS_TOWNS text,
svg #CAPTIONS_TOWNS tspan,
svg text[data-region],
svg tspan[data-region],
svg [data-region] text,
svg [data-region] tspan {
    pointer-events: auto !important;
    cursor: pointer !important;
    transition: fill 0.2s ease-in-out;
    touch-action: manipulation;
}

@media (hover: hover) {
    svg text[data-region]:hover,
    svg tspan[data-region]:hover,
    svg #CAPTIONS_ISLANDS text:hover,
    svg #CAPTIONS_TOWNS text:hover {
        fill: #1b5e20 !important;
    }
}

#plant-sidebar {
    flex: 1;
    min-width: 300px;
    border-left: 1px solid #ddd;
    padding-left: 20px;
    min-height: 600px;
    scroll-margin-top: 24px;
    position: sticky;
    top: 24px;
    align-self: flex-start;
}

.sidebar-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.header-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

#plant-sidebar h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #1b5e20;
}

.plant-count-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background-color: #e8f5e9;
    color: #2e7d32;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 12px;
    border: 1px solid #c8e6c9;
}

.plant-count-summary {
    font-size: 0.85rem;
    color: #555555;
    margin-bottom: 12px;
    font-weight: 500;
}

.show-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    min-height: 36px;
    background-color: transparent;
    border: 1px solid #2e7d32;
    color: #2e7d32;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    touch-action: manipulation;
}

@media (hover: hover) {
    .show-all-btn:hover {
        background-color: #2e7d32;
        color: #ffffff;
    }
}

.show-all-btn:active {
    background-color: #2e7d32;
    color: #ffffff;
    transform: scale(0.98);
}

.plant-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    margin-bottom: 12px;
    background: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease-in-out;
}

@media (hover: hover) {
    .plant-card:hover {
        border-color: #2e7d32;
        background: #ffffff;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
    }
}

.plant-details {
    flex: 1;
    padding-right: 12px;
}

.plant-title {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #222222;
    line-height: 1.3;
}

.plant-family {
    display: block;
    font-size: 0.82rem;
    color: #666666;
    font-style: italic;
}

.view-plant-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    min-height: 38px;
    background-color: #2e7d32;
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 6px;
    white-space: nowrap;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
    touch-action: manipulation;
}

@media (hover: hover) {
    .view-plant-btn:hover {
        background-color: #1b5e20;
        color: #ffffff !important;
        transform: translateY(-1px);
    }
}

.view-plant-btn:active {
    background-color: #1b5e20;
    color: #ffffff !important;
    transform: scale(0.98);
}

.no-plants {
    font-size: 0.95rem;
    color: #777777;
    font-style: italic;
}

#plant-results {
    max-height: 520px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
    margin-top: 8px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #a5d6a7 #f1f8e9;
}

#plant-results::-webkit-scrollbar {
    width: 6px;
}

#plant-results::-webkit-scrollbar-track {
    background: #f1f8e9;
    border-radius: 4px;
}

#plant-results::-webkit-scrollbar-thumb {
    background: #81c784;
    border-radius: 4px;
}

#plant-results::-webkit-scrollbar-thumb:hover {
    background: #2e7d32;
}

/* ==========================================================================
   Responsive Breakpoints for Mobile and Tablet
   ========================================================================== */

@media (max-width: 960px) {
    .interactive-map-container {
        flex-direction: column;
        gap: 1.5rem;
    }

    .map-wrapper {
        width: 100%;
        flex: none;
    }

    .map svg {
        max-height: 60vh;
    }

    #plant-sidebar {
        position: static;
        width: 100%;
        min-width: 100%;
        border-left: none;
        border-top: 2px solid #e8f5e9;
        padding-left: 0;
        padding-top: 1.5rem;
        min-height: auto;
    }

    #plant-results {
        max-height: 420px;
        padding-right: 4px;
    }
}

@media (max-width: 600px) {
    .map-mobile-helper {
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
        padding: 0.75rem;
    }

    .sidebar-header-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    .sidebar-header-row .show-all-btn {
        width: 100%;
        min-height: 42px;
    }

    .plant-card {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px;
    }

    .plant-details {
        padding-right: 0;
    }

    .view-plant-btn {
        width: 100%;
        min-height: 42px;
        text-align: center;
    }
}