:root {
    --primary-color: #2E7D32;
    /* Forest Green */
    --secondary-color: #81C784;
    /* Light Green */
    --accent-color: #FFB74D;
    /* Soft Orange (Butterfly-like) */
    --bg-color: #F1F8E9;
    /* Very light green tint */
    --text-color: #1B5E20;
    /* Dark Green text */
    --card-bg: #ffffff;
    --font-main: 'Space Grotesk', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Background Animation */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../images/full_image_3.jpg') no-repeat center center/cover;
    opacity: 0.15;
    z-index: -1;
}

.overlay {
    background: rgba(255, 255, 255, 0.4);
    min-height: 100vh;
    backdrop-filter: blur(5px);
}

header {
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

header nav a {
    margin-left: 1.5rem;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    transition: color 0.3s;
}

header nav a:hover {
    color: var(--primary-color);
}

.container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
    text-align: center;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.8;
}

/* Model Toggle */
.controls {
    margin: 2rem 0;
}

.model-toggle {
    display: inline-flex;
    background: #fff;
    border-radius: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 5px;
}

.toggle-btn {
    border: none;
    background: transparent;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#model-desc {
    margin-top: 1rem;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-color);
}

/* Upload Area */
.drop-zone {
    background: rgba(255, 255, 255, 0.8);
    border: 3px dashed var(--secondary-color);
    border-radius: 20px;
    padding: 3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    max-width: 600px;
    margin: 0 auto;
}

.drop-zone:hover,
.drop-zone.dragover {
    background: #fff;
    border-color: var(--primary-color);
    transform: scale(1.02);
}

.upload-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
    transition: background 0.3s;
}

.upload-btn:hover {
    background: #1B5E20;
}

#file-input {
    display: none;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease-out;
    transition: transform 0.3s;
    text-align: left;
    max-width: 320px;
    /* Enforce limits */
    margin: 0 auto;
    /* Center in grid cell */
    width: 100%;
    /* Ensure it takes space up to max-width */
}

.card:hover {
    transform: translateY(-5px);
}

.card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 2px solid #eaeaea;
}

/* Prediction Bars */
.prediction-item {
    margin-bottom: 12px;
}
.prediction-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 4px;
    font-weight: 600;
}
.pred-name { color: #333; }
.pred-prob { color: var(--primary-color); }
.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.5s ease-out;
}

/* Feedback UI */
.feedback-box {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eaeaea;
    text-align: center;
    font-size: 0.85rem;
}
.feedback-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 8px;
}
.btn-feedback {
    padding: 5px 12px;
    border: 1px solid #ccc;
    background: #fdfdfd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}
.btn-feedback:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.btn-feedback.no-btn:hover {
    background: #d32f2f;
    border-color: #d32f2f;
}
.actual-species-input {
    display: none;
    margin-top: 10px;
}
.actual-species-input input {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.8rem;
}
.actual-species-input button {
    margin-top: 5px;
    width: 100%;
    background: #4CAF50;
    color: white;
    border: none;
    padding: 5px;
    border-radius: 4px;
    cursor: pointer;
}

/* Skeleton Loading Status */
.image-loading-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
}
.scanner-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(76, 175, 80, 0.8);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.8);
    animation: scan 2s linear infinite;
}
@keyframes scan {
    0% { top: 0; }
    50% { top: 100%; }
    100% { top: 0; }
}

.card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 3px solid var(--secondary-color);
}

