/* General Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    background-color: #f5f5dc; /* Beige background */
    color: #3d402e; /* Dark olive green text */
    margin: 0;
    padding: 0;
}

/*
This class is now used for pages with a different background that also need header spacing.
*/
.content-body {
    padding: 120px 20px 20px 20px; /* Adjusted top padding to match new header height */
    background-color: #f4f4f0; /* A soft, off-white background */
    color: #333; /* Darker text for better contrast on the lighter background */
}

/* --- THIS IS THE FIX: Header styles updated for better spacing and size --- */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(46, 64, 52, 0.8); 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1000;
    padding: 0; 
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px; /* Keep height stable */
}

.header-content {
    width: 100%;
    max-width: 1600px;
    margin: 0;
    padding: 0 0.35rem; /* Keep minimal internal padding */
    display: flex;
    justify-content: flex-start; /* THIS IS THE FIX: Place nav immediately after the logo */
    align-items: center;
    box-sizing: border-box;
    gap: 0; /* No extra gap between logo and nav; we control with nav margin-left */
}

.logo-link img {
    height: 76px; /* Slightly smaller logo to free width */
    vertical-align: middle;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 3px; /* tighter spacing between buttons */
    flex-wrap: nowrap; /* Ensure single row */
    justify-content: flex-start; /* THIS IS THE FIX: buttons start right after the logo */
    flex: 1 1 auto;
    min-width: 0; /* Allow flexbox to shrink contents */
    margin-left: 8px; /* THIS IS THE FIX: small breathing room between logo and Dashboard */
}

.main-nav a.nav-button, .main-nav .dropbtn {
    color: #fff;
    text-decoration: none;
    padding: 6px 9px; /* tighter padding */
    margin: 0;
    border-radius: 5px;
    transition: all 0.3s ease;
    background: none;
    border: none;
    font-family: inherit;
    font-size: clamp(0.82rem, 0.9vw, 0.95rem); /* responsive font sizing */
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap; /* Prevent wrapping per button */
}

.main-nav a.nav-button:hover, .main-nav .dropdown:hover .dropbtn, .main-nav a.nav-button.active {
    background-color: #3d4c21;
    /* REMOVED transform: translateY(-2px); to prevent layout shifts */
}
/* --- End of Header Style Fix --- */


/* Dropdown Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #3d4c21;
    min-width: 200px;
    max-width: 340px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1002;
    border-radius: 5px;
    overflow: hidden; /* Ensures content respects the border radius */
    right: 0; /* Align dropdown to the right */
}

.dropdown-content a {
    color: white;
    padding: 10px 14px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    line-height: 1.25rem;
}

.dropdown-content a:hover {
    background-color: #4f583d;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* --- THIS IS THE FIX: Scrollable admin dropdown --- */
#admin-nav-button .dropdown-content {
    max-height: 70vh;                /* Prevent off-screen overflow */
    overflow-y: auto;                 /* Enable scroll */
    overscroll-behavior: contain;     /* Prevent page scroll chaining */
    scrollbar-width: thin;            /* Firefox thin scrollbar */
    scrollbar-color: #6c7a55 #2e4034;
}
#admin-nav-button .dropdown-content::-webkit-scrollbar {
    width: 8px;
}
#admin-nav-button .dropdown-content::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.08);
}
#admin-nav-button .dropdown-content::-webkit-scrollbar-thumb {
    background: #6c7a55;
    border-radius: 10px;
}
#admin-nav-button .dropdown-content::-webkit-scrollbar-thumb:hover {
    background: #859769;
}

/* Keep top group (first section) slightly sticky for context (optional enhancement) */
#admin-nav-button .dropdown-content > a:first-of-type {
    position: sticky;
    top: 0;
    background: #3d4c21;
    z-index: 5;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

/* --- THIS IS THE FIX: New styles for Admin Dropdown --- */
.dropdown-content .dropdown-header {
    padding: 10px 16px 5px 16px;
    font-size: 0.7em;
    color: #ccc;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 0.05em;
}

.dropdown-content hr {
    border: 0;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.18);
    margin: 5px 0 8px;
}
/* --- End of Admin Dropdown Styles --- */


/* --- THIS IS THE FIX: New styles for the notification bell --- */
.notification-bell-container {
    position: relative;
    margin-left: auto; /* THIS IS THE FIX: push bell to the far right within the nav */
    margin-right: 0.5in; /* THIS IS THE FIX: half-inch gap from right edge */
    display: none; /* Hidden by default, shown for admins via JS */
}

.notification-bell {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem; /* Larger icon size */
    cursor: pointer;
    padding: 5px;
    position: relative;
}

.notification-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #d9534f; /* Danger red */
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: bold;
    line-height: 1;
    min-width: 10px;
    text-align: center;
    display: none; /* Hidden by default */
}

