/* style.css */

/* --- Global Resets & Page Structure --- */
html, body {
    margin: 0;
    padding: 0;
    height: 100%; /* Ensure html and body take full height */
    overflow-x: hidden; /* Prevent horizontal scroll on body */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5; /* This will be visible if page-container doesn't cover */
}

.page-container {
    display: flex;
    position: relative; /* Changed from nothing, might not be needed but good for context */
    top: 0; /* Ensure it tries to start at the very top */
    left: 0;
    width: 100%;
    height: 100vh;      /* page-container fills the entire viewport height */
    padding-top: 80px;  /* THIS IS THE CRUCIAL OFFSET FOR THE FIXED NAVBAR */
                        /* Make sure 80px is the EXACT height of your .navbar */
    box-sizing: border-box;
}

/* --- Top Navbar --- */
.navbar {
    position: fixed; /* Fixed position */
    top: 0;          /* Sticks to the top of the viewport */
    left: 0;         /* Spans from the left */
    width: 100%;     /* Takes full width */
    z-index: 1030;   /* Above other content */
    height: 80px;    /* <<< SET YOUR EXACT NAVBAR HEIGHT HERE >>> */
    background-color: #04243fe6; /* From your HTML's inline style */
    display: flex;
    align-items: center;
    padding-left: 1rem; /* Example for internal navbar spacing */
    padding-right: 1rem;/* Example for internal navbar spacing */
}
/* ... (Rest of your .navbar child styles: .navbar-brand, .form-control, .nav-link etc. remain the same) ... */
.navbar-brand img {
    padding: 5px;
    margin-left: 20px;
    max-height: 50px;
    width: auto;
}
.navbar .form-control {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}
.navbar .form-control::placeholder { color: #ccc; }
.navbar .btn-outline-secondary {
    color: #ccc;
    border-color: rgba(255, 255, 255, 0.3);
}
.navbar .btn-outline-secondary:hover {
    background-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}
.navbar .nav-link { color: rgba(255, 255, 255, 0.75); }
.navbar .nav-link:hover, .navbar .nav-link.active { color: #fff; }
.navbar .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.5);
    color: rgba(255, 255, 255, 0.9);
}
.navbar .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}