.card-body {
    padding: 1rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.confidence-bar {
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* --- New Sections Styling --- */

.info-section {
    padding: 4rem 2rem;
    text-align: left;
}

.info-section.alt-bg {
    background: rgba(129, 199, 132, 0.1);
    /* Light green tint */
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.info-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 2rem;
    border-bottom: 2px solid var(--secondary-color);
    display: inline-block;
    padding-bottom: 0.5rem;
}

.info-section p {
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Species List Details */
/* Search Box */
.species-search-container {
    max-width: 800px;
    margin: 0 auto 20px;
    text-align: center;
}

.search-box {
    position: relative;
    max-width: 500px;
    margin: 0 auto 15px;
}

.search-box input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border: 2px solid #e1e1e1;
    border-radius: 30px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
    background: #fff;
    font-family: inherit;
}

.search-box input:focus {
    border-color: var(--primary-color);
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
}

.legend {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 15px;
}

/* Scrollable Container */
.species-list-container {
    max-width: 800px;
    margin: 0 auto;
    height: 500px;
    /* Limit height */
    overflow-y: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    padding: 0;
    text-align: left;
    border: 1px solid #eee;
}

#full-species-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#full-species-list li {
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

#full-species-list li:last-child {
    border-bottom: none;
}

#full-species-list li:hover {
    background-color: #f9fdf9;
}

.species-name {
    font-weight: 500;
    color: #333;
}

.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-left: 5px;
    font-weight: bold;
    text-transform: uppercase;
    display: inline-block;
}

.badge.wg {
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

.badge.india {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

/* Publication Card */
.publication-card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    border-left: 5px solid var(--primary-color);
}

.publication-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.publication-card a {
    display: inline-block;
    margin-top: 1rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

/* Donate Section */
.donate-options {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 2rem;
    align-items: center;
}

.donate-btn {
    background: #0070ba;
    /* PayPal Blue */
    color: white;
    padding: 12px 25px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s;
}

.donate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.bank-details {
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    font-size: 0.9rem;
}

/* Footer */
footer {
    background: #1B5E20;
    color: #E8F5E9;
    padding: 3rem 2rem 1rem;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.footer-col h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.footer-col p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.footer-col a {
    color: #E8F5E9;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-col a:hover {
    color: var(--accent-color);
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    font-size: 1.5rem;
}

.footer-bottom {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Image Editor Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 800px;
    border-radius: 15px;
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 10px;
    z-index: 10;
}

.close-modal:hover {
    color: #000;
}

.editor-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-grow: 1;
    overflow: hidden;
}

.img-container {
    max-height: 400px;
    /* Limit height for canvas */
    background: #333;
    overflow: hidden;
    border-radius: 8px;
    text-align: center;
}

.img-container img {
    max-width: 100%;
    display: block;
    /* Important for Cropper.js */
}

.editor-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.control-btn {
    background: #f0f0f0;
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.3s;
}

.control-btn:hover {
    background: #e0e0e0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.cancel-btn {
    background: #ccc;
    color: #333;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
}

.save-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

.edit-btn {
    background: #FFB74D;
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 10px;
    width: 100%;
}

/* Crop overlay button on card images */
.card-img-wrapper {
    position: relative;
    width: 100%;
}
.card-img-wrapper .card-img {
    display: block;
}
.crop-overlay-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.25s ease, background 0.25s ease;
    z-index: 5;
    backdrop-filter: blur(4px);
}
.card:hover .crop-overlay-btn {
    opacity: 1;
}
.crop-overlay-btn:hover {
    background: var(--primary-color);
}

/* Aspect ratio buttons in editor */
.aspect-ratio-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}
.aspect-btn {
    background: #f0f0f0;
    border: 2px solid transparent;
    border-radius: 5px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    transition: all 0.2s;
}
.aspect-btn:hover {
    background: #e0e0e0;
}
.aspect-btn.active {
    border-color: var(--primary-color);
    background: #e8f5e9;
    color: var(--primary-color);
}

/* Crop hint for unidentified results */
.crop-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #fff3e0;
    border: 1px solid #FFB74D;
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 10px;
    font-size: 0.82rem;
    color: #e65100;
    line-height: 1.4;
}
.crop-hint i {
    font-size: 1.1rem;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    header nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    header nav a {
        margin: 0;
        font-size: 0.95rem;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .info-section {
        padding: 3rem 1rem;
    }

    .container {
        padding: 0 1rem;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .species-list-container {
        height: 400px;
        /* Slightly shorter on mobile */
    }

    .search-box input {
        padding: 10px 15px 10px 40px;
    }

    .donate-options {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero h2 {
        font-size: 1.75rem;
    }

    .toggle-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}