.notification-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    max-height: 400px;
    background-color: #2e4034; /* Dark Green */
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1001;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notification-header {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- THIS IS THE FIX: New container for the header actions --- */
.notification-header .notification-actions {
    display: flex;
    gap: 10px;
}

.notification-header h4 {
    margin: 0;
    color: #f2f2f2;
    font-size: 1rem;
}

/* --- THIS IS THE FIX: Renamed and restyled the button --- */
.header-action-btn {
    background: none;
    border: none;
    color: #a0a0a0; /* text-muted color */
    font-size: 0.8rem;
    cursor: pointer;
    padding: 5px;
}
.header-action-btn:hover {
    color: #f2f2f2; /* text-light color */
    text-decoration: underline;
}
/* --- THIS IS THE FIX: Style for the danger action --- */
.header-action-btn.danger {
    color: #ff8a80; /* A light red for dark backgrounds */
}
.header-action-btn.danger:hover {
    color: #d9534f;
}


.notification-list {
    overflow-y: auto;
    flex-grow: 1;
}

.notification-item {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    transition: background-color 0.2s;
    /* --- THIS IS THE FIX: Use flexbox to align content and delete button --- */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.notification-item-content {
    flex-grow: 1;
}


.notification-item:hover {
    background-color: rgba(255,255,255,0.1);
}

.notification-item.unread {
    background-color: rgba(85, 107, 47, 0.3); /* Primary green with transparency */
}

.notification-message {
    font-size: 0.9rem;
    color: #ddd;
    margin: 0;
}

.notification-timestamp {
    font-size: 0.75rem;
    color: #a0a0a0; /* text-muted */
    margin-top: 5px;
    display: block;
}

/* --- THIS IS THE FIX: New style for the individual delete button --- */
.notification-delete-btn {
    background: none;
    border: none;
    color: #a0a0a0; /* text-muted */
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    border-radius: 50%;
    flex-shrink: 0;
}
.notification-delete-btn:hover {
    color: #ff8a80; /* Light red */
    background-color: rgba(217, 83, 79, 0.2);
}


.no-notifications {
    padding: 40px 20px;
    text-align: center;
    color: #a0a0a0; /* text-muted */
}
/* --- End of notification styles --- */


/* Upload Button Styles */
.upload-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    padding: 15px 25px;
    font-size: 18px;
    border-radius: 30px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}


/* Headings */
h1, h2 {
    color: #2e4034; /* Deep forest green */
}
h1 {
    text-align: center;
}

/* Links */
a {
    color: #556b2f; /* Olive Drab */
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Buttons */
button {
    display: inline-block;
    background: #556b2f; /* Olive Drab */
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}
button:hover {
    background: #3d4c21; /* Darker Olive Drab */
}

/* Form Inputs */
input[type="text"],
input[type="password"],
input[type="search"] {
    width: 95%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Search Page Specifics */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: #e9ecef;
    border-radius: 8px;
}

.search-bar-container {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.search-container {
    display: flex;
    gap: 20px;
}

#filter-panel {
    flex: 1;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#results-panel {
    flex: 3;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* --- View Styles --- */
#search-results.grid-view {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
}

#search-results.list-view {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Species Card Styling */
.species-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: #333;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
}

.species-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Grid View Card Specifics */
.grid-view .species-card {
    flex-direction: column;
}
.grid-view .card-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background-color: #eee;
}

/* List View Card Specifics */
.list-view .species-card {
    flex-direction: row;
    align-items: center;
}
.list-view .card-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    background-color: #eee;
}

.card-info {
    padding: 15px;
    flex-grow: 1;
}

.card-info h4 {
    margin: 0 0 5px 0;
}

.card-info p {
    margin: 0;
    font-size: 0.9em;
    color: #666;
}

.card-icons {
    padding: 0 15px 10px;
    text-align: right;
    font-size: 1.2em;
}
.list-view .card-icons {
    padding-right: 20px;
}

/* Taxonomy Tree Styles */
#taxonomy-filter-tree ul {
    list-style-type: none;
    padding-left: 20px;
}

#taxonomy-filter-tree li span {
    cursor: pointer;
    position: relative;
    padding-left: 20px;
}

#taxonomy-filter-tree li span::before {
    content: '▶';
    position: absolute;
    left: 0;
    transition: transform 0.2s;
}

#taxonomy-filter-tree li span.expanded::before {
    transform: rotate(90deg);
}

#taxonomy-filter-tree ul.nested {
    display: none;
}

#taxonomy-filter-tree ul.active {
    display: block;
}


/* --- THIS IS THE FIX: Responsive tightening for narrower widths --- */
@media (max-width: 1440px) {
    .main-nav {
        gap: 2px;
    }
    .main-nav a.nav-button, .main-nav .dropbtn {
        padding: 5px 8px;
        font-size: clamp(0.8rem, 1vw, 0.9rem);
    }
    .logo-link img {
        height: 72px;
    }
}

@media (max-width: 1320px) {
    .main-nav {
        gap: 2px;
    }
    .main-nav a.nav-button, .main-nav .dropbtn {
        padding: 4px 7px;
        font-size: clamp(0.78rem, 1.05vw, 0.88rem);
    }
    .logo-link img {
        height: 68px;
    }
}