/* Species Dictionary - Modern Dark Theme */

/* Base styles - Dark theme compatible */
.species-dictionary-container,
.species-detail-container {
    max-width: 100%;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Lato, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--bs-body-color);
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading states - Dark theme */
.loading-shimmer {
    background: linear-gradient(90deg, var(--bs-secondary-bg) 25%, var(--bs-tertiary-bg) 50%, var(--bs-secondary-bg) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.loading-card {
    opacity: 0.6;
    pointer-events: none;
}

/* Header styles - Dark theme */
.species-header {
    background: var(--bs-secondary-bg);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--bs-border-color);
    position: relative;
}

.species-title {
    font-size: 2.2em;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--bs-emphasis-color);
    font-family: inherit;
    line-height: 1.2;
}

.species-subtitle {
    font-size: 1.1em;
    color: var(--bs-secondary-color);
    margin-top: 4px;
    font-weight: 400;
}

/* Navigation tabs - Dark theme */
.species-nav-tabs {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--bs-border-color);
}

.tab-link {
    padding: 8px 16px;
    text-decoration: none;
    color: var(--bs-secondary-color);
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.9em;
    border: 1px solid transparent;
}

.tab-link:hover {
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
}

.tab-link.active {
    background: var(--bs-primary);
    color: white;
    border-color: var(--bs-primary);
}

/* Search and filters - Dark theme */
.species-search-section {
    background: var(--bs-secondary-bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid var(--bs-border-color);
}

/* Container for search and reset button - side by side layout */
.search-and-reset-container {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: nowrap;
	justify-content: center;
}

/* Search form - Dark theme */
.search-form {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    align-items: end;
    flex: 2;
}

.search-input-group {
    display: flex;
    flex: 1 1 auto;
    min-width: 500px;
    max-width: none;
    position: relative;
}

.search-input-group .search-input {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    transition: all 0.2s ease;
}

.search-input-group .search-input:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.25);
    outline: none;
}

.search-input-group .search-btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding: 10px 16px;
    background: var(--bs-primary);
    border: 1px solid var(--bs-primary);
    color: white;
    transition: all 0.2s ease;
    cursor: pointer;
}

.search-input-group .search-btn:hover {
    background: var(--bs-primary-dark);
    border-color: var(--bs-primary-dark);
}

.search-input-container {
    display: flex;
    flex: 1 1 auto;
    min-width: 500px;
    max-width: none;
    position: relative;
}

.search-input-container .search-input {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    transition: all 0.2s ease;
}

.search-input-container .search-input:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.25);
    outline: none;
}

.search-input-container .wikipedia-search-btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding: 10px 16px;
    background: var(--bs-primary);
    border: 1px solid var(--bs-primary);
    color: white;
    transition: all 0.2s ease;
}

.search-input-container .wikipedia-search-btn:hover {
    background: var(--bs-primary-dark);
    border-color: var(--bs-primary-dark);
}

.search-group {
    display: flex;
    flex-direction: column;
    min-width: 140px;
}

.search-group label {
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 0.85em;
    color: var(--bs-secondary-color);
    text-transform: none;
    letter-spacing: normal;
}

.search-input,
.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    font-size: 13px;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    transition: all 0.2s ease;
    font-family: inherit;
}

.search-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.25);
}

/* Adjust search input border radius when suggestions are active */
.search-container.suggestions-active .search-input {
    border-radius: 6px 6px 0 0;
    border-bottom-color: transparent;
}

/* Smooth transition for suggestions appearance */
.search-suggestions {
    transition: all 0.2s ease-in-out;
    opacity: 0;
    transform: translateY(-10px);
}

.search-suggestions.show {
    opacity: 1;
    transform: translateY(0);
}

.filter-select {
    cursor: pointer;
    min-width: 140px;
}

.filter-select:hover {
    border-color: var(--bs-primary);
}

/* Buttons - Dark theme compatible */
.search-btn {
    background: var(--bs-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-transform: none;
    letter-spacing: normal;
}

.search-btn:hover {
    background: var(--bs-primary-dark);
    transform: translateY(-1px);
}

.filter-btn {
    background: var(--bs-success);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-transform: none;
    letter-spacing: normal;
}

.filter-btn:hover {
    background: var(--bs-success-dark);
    transform: translateY(-1px);
}

.clear-btn {
    background: var(--bs-secondary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    text-transform: none;
    letter-spacing: normal;
}

.clear-btn:hover {
    background: var(--bs-secondary-dark);
    transform: translateY(-1px);
    color: white;
}

/* Search suggestions - Wikipedia-style with dark theme support */
.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-top: none;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    display: none;
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0;
    background: rgba(var(--bs-body-bg-rgb, 255, 255, 255), 0.95);
    /* Create space for sticky footer */
    padding-bottom: 0;
}

/* Dark theme scrollbar for suggestions */
.search-suggestions::-webkit-scrollbar {
    width: 8px;
}

.search-suggestions::-webkit-scrollbar-track {
    background: var(--bs-secondary-bg);
    border-radius: 4px;
}

.search-suggestions::-webkit-scrollbar-thumb {
    background: var(--bs-tertiary-bg);
    border-radius: 4px;
}

.search-suggestions::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary-color);
}