/* --- Narrow Sidebar --- */
.sidebar-narrow {
    width: 90px;
    background-color:  #123458;
    color: #c5c9d2;
    /* No padding-top here; it's handled by .page-container */
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%; /* Fills the available height within .page-container (after its padding-top) */
}
/* ... (Rest of your .sidebar-narrow child styles remain the same) ... */
.sidebar-header-narrow { text-align: center; margin-bottom: 15px; }
.filter-btn-narrow { color: #c5c9d2; padding: 5px; }
.filter-btn-narrow:hover { color: #fff; }
.sidebar-nav-narrow { flex-grow: 1; }
.sidebar-link-narrow {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 18px 5px; color: #f9efe6; text-decoration: none; text-align: center;
    font-size: 0.70rem; transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}
.sidebar-link-narrow i { margin-bottom: 5px; font-size: 1.25rem; margin-top: 10px; }
.sidebar-link-narrow span { white-space: nowrap; }
.sidebar-link-narrow small { font-size: 0.65rem; color: #f9efe6; margin-top: 2px; }
.sidebar-link-narrow:hover, .sidebar-link-narrow.active { background-color: #305886; color: #fff; }
.sidebar-link-narrow.active small, .sidebar-link-narrow:hover small { color: #adb5bd; }
.sidebar-footer-narrow { margin-top: auto; }
.sidebar-footer-narrow .sidebar-link-narrow small { display: none; }

/* --- Content Wrapper --- */
.content-wrapper {
    flex-grow: 1;
    display: flex;
    height: 100%; /* Fills the available height within .page-container (after its padding-top) */
    overflow: hidden;
}

/* ... (Rest of your CSS: .sites-list-pane, .species-list-pane, card styles, right pane styles, etc. remain the same as the previous "complete" version) ... */
/* Common List Pane Styling */
.sites-list-pane,
.species-list-pane {
    flex: 1 1 50%; background-image: url("../images/background/background_list.png") ; border-right: 1px solid #ccc;
    display: flex; flex-direction: column; height: 100%; min-width: 0;
}
.sites-list-pane > .p-2,
.species-list-pane > .list-items-container {
    overflow-y: auto; flex-grow: 1; padding: 0.75rem;
}
.sites-controls,
.list-controls {
    font-size: 0.9em; color: #333; cursor: pointer; text-align: right;
    position: -webkit-sticky; position: sticky; top: 0;
   background-image: url("../images/background/background_list.png") ;
    border-bottom: 1px solid #bbb; padding: 0.6rem 0.75rem;
}
.sites-controls span:hover,
.list-controls span:hover { color: #000; }

/* Card Styling */
.site-card-link, .species-card-link { text-decoration: none; color: inherit; display: block; height: 100%; }
.site-card, .species-card {
    margin-bottom: 0.75rem; border: 1px solid #ccc; border-radius: 0.375rem;
    background-color: #EFE4D2; transition: box-shadow 0.2s ease-in-out;
    font-size: 0.9rem; height: 100%; display: flex; flex-direction: column;
}
.site-card:hover, .species-card:hover { box-shadow: 0 0.25rem 0.75rem rgba(0,0,0,.1); }
.site-card .card-img-top, .species-card-img {
    width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: center;
    border-top-left-radius: calc(0.375rem - 1px); border-top-right-radius: calc(0.375rem - 1px);
}
.site-card .card-body, .species-card .card-body {
    padding: 0.75rem; display: flex; flex-direction: column; flex-grow: 1;
}
.site-card .card-title, .species-card-title {
    font-size: 0.95rem; font-weight: bold; margin-bottom: 0.25rem; color: #333;
}
.site-card .card-text.text-muted, .species-card .card-text.text-muted.small {
    font-size: 0.75em; line-height: 1.3; margin-bottom: 0.3rem; color: #6c757d;
}
.species-card-sci-name { font-size: 0.8em; font-style: italic; color: #555; margin-bottom: 0.25rem; }
.site-card .qualifying-species {
    font-size: 0.75em; background-color: #f1f3f5; padding: 4px 7px;
    border-radius: 3px; display: inline-block; color: #333; margin-top: auto;
}
.site-card .qualifying-species i { color: #555; margin-right: 3px; }

/* Right Panes */
.map-stats-pane, .species-detail-display-area, .island-detail-display-area {
    flex: 1 1 50%; height: 100%; min-width: 0; overflow-y: auto;
    background-color: #f8f9fa; padding: 0;
}
.map-stats-pane .placeholder-message, .species-detail-display-area .placeholder-message,
.island-detail-display-area .placeholder-message {
    display: flex; align-items: center; justify-content: center; height: 100%;
    font-size: 1.1rem; color: #6c757d; text-align: center; padding: 1rem;
}
.map-stats-pane { display: flex; flex-direction: column; }
.map-stats-pane .map-pane {
    flex-grow: 2; flex-shrink: 1; flex-basis: 0; position: relative;
    display: flex; padding: 10px; min-height: 0;
}
.map-stats-pane .map-container {
    width: 100%; height: 100%; background-color: #d0e4f0;
    border: 1px solid #c5ced6; position: relative; display: flex;
}
.map-stats-pane #map { width: 100%; height: 100%; border-radius: 3px; }
.map-stats-pane .map-controls {
    position: absolute; top: 10px; right: 10px; display: flex;
    flex-direction: column; gap: 5px; z-index: 401;
}
.map-stats-pane .map-controls .btn, .map-stats-pane .map-legend-control .btn {
    box-shadow: 0 1px 3px rgba(0,0,0,0.15); background-color: #fff; border: 1px solid #ccc;
}
.map-stats-pane .map-zoom-controls { display: flex; flex-direction: column; gap: 2px; }
.map-stats-pane .map-zoom-controls .btn { padding: 0.25rem 0.5rem; }
.map-stats-pane .map-legend-control { position: absolute; bottom: 10px; right: 10px; z-index: 401; }
.map-stats-pane .stats-area {
    flex-grow: 1; flex-shrink: 1; flex-basis: 0; background-color: #FFFFFF;
    border-top: 1px solid #d1d7de; overflow-y: auto; padding: 15px; min-height: 0;
}
.map-stats-pane .stats-area .stat-card { background-color: transparent; padding: 10px; border: none; }
.map-stats-pane .stats-area h6 { font-size: 0.85rem; color: #333; margin-bottom: 8px; font-weight: bold; }
.map-stats-pane .stats-area small { font-size: 0.75rem; }
.map-stats-pane .stats-area canvas { max-width: 100%; }


/* --- Responsive Adjustments --- */
@media (max-width: 1199.98px) {
    .site-card .card-title, .species-card-title { font-size: 0.9rem; }
}

@media (max-width: 991.98px) { /* Tablet and below */
    .navbar {
        /* If navbar height changes for mobile, adjust here AND in .page-container padding-top */
        height: 60px; /* Example: Navbar becomes shorter on tablets */
    }
    .page-container {
        flex-direction: column;
        height: auto;
        padding-top: 60px; /* MATCHES example new navbar height */
    }
    .sidebar-narrow {
        width: 100%; height: auto; flex-direction: row;
        padding: 0;
        overflow-x: auto;
        background-color: #123458;
    }
    .sidebar-link-narrow { padding: 10px 12px; font-size: 0.65rem; }
    .sidebar-link-narrow i { font-size: 1.1rem; margin-top: 0; margin-bottom: 3px; }
    .sidebar-footer-narrow { margin-left: auto; display: flex; align-items: center; }

    .content-wrapper { flex-direction: column; height: auto; }

    .sites-list-pane, .species-list-pane {
        width: 100%; flex: 0 1 auto;
        max-height: 50vh;
        border-right: none; border-bottom: 1px solid #ccc;
    }
    .map-stats-pane, .species-detail-display-area, .island-detail-display-area {
        width: 100%; flex: 0 1 auto;
        height: auto;
    }

    .map-stats-pane .map-pane { min-height: 300px; flex-grow: 0; flex-basis: auto; }
    .map-stats-pane .stats-area { flex-grow: 1; flex-basis: auto; }
}

@media (max-width: 767.98px) { /* Mobile */
    .navbar .navbar-toggler { order: 1; margin-left: auto; }
    .navbar .navbar-collapse { width: 100%; }
    .navbar .d-flex.flex-grow-1 { width: 100% !important; margin-top: 10px; margin-bottom: 10px; order: 3; }
    .navbar .navbar-nav { order: 2; width: 100%; text-align: center; }
    .navbar .navbar-nav .nav-item { width: 100%; }

    .sites-list-pane .col-3,
    .species-list-pane .col-xl-3 {
        flex: 0 0 50%; max-width: 50%;
    }

    .map-stats-pane .stats-area .col-md-6 { margin-bottom: 1rem; }
    .map-stats-pane .stats-area .col-md-6:last-child { margin-bottom: 0; }
    .map-stats-pane .map-pane { min-height: 250px; }
}

@media (max-width: 575.98px) { /* Extra Small Mobile */
    .sites-list-pane .col-3,
    .species-list-pane .col-xl-3 {
        flex: 0 0 100%; max-width: 100%;
    }
}