:root {
    --bg-dark: #0a0a0c;
    --bg-card: rgba(25, 25, 30, 0.7);
    --accent: #10b981;
    --accent-glow: rgba(16, 185, 129, 0.3);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass: rgba(20, 20, 25, 0.85);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Styling */
#sidebar {
    width: 400px;
    height: 100vh;
    z-index: 1000;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    position: relative;
}

header {
    padding: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.logo i {
    font-size: 2rem;
    color: var(--accent);
}

.logo span {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Search Box */
.search-container {
    position: relative;
    z-index: 1000;
}

.search-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
}

.search-input-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
}

#species-search {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1rem 1rem 3rem;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

#species-search:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1001;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    animation: fadeIn 0.2s ease-out;
}

.search-item {
    padding: 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

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

.search-item h4 {
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.search-item p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Info Panel */
#info-panel {
    flex: 1;
    overflow-y: auto;
    padding: 0 2rem 2rem;
}

.species-image-container {
    width: 100%;
    aspect-ratio: 16/10;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    margin-bottom: 1.5rem;
    background: #1a1a1f;
}

#species-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,0.5));
}

.species-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

#scientific-name {
    color: var(--accent);
    font-style: italic;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
}

.taxonomy-list h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.taxonomy-list ul {
    list-style: none;
}

.taxonomy-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    border-left: 2px solid var(--border);
    padding-left: 1rem;
    margin-left: 0.5rem;
}

.taxonomy-list li::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--border);
    border-radius: 50%;
    position: absolute;
    left: -5px;
}

/* Intro Panel */
#intro-panel {
    padding: 2rem;
    background: rgba(16, 185, 129, 0.05);
    border-top: 1px solid var(--border);
}

.welcome-text h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.welcome-text p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.chip:hover {
    background: var(--accent);
    border-color: var(--accent);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    border: none;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    margin-top: 1.5rem;
}

.btn.small-btn {
    width: auto;
    margin-top: 0;
    padding: 1rem;
}

.btn.primary {
    background: var(--accent);
    color: white;
}

.btn.primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

/* Map Container */
#map {
    flex: 1;
    background: var(--bg-dark);
}

/* Leaflet Customization */
.leaflet-container {
    background: #000 !important;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--shadow) !important;
}

.leaflet-control-zoom-in, .leaflet-control-zoom-out {
    background: var(--glass) !important;
    color: white !important;
    border: 1px solid var(--border) !important;
    backdrop-filter: blur(10px);
}

/* Overlay Controls */
.map-controls {
    position: absolute;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.top-right {
    top: 1rem;
    right: 1rem;
}

.control-group {
    padding: 0.5rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.control-group button {
    background: transparent;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-group button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
    background: var(--glass) !important;
    backdrop-filter: blur(10px);
    color: white !important;
    border: 1px solid var(--border);
    border-radius: 12px !important;
    padding: 0;
}

.leaflet-popup-tip {
    background: var(--glass) !important;
}

.location-popup {
    padding: 10px;
    min-width: 200px;
}

.location-popup h4 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

.popup-species-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popup-species-list li {
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.popup-species-list li:hover {
    background: rgba(255, 255, 255, 0.1);
}

.popup-species-list li span {
    font-weight: 600;
    font-size: 0.85rem;
}

.popup-species-list li small {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.popup-loading {
    padding: 20px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Time Filter */
.time-filter-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.time-filter-wrapper input {
    width: 60px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    color: white;
    font-family: inherit;
    text-align: center;
}

.time-filter-wrapper input:focus {
    border-color: var(--accent);
    outline: none;
}

/* MarkerCluster Customization */
.marker-cluster-small {
    background-color: rgba(16, 185, 129, 0.6);
}
.marker-cluster-small div {
    background-color: rgba(16, 185, 129, 0.8);
    color: white;
}
.marker-cluster-medium {
    background-color: rgba(245, 158, 11, 0.6);
}
.marker-cluster-medium div {
    background-color: rgba(245, 158, 11, 0.8);
    color: white;
}
.marker-cluster-large {
    background-color: rgba(239, 68, 68, 0.6);
}
.marker-cluster-large div {
    background-color: rgba(239, 68, 68, 0.8);
    color: white;
}

.marker-cluster div {
    font-family: 'Outfit', sans-serif;
    font-weight: bold;
}