.search-suggestions.show {
    display: block;
    transform: translateY(0);
    opacity: 1;
}

.suggestion-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--bs-border-color);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: transparent;
}

.suggestion-item:first-of-type {
    border-top: 1px solid var(--bs-border-color);
}

.suggestion-item:hover {
    background: var(--bs-primary-bg-subtle);
    transform: translateX(4px);
}

.suggestion-item.selected {
    background: var(--bs-primary-bg-subtle);
    border-left: 4px solid var(--bs-primary);
}

.suggestion-item.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, #007bff, #0056b3);
}

.suggestion-image {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 12px;
    flex-shrink: 0;
    border: 2px solid var(--bs-border-color);
    background: var(--bs-secondary-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.suggestion-item:hover .suggestion-image {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.suggestion-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.suggestion-title {
    font-weight: 700;
    color: var(--bs-emphasis-color);
    font-size: 1.1em;
    margin-bottom: 2px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.suggestion-subtitle {
    font-style: italic;
    color: var(--bs-secondary-color);
    font-size: 0.95em;
    font-weight: 500;
    opacity: 0.9;
}

.suggestion-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 6px 0;
    font-size: 0.8em;
}

.suggestion-meta span {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
    border: 1px solid var(--bs-primary-border-subtle);
    transition: all 0.2s ease;
}

.suggestion-meta span:hover {
    background: rgba(0, 123, 255, 0.2);
    transform: translateY(-1px);
}

.suggestion-family {
    background: rgba(108, 99, 255, 0.1) !important;
    border-color: rgba(108, 99, 255, 0.2) !important;
    color: #553c9a !important;
}

.suggestion-origin {
    background: rgba(34, 197, 94, 0.1) !important;
    border-color: rgba(34, 197, 94, 0.2) !important;
    color: #166534 !important;
}

.suggestion-water-type {
    background: rgba(59, 130, 246, 0.1) !important;
    border-color: rgba(59, 130, 246, 0.2) !important;
    color: #1e40af !important;
}

.suggestion-care-level {
    background: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.2) !important;
    color: #92400e !important;
}

.suggestion-description {
    color: var(--bs-secondary-color);
    font-size: 0.9em;
    line-height: 1.5;
    margin-top: 4px;
    opacity: 0.85;
    font-weight: 400;
}

.suggestion-item strong {
    color: var(--bs-primary);
    background-color: var(--bs-primary-bg-subtle);
    padding: 0 3px;
    border-radius: 3px;
    font-weight: 600;
}

/* Suggestions header and footer - Sticky positioning */
.suggestions-header {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 12px 20px;
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    font-size: 0.85em;
    font-weight: 600;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.suggestions-footer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding: 10px 20px;
    background: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color);
    font-size: 0.8em;
    color: var(--bs-secondary-color);
    text-align: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.suggestion-hint {
    opacity: 0.7;
    font-style: italic;
}

/* Search container enhancements */
.search-container {
    position: relative;
    margin-bottom: 0;
    z-index: 100;
    flex: 3;
}

.search-container.suggestions-active .search-form {
    border-radius: 16px 16px 0 0;
    box-shadow: 0 8px 24px rgba(0, 123, 255, 0.15);
    border-color: var(--bs-primary);
}

.search-container.suggestions-active .search-input {
    border-bottom-left-radius: 0;
    border-bottom-color: transparent;
}

.search-container.suggestions-active .search-btn {
    border-bottom-right-radius: 0;
}

/* Add smooth transition to search form */
.search-form {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--bs-border-color);
    border-radius: 16px;
    overflow: hidden;
}

.search-form:focus-within {
    box-shadow: 0 4px 16px rgba(0, 123, 255, 0.2);
    border-color: var(--bs-primary);
}
}

.search-form {
    position: relative;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-form:focus-within {
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
    transform: translateY(-1px);
}

/* Reset button container */
.reset-container {
    display: flex;
    align-items: center;
    min-height: 44px; /* Match search input height */
    margin-left: 16px;
    min-width: 140px;
    flex-shrink: 0;
}

.reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bs-primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9em;
    transition: all 0.2s ease;
    border: 1px solid var(--bs-primary);
    white-space: nowrap;
    min-width: fit-content;
}

