/* General Styles */
body {
    font-family: Arial, sans-serif;
    background-color: #f0f5f0;
    color: #333;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

.plant-image .image-btn {
    display: inline-block;
  }
header {
    background-color: #29c60d;
    color: white;
    padding: 10px 0;
    width: 100vw; /* Full-width header for mobile */
    box-sizing: border-box; /* Include padding in width */
    position: relative;
}

.hamburger {
    display: none; /* Hidden by default on larger screens */
    position: absolute;
    top: 10px;
    left: 10px;
    cursor: pointer;
    z-index: 1001;
}

.hamburger div {
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 5px 0;
    transition: 0.3s;
}

nav ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    text-align: center;
}

nav ul li {
    display: inline-block;
    margin: 0 15px;
}

nav ul li a, nav ul li button {
    color: white;
    text-decoration: none;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px 20px;
}

nav ul li button:hover, nav ul li a:hover {
    background-color: #1e4423;
    border-radius: 5px;
}

main {
    padding: 20px;
    flex-grow: 1;
}

.hidden {
    display: none;
}

footer {
    text-align: center;
    padding: 20px;
    background-color: #2c5d3f;
    color: white;
    position: relative;
    width: 100vw; /* Full-width footer for mobile */
    box-sizing: border-box; /* Include padding in width */
    margin-top: auto;
}

#plant-name {
    position: relative;
    width: 100%;
}

.edit-btn {
    background-color: #2c5d3f;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    z-index: 10;
    position: relative; /* Change to relative positioning */
    margin-left: 10px; /* Add some margin to separate it from the common name */
}

.edit-btn:hover {
    background-color: #1e4423;
}

/* Welcome Section Styles */
.welcome-section {
    text-align: center;
    margin: 20px 0;
}

.welcome-section h1 {
    font-size: 2em;
    margin-bottom: 10px;
}

.welcome-section p {
    font-size: 1.2em;
    color: #666;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 50%;  /* Center horizontally */
    top: 50%;   /* Center vertically */
    transform: translate(-50%, -50%); /* Ensures the modal is truly centered */
    width: 90%;  /* Reduced width to fit smaller screens */
    max-width: 500px;
    max-height: 80% ; /* Maximum width for larger screens */
    height: auto; /* Adjust height based on content */
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    border-radius: 10px;
    margin: 0;  /* Reset margin to ensure proper centering */
    position: relative;
}