.reset-btn:hover {
    background: var(--bs-primary-dark);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Results summary - Dark theme */
.results-summary {
    margin: 20px 0;
    padding: 12px 16px;
    background: var(--bs-secondary-bg);
    border-radius: 6px;
    border: 1px solid var(--bs-border-color);
}

.result-count {
    margin: 0;
    font-size: 0.9em;
    color: var(--bs-secondary-color);
    font-weight: 400;
}

.result-count strong {
    color: var(--bs-primary);
    font-weight: 500;
}

/* Species cards - Dark theme */
.species-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin: 24px 0;
}

.species-card {
    background: var(--bs-card-bg);
    border-radius: 8px;
    border: 1px solid var(--bs-border-color);
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
    height: 538px; /* Fixed total height: 180 header + 350px body + 8px footer = 538px */
    display: flex;
    flex-direction: column;
}

.species-card:hover {
    transform: translateY(-3px);
    border-color: var(--bs-primary);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.species-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.species-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid var(--bs-border-color);
}

.species-card.no-image .species-card-image {
    display: none;
}

.species-card-content {
    padding: 16px;
}

.species-card-title {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--bs-primary);
    line-height: 1.3;
}

.species-card-scientific {
    margin: 0 0 10px 0;
    font-size: 0.9em;
    color: var(--bs-secondary-color);
    font-style: italic;
    font-weight: 400;
}

.species-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.species-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: transform 0.2s ease;
}

.species-badge:hover {
    transform: scale(1.05);
}

.water-type-freshwater {
    --bs-bg-opacity: 1;
  background-color: rgba(var(--bs-info-rgb),var(--bs-bg-opacity)) !important;
}

.water-type-saltwater {
    --bs-bg-opacity: 1;
  background-color: rgba(var(--bs-info-rgb),var(--bs-bg-opacity)) !important;
}

.water-type-brackish {
   --bs-bg-opacity: 1;
  background-color: rgba(var(--bs-info-rgb),var(--bs-bg-opacity)) !important;
}

.water-type-marine {
    --bs-bg-opacity: 1;
  background-color: rgba(var(--bs-info-rgb),var(--bs-bg-opacity)) !important;
}

.care-level-beginner {
    background: #343a40;
    color: #2e7d32;
}

.care-level-intermediate {
    background: #343a40;
    color: #ef6c00;
}

.care-level-advanced {
    background: #343a40;
    color: #c62828;
}

.care-level-expert {
    background: #343a40;
    color: #ad1457;
}

.species-card-description {
    color: #495057;
    font-size: 0.9em;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 15px;
    font-weight: 400;
}

/* Species quick info */
.species-quick-info {
    margin-bottom: 15px;
    padding: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border-left: 4px solid #0645ad;
}

/* Dark theme for species quick info */
[data-theme="dark"] .species-quick-info {
    background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
    border-left: 4px solid #4a9eff;
}

[data-theme="dark"] .info-label {
    color: #b0b0b0;
}