.close {
    color: #aaa;
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover, .close:focus {
    color: black;
}

/* Form Styles */
form label {
    display: block;
    margin-top: 10px;
}

form input, form select, form textarea {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border-radius: 5px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

form button {
    margin-top: 15px;
    padding: 10px 20px;
    background-color: #2c5d3f;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

form button:hover {
    background-color: #1e4423;
}

/* Admin and Guest Home Styles */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.add-plant-btn {
    background-color: #2c5d3f;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
}

.plant-display-section {
    margin-top: 20px;
}

.plant-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.plant-item {
    background-color: white;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.plant-item:hover {
    transform: scale(1.05);
}

.plant-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.plant-item .plant-info {
    padding: 10px;
    text-align: center;
}

.search-bar {
    margin: 20px 0;
    text-align: center;
}

.search-bar input {
    width: 50%;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

/* Plant Detail Page Styles */
.detail-container {
    display: flex;
    flex-wrap: wrap;
    margin-top: 20px;
    position: relative; /* For positioning the edit button */
}

.plant-image {
    flex: 1;
    max-width: 45%;
    margin-right: 4%;
}

.plant-image img {
    width: 100%;
    height: auto;
    border-radius: 5px;
}

.plant-info {
    flex: 1;
    max-width: 45%;
}

.plant-gallery {
    margin-top: 20px;
}

.plant-gallery img {
    width: 100px;
    height: 100px;
    margin-right: 10px;
    border-radius: 5px;
    cursor: pointer;
    object-fit: cover;
    transition: transform 0.2s;
}

.plant-gallery img:hover {
    transform: scale(1.1);
}
/* New Thumbnail Styles */
.thumbnail {
    width: 100px;
    height: 100px;
    object-fit: cover;
    margin: 5px;
    cursor: pointer;
    border-radius: 5px;
}

.thumbnail:hover {
    border: 2px solid #4CAF50;
}

.plant-uses, .plant-preparation, .plant-side-effects, .admin-comments, .guest-comments {
    margin-top: 20px;
}

.plant-uses p, .plant-preparation p, .plant-side-effects p, .admin-comments p, .guest-comments p {
    background-color: white;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.edit-btn {
    background-color: #2c5d3f;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    z-index: 10;
    position: relative; /* Change to relative positioning */
    margin-left: 10px; /* Add some margin to separate it from the common name */
}

.edit-btn:hover {
    background-color: #1e4423;
}

/* Delete Button Styles */
.delete-btn {
    background-color: #e74c3c;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    z-index: 10;
    position: relative;
    margin-left: 10px;
}

.delete-btn:hover {
    background-color: #c0392b;
}
/* New Image Buttons */
.image-btn {
    background-color: #f44336; /* Red color for delete button */
    color: white;
    border: none;
    padding: 10px;
    margin-top: 10px;
    cursor: pointer;
    font-size: 14px;
    border-radius: 5px;
    display: block;
    width: 100%;
    text-align: center;
    max-width: 150px;
}

#add-image-btn {
    background-color: #4CAF50; /* Green color for add button */
    margin-top: 5px;
}

.image-btn:hover {
    opacity: 0.8;
}


/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 1000; /* Ensure it’s on top of other content */
}

.loading-spinner {
    border: 8px solid #f3f3f3; /* Light grey */
    border-top: 8px solid #3498db; /* Blue */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay p {
    margin-top: 10px;
    font-size: 16px;
}

/* About Page Styles */
.about-page {
    padding: 20px;
}

.about-page h1 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2em;
}

.about-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
}

.image-container {
    flex: 1;
    text-align: center;
}

.image-container img {
    width: 100%;
    max-width: 300px;
    height: auto;
    border-radius: 50%;
    border: 5px solid #ddd;
}

.text-content {
    flex: 2;
}

.text-content p {
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Add a class to style the name below the image */
.name {
    margin-top: 1rem; /* Adjust spacing between image and name */
    text-align: center;
    font-size: 1rem; /* Adjust font size as needed */
}

/* Back Arrow Styles */
.back-arrow {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.back-arrow img {
    width: 30px; /* Set the desired size for the icon */
    height: 30px; /* Ensure height matches the width for a square icon */
    object-fit: contain; /* Ensures the image fits within the dimensions without distortion */
    transition: opacity 0.3s;
}

.back-arrow img:hover {
    opacity: 0.7;
}

/* Styles for the Images button */
#show-gallery-btn {
    display: block;
    margin-top: 1rem;
    padding: 10px 20px;
    background-color: #007bff; /* Blue background */
    color: white; /* White text */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    text-align: center;
    transition: background-color 0.3s ease;
  }
  
  #show-gallery-btn:hover {
    background-color: #0056b3; /* Darker blue on hover */
  }
 
  
/* Mobile View Adjustments */
@media (max-width: 768px) {
    .about-content {
        flex-direction: column; /* Stack image and text vertically on mobile */
        align-items: center; /* Center items horizontally */
    }

    .image-container {
        max-width: 200px; /* Adjust max-width for mobile view */
        margin-bottom: 1rem; /* Space between image and text */
    }

    .image-container img {
        max-width: 150px; /* Adjust max-width for mobile view */
    }

    .text-content {
        flex: 1;
        max-width: 100%;
        text-align: center; /* Center text content on mobile */
    }

    .detail-container {
        display: flex;
        flex-direction: column;
        margin-top: 20px;
    }

    .plant-image {
        flex: 1;
        max-width: 100%;
        margin-bottom: 50px; /* Increased space between primary image and gallery */
        border-bottom: 2px solid #d3d3d3; /* Semi-thick grey line below the image */
        padding-bottom: 10px; /* Optional: Adds space between image and the line */
    }
    

    .plant-image img {
        width: 100%;
        height: auto;
        border-radius: 5px;
    }

    .plant-gallery {
        margin-top: 20px; /* Space between gallery and other content */
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    .plant-gallery img {
        width: 100px;
        height: 100px;
        border-radius: 5px;
        cursor: pointer;
        object-fit: cover;
        transition: transform 0.2s;
    }

    .plant-gallery img:hover {
        transform: scale(1.1);
    }

    .plant-info {
        flex: 1;
        max-width: 100%;
    }

    /* Adjustments for modal on small screens */
    .modal {
        width: 95%;  /* Increase width for very small screens */
    }

    /* Modify plant list grid for mobile screens */
    .plant-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr); /* 2 images per row */
        gap: 10px; /* Adjust gap between items if needed */
    }

    /* About page adjustments for mobile */
    .about-content {
        flex-direction: column;
        text-align: center;
    }

    .image-container img {
        margin-bottom: 1rem;
    }

    .text-content {
        flex: 1;
        max-width: 100%;
    }
}

/* Container for the camera icon and input */
.camera-icon-container {
    position: relative;
    display: inline-block;
}

/* Styling for the camera icon */
.camera-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px; /* Adjust size as needed */
    height: 50px; /* Adjust size as needed */
    background-color: #000; /* Background color of the camera icon */
    border-radius: 50%; /* Makes it circular */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.camera-icon img {
    width: 30px; /* Adjust size of the icon image as needed */
    height: 30px; /* Adjust size of the icon image as needed */
}

/* Hide the file input */
#image-upload {
    display: none;
}
/* Show the button only on mobile devices (max-width: 768px) */
@media only screen and (max-width: 768px) {
    #view-images-mobile-btn {
        display: block;
    }
}

/* Desktop View - 3 images per row */
@media (min-width: 769px) {
    .plant-gallery {
        display: grid;
        grid-template-columns: repeat(3, 1fr); /* 3 images per row */
        gap: 10px;
    }
}