[data-theme="dark"] .info-value {
    color: #e0e0e0;
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .water-type-freshwater {
    background: rgba(66, 165, 245, 0.2);
    color: #42a5f5;
}

[data-theme="dark"] .water-type-saltwater {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}



[data-theme="dark"] .care-level-beginner {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

[data-theme="dark"] .care-level-intermediate {
    background: rgba(255, 152, 0, 0.2);
    color: #ff9800;
}

[data-theme="dark"] .care-level-advanced {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
}

[data-theme="dark"] .care-level-expert {
    background: rgba(233, 30, 99, 0.2);
    color: #e91e63;
}

/* System-level dark mode preference */
@media (prefers-color-scheme: dark) {
    .species-quick-info {
        /*background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);*/
        border-left: 4px solid #4a9eff;
    }
    
    .info-label {
        color: #b0b0b0;
    }
    
    .info-value {
        color: #e0e0e0;
        background: rgba(255, 255, 255, 0.1);
    }
    
    .water-type-freshwater {
        background: rgba(66, 165, 245, 0.2);
        color: #42a5f5;
    }
    
    .water-type-saltwater {
        background: rgba(76, 175, 80, 0.2);
        color: #4caf50;
    }
    

    
    .care-level-beginner {
        background: rgba(76, 175, 80, 0.2);
        color: #4caf50;
    }
    
    .care-level-intermediate {
        background: rgba(255, 152, 0, 0.2);
        color: #ff9800;
    }
    
    .care-level-advanced {
        background: rgba(244, 67, 54, 0.2);
        color: #f44336;
    }
    
    .care-level-expert {
        background: rgba(233, 30, 99, 0.2);
        color: #e91e63;
    }
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.85em;
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-label {
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 0.5px;
}

.info-value {
    font-weight: 500;
    color: #495057;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
}

.care-level-beginner {
    background: #e8f5e8;
    color: #2e7d32;
}

.care-level-intermediate {
    background: #fff3e0;
    color: #ef6c00;
}

.care-level-advanced {
    background: #ffebee;
    color: #c62828;
}

.care-level-expert {
    background: #fce4ec;
    color: #ad1457;
}

/* Species card footer */
.species-card-footer {
    border-top: 1px solid #e9ecef;
    padding-top: 12px;
    margin-top: 15px;
}

.species-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8em;
    color: #6c757d;
}

.view-count {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.family-name {
    font-style: italic;
    font-weight: 500;
    color: #495057;
}

/* Pagination - Dark theme */
.pagination-container {
    display: flex;
    justify-content: center;
    margin: 32px 0;
}

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 6px;
    align-items: center;
}

.pagination li {
    margin: 0;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    text-decoration: none;
    color: var(--bs-primary);
    background: var(--bs-card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.9em;
}

.pagination a:hover {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: white;
    transform: translateY(-1px);
}

.pagination .current {
    background: var(--bs-primary);
    color: white;
    border-color: var(--bs-primary);
}

.pagination .disabled {
    color: var(--bs-secondary-color);
    cursor: not-allowed;
    background: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
}

.pagination .disabled:hover {
    transform: none;
    box-shadow: none;
    background: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
    border-color: var(--bs-border-color);
}

.pagination .prev,
.pagination .next {
    font-weight: 600;
    padding: 0 14px;
}

.pagination .prev:hover,
.pagination .next:hover {
    background: var(--bs-primary);
    color: white;
    border-color: var(--bs-primary);
}

/* Responsive design */
@media (max-width: 768px) {
    .species-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .species-card {
        height: auto; /* Allow flexible height on mobile */
        min-height: 400px; /* Minimum height on mobile */
    }
    
    .species-card-body {
        height: auto; /* Allow flexible height on mobile */
        min-height: 200px; /* Minimum height on mobile */
    }
    
    .species-description {
        height: auto; /* Allow flexible height on mobile */
        -webkit-line-clamp: 6; /* Show more lines on mobile */
        min-height: 80px; /* Minimum height on mobile */
    }
    
    .search-and-reset-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-form {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .search-input-group {
        min-width: auto;
        max-width: none;
    }
    
    .reset-container {
        margin-left: 0;
        margin-top: 12px;
    }
    
    .species-header {
        padding: 16px;
    }
    
    .species-title {
        font-size: 1.8em;
    }
    
    .species-nav-tabs {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .tab-link {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .pagination a,
    .pagination span {
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
        font-size: 0.85em;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for better accessibility */
.species-card:focus-within {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.tab-link:focus {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .species-card {
        border-width: 2px;
    }
    
    .search-input,
    .filter-select {
        border-width: 2px;
    }
    
    .pagination a,
    .pagination span {
        border-width: 2px;
    }
}

/* Card content styles */
.species-card-header {
    position: relative;
    height: 180px; /* Fixed height for header */
    overflow: hidden;
}

.species-card-body {
    padding: 16px;
    height: 350px; /* Fixed height for body */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.species-common-name {
    margin: 0 0 auto 0;
    font-size: 1.1em;
    font-weight: 600;
	color:#0d6efd;
    height: 25px; /* Fixed height for title */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.species-common-name a {
    color: var(--bs-primary);
    text-decoration: none;
}

.species-common-name a:hover {
    text-decoration: underline;
}

.species-scientific-name {
    margin: -20px 0 8px 0;
    font-size: 0.9em;
    color: var(--bs-secondary-color);
    font-style: italic;
    height: 20px; /* Fixed height for scientific name */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.species-quick-info {
    margin-bottom: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.85em;
}

.info-label {
    color: black;
    font-weight: 600;
	font-size: 1em;
}

.info-value {
    font-weight: 800;
	font-size: 0.8em;
}

.water-type-freshwater { --bs-text-opacity: 1;
  color: rgba(var(--bs-dark-rgb),var(--bs-text-opacity)) !important; }
.water-type-saltwater { --bs-text-opacity: 1;
  color: rgba(var(--bs-dark-rgb),var(--bs-text-opacity)) !important; }
.water-type-brackish { --bs-text-opacity: 1;
  color: rgba(var(--bs-dark-rgb),var(--bs-text-opacity)) !important;}
.water-type-marine {--bs-text-opacity: 1;
  color: rgba(var(--bs-dark-rgb),var(--bs-text-opacity)) !important;}
.care-level-easy { --bs-text-opacity: 1;
  color: rgba(var(--bs-dark-rgb),var(--bs-text-opacity)) !important; }
.care-level-moderate { --bs-text-opacity: 1;
  color: rgba(var(--bs-dark-rgb),var(--bs-text-opacity)) !important; }
.care-level-difficult { --bs-text-opacity: 1;
  color: rgba(var(--bs-dark-rgb),var(--bs-text-opacity)) !important; }

.species-description {
    font-size: 0.85em;
    color: var(--bs-body-color);
    line-height: 1.4;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 5; /* Increased from 3 to 5 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 87.5px; /* Fixed height for description (5 lines × 17.5px) */
    flex-shrink: 0; /* Prevent shrinking */
}

.species-card-footer {
    border-top: 1px solid var(--bs-border-color);
    padding-top: 12px;
    margin-top: auto; /* Push to bottom */
    height: 8px; /* Fixed height for footer */
    flex-shrink: 0; /* Prevent shrinking */
}

.species-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8em;
    color: var(--bs-secondary-color);
}

.view-count {
    display: flex;
    align-items: center;
    gap: 4px;
}

.family-name {
    font-style: italic;
}

.species-card-placeholder {
    width: 100%;
    height: 180px;
    background: var(--bs-secondary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-secondary-color);
    border-bottom: 1px solid var(--bs-border-color);
}

/* No results - Dark theme */
.no-results {
    text-align: center;
    padding: 48px 20px;
    background: var(--bs-card-bg);
    border-radius: 8px;
    border: 2px dashed var(--bs-border-color);
    margin: 32px 0;
}

.no-results-icon {
    font-size: 3em;
    color: var(--bs-secondary-color);
    margin-bottom: 16px;
}

.no-results h3 {
    color: var(--bs-body-color);
    margin-bottom: 12px;
    font-size: 1.3em;
}

.no-results p {
    color: var(--bs-secondary-color);
    margin-bottom: 20px;
    font-size: 1em;
}

/* Species Detail Page Styles */

/* Breadcrumb */
.breadcrumb-nav {
    margin-bottom: 20px;
    font-size: 0.9em;
    color: #54595d;
}

.breadcrumb-nav a {
    color: #0645ad;
    text-decoration: none;
}

.breadcrumb-nav a:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    margin: 0 8px;
}

.breadcrumb-current {
    color: #222;
}

.sticky-sidebar {
  position: sticky;
  top: 80px; /* Adjust based on navbar height */
  max-height: calc(100vh - 80px); /* Viewport height minus offset */
  overflow-y: auto;
}

/* Main content should be scrollable vertically and limited in height */
.main-scrollable {
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

/* Main content layout */
.species-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
}

.species-main-content {
    min-width: 0;
}

/* Article header */
.species-article-header {
    border-bottom: 1px solid #a2a9b1;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.species-title {
    font-size: 2.5em;
    font-weight: normal;
    margin: 0;
    color: #000;
    font-family: 'Linux Libertine', Georgia, Times, serif;
}

.species-subtitle {
    font-style: italic;
    font-size: 1.2em;
    color: #54595d;
    margin: 5px 0;
}

.article-meta {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    font-size: 0.9em;
    color: #54595d;
}

/* Table of contents */
.table-of-contents {
    background: #f8f9fa;
    border: 1px solid #a2a9b1;
    border-radius: 2px;
    padding: 15px;
    margin-bottom: 20px;
    width: fit-content;
}

.toc-header {
    font-weight: bold;
    margin-bottom: 10px;
    color: #222;
}

.toc-list {
    margin: 0;
    padding-left: 20px;
}

.toc-list a {
    color: #0645ad;
    text-decoration: none;
    line-height: 1.6;
}

.toc-list a:hover {
    text-decoration: underline;
}

/* Content sections */
.content-section {
    margin-bottom: 30px;
}

.content-section h2 {
    font-size: 1.8em;
    font-weight: normal;
    border-bottom: 1px solid #a2a9b1;
    padding-bottom: 5px;
    margin-bottom: 15px;
    color: #000;
    font-family: 'Linux Libertine', Georgia, Times, serif;
}

.content-section h4 {
    font-size: 1.1em;
    font-weight: bold;
    margin: 15px 0 8px 0;
    color: #222;
}

/* Characteristics grid */
.characteristics-grid,
.habitat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.char-item,
.habitat-item {
    background: #f8f9fa;
    border: 1px solid #a2a9b1;
    border-radius: 2px;
    padding: 12px;
}

.parameter-value {
    font-weight: bold;
    color: #0645ad;
}

/* Care level indicator */
.care-level-indicator {
    width: 200px;
    height: 20px;
    background: #eaecf0;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 8px;
}

.care-level-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s;
}

.care-level-beginner .care-level-bar {
    width: 25%;
    background: #4caf50;
}

.care-level-intermediate .care-level-bar {
    width: 50%;
    background: #ff9800;
}

.care-level-advanced .care-level-bar {
    width: 75%;
    background: #f44336;
}

.care-level-expert .care-level-bar {
    width: 100%;
    background: #9c27b0;
}

/* Temperament badges */
.temperament-badge {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: bold;
    text-transform: capitalize;
}

.temperament-peaceful {
    background: #e8f5e8;
    color: #2e7d32;
}

.temperament-semi-aggressive {
    background: #fff3e0;
    color: #ef6c00;
}

.temperament-aggressive {
    background: #ffebee;
    color: #c62828;
}

/* pH Scale Visualization */
.ph-scale-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
    position: relative;
    margin: 15px 0;
    cursor: pointer;
}

.ph-scale {
    position: relative;
    width: 200px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right,
	#c40532 0,
	#d2040b 8%,
	#e11802 16%,
	#f03400 24%,
	#f56702 31%,
	#fcad02 39%,
	#b8d002 46%,
	#43ce03 54%,
	#18ad36 61%,
	#3d69a0 70%,
	#3838ba 78%,
	#0f0f9e 90%,
	#020486 100%);
	/*linear-gradient(to right, 
        #ff0000 0%,     /* pH 0 - Strong acid (red) 
        #ff4500 14%,    /* pH 2 - Orange red 
        #ffa500 28%,    /* pH 4 - Orange 
        #ffff00 42%,    /* pH 6 - Yellow 
        #90ee90 56%,    /* pH 7 - Light green (neutral) 
        #00ff00 70%,    /* pH 8 - Green 
        #4169e1 84%,    /* pH 10 - Blue 
        #8a2be2 100%    /* pH 14 - Purple (strong base) 
    );*/
	
    border: 1px solid #ccc;
    overflow: hidden;
    margin: 0;
    display: inline-block;
    vertical-align: middle;
}

.ph-range-indicator {
    position: absolute;
    top: -1px;
    height: 9px;
    border: 2px solid #333;
    border-radius: 2px;
}

.ph-value-marker {
    position: absolute;
    top: 0;
    width: 1px;
    height: 8px;
    
    border-radius: 1px;
    z-index: 2;
}

.ph-label {
    font-size: 0.8em;
    color: #666;
    font-weight: 500;
    margin: 0 5px;
}

/* pH scale labels (0, 7, 14) positioned on the scale */
.ph-scale-label {
    display: none; /* Hide for inline compact view */
    position: absolute;
    top: -25px;
    font-size: 11px;
    font-weight: 600;
    color: #333;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #ccc;
    z-index: 10;
}

/* pH range labels (min, max) positioned below the scale */
.ph-range-labels {
    display: none; /* Hide for inline compact view */
    position: relative;
    height: 20px;
    margin-top: 5px;
}

.ph-range-min,
.ph-range-max {
    position: absolute;
    font-size: 12px;
    font-weight: 600;
    color: #d9534f;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #d9534f;
    top: 0;
}

/* Make pH scale container always visible */
.ph-scale-container {
    display: inline-flex !important;
    margin: 0 0 0 8px;
    position: relative;
    cursor: pointer;
    padding: 0;
    background: none;
    border-radius: 0;
    border: none;
    vertical-align: middle;
    align-items: center;
}

/* pH range text styling for inline display */
.ph-range-text {
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.ph-range-display {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
}

/* Dark theme for pH scale */
[data-theme="dark"] .ph-scale {
    border-color: #555;
}

[data-theme="dark"] .ph-label {
    color: #bbb;
}

[data-theme="dark"] .ph-scale-label {
    background: rgba(30, 30, 30, 0.9);
    color: #ddd;
    border-color: #555;
}

[data-theme="dark"] .ph-range-min,
[data-theme="dark"] .ph-range-max {
    background: rgba(30, 30, 30, 0.9);
    color: #ff6b6b;
    border-color: #ff6b6b;
}

/* Dark theme for enhanced tooltip */
[data-theme="dark"] .ph-tooltip {
    background: #2a2a2a;
    border-color: #555;
    color: #e0e0e0;
}

[data-theme="dark"] .ph-tooltip-header {
    border-bottom-color: #444;
}

[data-theme="dark"] .ph-color-indicator {
    border-color: #ccc;
}

[data-theme="dark"] .ph-color-description {
    background: #1f1f1f;
    color: #e0e0e0;
    border-left-color: var(--bs-primary);
}

[data-theme="dark"] .ph-testing-note {
    color: #b0b0b0;
}

[data-theme="dark"] .ph-scale-container {
    background: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
}

/* System-level dark mode preference */
@media (prefers-color-scheme: dark) {
    .ph-scale {
        border-color: #555;
    }
    
    .ph-label {
        color: #bbb;
    }
}

/* pH Scale Tooltip */
.ph-tooltip {
    position: fixed;
    background: var(--tooltip-bg, #ffffff);
    border: none;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    min-width: 300px;
    max-width: 500px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    overflow: hidden;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* Only add scrollbars when content actually exceeds viewport */
    max-height: calc(100vh - 40px);
    /*overflow-y: auto;*/
  }

  [data-theme="dark"] .ph-tooltip {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
  }

.ph-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

/* Dynamic arrow positioning for tooltips */
.ph-tooltip::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px;
    transition: all 0.2s ease;
}

/* Arrow pointing up (tooltip below mouse) */
.ph-tooltip.arrow-up::after {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-color: transparent transparent rgba(255, 255, 255, 0.95) transparent;
}

/* Arrow pointing down (tooltip above mouse) */
.ph-tooltip.arrow-down::after {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-color: rgba(255, 255, 255, 0.95) transparent transparent transparent;
}

/* Arrow pointing left (tooltip to the right) */
.ph-tooltip.arrow-left::after {
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-color: transparent rgba(255, 255, 255, 0.95) transparent transparent;
}

/* Arrow pointing right (tooltip to the left) */
.ph-tooltip.arrow-right::after {
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-color: transparent transparent transparent rgba(255, 255, 255, 0.95);
}

.ph-tooltip.visible {
    opacity: 1;
}

.ph-color-range-display {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 8px;
}

.ph-color-swatch {
    width: 80px;
    height: 50px;
    border-radius: 10px;
    border: 2px solid var(--border-color, #ddd);
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.ph-color-info {
    flex: 1;
    min-width: 0;
}

.ph-range-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-color, #333);
    margin-bottom: 6px;
}

.ph-color-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--primary-color, #2c5aa0);
    margin-bottom: 4px;
}

.ph-color-description {
    font-size: 13px;
    color: var(--text-muted, #666);
    line-height: 1.4;
}

.ph-testing-guide {
    text-align: center;
    padding-top: 6px;
    border-top: 1px solid var(--border-color, #eee);
}

.ph-testing-guide small {
    color: var(--text-muted, #777);
    font-size: 10px;
    font-style: italic;
    line-height: 1.2;
}

/* Interactive pH tooltip link */
.ph-understanding-link {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color, #eee);
    text-align: center;
}

.ph-understanding-link a {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    background: #f8f9fa;
    border: 1px solid #007bff;
    transition: all 0.2s ease;
}

.ph-understanding-link a:hover {
    background: #007bff;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,123,255,0.3);
}

/* Enhanced tooltip for better interaction */
.ph-tooltip {
    pointer-events: auto; /* Allow interaction with tooltip content */
    transform: translateY(10px) scale(0.95);
}

.ph-tooltip.visible {
    transform: translateY(0) scale(1);
}

.ph-tooltip:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.ph-zoomed-scale {
    height: 20px;
    background: linear-gradient(to right, 
        #ff0000 0%, #ff4500 14%, #ffa500 28%, 
        #ffff00 42%, #90ee90 56%, #00ff00 70%, 
        #4169e1 84%, #8a2be2 100%);
    border-radius: 10px;
    position: relative;
    margin-bottom: 10px;
}

.ph-zoomed-range {
    position: absolute;
    top: 0;
    height: 100%;
    border: 2px solid #fff;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    box-sizing: border-box;
}

.ph-zoomed-marker {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: #000;
    border-left: 1px solid #fff;
    border-right: 1px solid #fff;
}

.ph-zoomed-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 10px;
    color: #ccc;
}

/* Enhanced tooltip components */
  .ph-range-indicator-section {
      text-align: center;
      padding: 10px;
  }
  
  .ph-range-indicator-section .ph-range-title {
      font-size: 16px;
      font-weight: 600;
      color: #2c5aa0;
      margin: 0;
      padding: 8px 12px;
      background: rgba(44, 90, 160, 0.1);
      border-radius: 6px;
      display: inline-block;
  }
  
  [data-theme="dark"] .ph-range-indicator-section .ph-range-title {
      color: #6ba3ff;
      background: rgba(107, 163, 255, 0.15);
  }

  .ph-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -12px -12px 8px -12px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #2c5aa0 0%, #1e3d6f 100%);
    color: white;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: relative;
  }

  .ph-tooltip-header::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #1e3d6f;
  }

  .ph-tooltip-header span {
    font-weight: 600;
    font-size: 16px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    letter-spacing: 0.5px;
  }

  .ph-tooltip-close {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 18px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    padding: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    backdrop-filter: blur(2px);
    margin-left: 10px;
  }

  .ph-tooltip-close:hover {
    color: white;
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }

  .ph-tooltip-close:active {
    transform: scale(0.95);
  }

  .ph-tooltip-close:hover {
    color: #333;
    background: #f5f5f5;
  }

  [data-theme="dark"] .ph-tooltip-header {
    background: linear-gradient(135deg, #1a3a6b 0%, #0d1e3a 100%);
    border-bottom-color: #444;
  }

  [data-theme="dark"] .ph-tooltip-header::after {
    border-top-color: #0d1e3a;
  }

  [data-theme="dark"] .ph-tooltip-close {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
  }

  [data-theme="dark"] .ph-tooltip-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
  }

.ph-color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #333;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.ph-color-description {
    margin-top: 6px;
    padding: 6px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.85em;
    border-left: 3px solid var(--bs-primary);
}

.ph-testing-note {
    margin-top: 6px;
    font-style: italic;
    color: #6c757d;
    line-height: 1.3;
    font-size: 0.8em;
}

/* Gallery */
.species-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.gallery-item {
    border: 1px solid #a2a9b1;
    border-radius: 2px;
    overflow: hidden;
}

.gallery-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-image:hover {
    transform: scale(1.05);
}

/* Sidebar styles */
.species-sidebar {
    min-width: 0;
}

/* Infobox */
.species-infobox {
    background: #f8f9fa;
    border: 1px solid #a2a9b1;
    border-radius: 2px;
    margin-bottom: 20px;
    overflow: hidden;
}

.infobox-header {
    background: #eaecf0;
    padding: 10px 15px;
    border-bottom: 1px solid #a2a9b1;
    text-align: center;
}

.infobox-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: bold;
    color: #222;
}

.infobox-image {
    text-align: center;
    padding: 15px;
    border-bottom: 1px solid #a2a9b1;
}

.primary-image {
    max-width: 100%;
    height: auto;
    border-radius: 2px;
}

.infobox-table {
    width: 100%;
    border-collapse: collapse;
}

.infobox-table th,
.infobox-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #eaecf0;
    font-size: 0.9em;
}

.infobox-table th {
    background: #f8f9fa;
    font-weight: bold;
    color: #222;
    width: 40%;
}

.infobox-table td {
    color: #222;
}

/* Related species */
.related-species {
    background: #f8f9fa;
    border: 1px solid #a2a9b1;
    border-radius: 2px;
    overflow: hidden;
}

.related-species h3 {
    background: #eaecf0;
    margin: 0;
    padding: 10px 15px;
    font-size: 1.1em;
    font-weight: bold;
    color: #222;
    border-bottom: 1px solid #a2a9b1;
}

.related-species-list {
    padding: 10px;
}

.related-species-item {
    margin-bottom: 10px;
}

.related-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 2px;
    text-decoration: none;
    color: #222;
    transition: background 0.2s;
}

.related-link:hover {
    background: #eaecf0;
}

.related-image,
.related-image-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
}

.related-image-placeholder {
    background: #eaecf0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a2a9b1;
}

.related-info {
    flex: 1;
    min-width: 0;
}

.related-name {
    font-weight: bold;
    color: #0645ad;
    font-size: 0.9em;
}

.related-scientific {
    font-style: italic;
    color: #54595d;
    font-size: 0.8em;
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 2px;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2em;
    cursor: pointer;
    padding: 5px;
}

/* Responsive design */
@media (max-width: 768px) {
    .species-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .species-sidebar {
        order: -1;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-group {
        min-width: auto;
    }
    
    .species-grid {
        grid-template-columns: 1fr;
    }
    
    .characteristics-grid,
    .habitat-grid {
        grid-template-columns: 1fr;
    }
    
    .species-title {
        font-size: 2em;
    }
    
    .article-meta {
        flex-direction: column;
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .species-dictionary-container,
    .species-detail-container {
        padding: 10px;
    }
    
    .species-dictionary-title,
    .species-title {
        font-size: 1.8em;
    }
    
    .table-of-contents {
        width: 100%;
    }
    
    .species-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

.wikipedia-header {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  background: var(--bs-body-bg, #f8f9fa);
  position: relative;
  z-index: 1;
}

.wikipedia-curved-container {
  position: relative;
  width: 300px;
  height: 420px;
  margin: 0 auto;
}
.logo-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  height: 300px;
  z-index: 10;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  border-radius: 50%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wikipedia-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.curved-options-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}
.curved-option {
  color: #ffffff;
  font-size: 1.16em;
  font-weight: 300;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 1px 6px rgba(30, 70, 170, 0.05);
  user-select: none;
  transition: background 0.2s;
  padding: 16px 48px;
  z-index: 5;
  text-decoration: none;
}
.curved-option:hover {
  color:#ffffff;
  background:#2f3237;
}

.curved-option a {
  text-decoration: none;
  color: inherit;
}


@media (max-width: 768px) {
  .wikipedia-curved-container {
    width: 100%;
    height: 280px;
  }

  .logo-container {
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .wikipedia-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
  }
}
