/* General Body and Layout */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: #eef2f6; /* Lighter, modern background */
    color: #333;
}

.main-content {
    display: flex;
    width: 100%;
    max-width: 1400px; /* Slightly wider for more content */
    background-color: #ffffff;
    border-radius: 12px; /* More rounded corners */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); /* Softer, more pronounced shadow */
    margin: 30px auto; /* Center the main content with more vertical margin */
    overflow: hidden; /* Ensures rounded corners are respected */
    min-height: calc(100vh - 110px); /* Ensure content takes up most of the viewport height */
}

/* Profile Section - Left Column */
.profile-section {
    flex: 1; /* Takes up 1 part of the space */
    background-color: #f8fcf8; /* Very light green background */
    padding: 30px;
    border-right: 1px solid #e0e0e0; /* Lighter border */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px; /* Space between elements */
    min-width: 350px; /* Minimum width for the profile section */
}

.profile-card {
    width: 100%;
    max-width: 320px; /* Max width for the profile card content */
    text-align: center;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    padding: 25px;
}

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 25px;
}

.profile-icon {
    font-size: 100px; /* Slightly smaller */
    color: #4CAF50; /* A more vibrant green */
    margin-bottom: 10px;
}

.profile-picture {
    width: 120px; /* Slightly larger */
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #4CAF50; /* Thicker, vibrant green border */
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.profile-header h2 {
    margin: 0;
    color: #2c3e50; /* Darker text for better contrast */
    font-size: 28px;
    font-weight: 600;
}

.edit-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 25px; /* More generous padding */
    border-radius: 25px; /* Pill-shaped button */
    cursor: pointer;
    font-size: 16px;
    margin-top: 15px;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.edit-button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.profile-details {
    text-align: left;
    width: 100%;
    margin-bottom: 20px;
}

.detail-item {
    margin-bottom: 15px;
}

.detail-item label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    font-size: 15px;
}

.detail-item input[type="text"] {
    width: 100%; /* Full width */
    padding: 12px 15px;
    border: 1px solid #dcdcdc; /* Lighter border */
    border-radius: 8px; /* More rounded inputs */
    background-color: #fdfdfd;
    color: #333;
    font-size: 16px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: border-color 0.3s ease;
}

.detail-item input[type="text"]:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

#mapid {
    width: 100%;
    height: 300px; /* Taller map */
    background-color: #e9ecef; /* Light grey for map background */
    border-radius: 10px;
    margin-top: 20px;
    border: 1px solid #ced4da; /* Subtle border */
    z-index: 1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Dashboard Section - Right Column */
.dashboard-section {
    flex: 2; /* Takes up 2 parts of the space */
    padding: 30px;
    background-color: #fdfdfd; /* Clean white background */
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.dashboard-header h1 {
    margin: 0;
    color: #2c3e50;
    font-size: 32px;
    font-weight: 700;
}

.products-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.products-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 28px;
    font-weight: 600;
}

.add-product-button {
    background-color: #28a745; /* Green for add button */
    color: white;
    border: none;
    padding: 12px 25px; /* More generous padding */
    border-radius: 25px; /* Pill-shaped button */
    font-size: 16px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    gap: 8px; /* Space between icon and text */
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.add-product-button:hover {
    background-color: #218838;
    transform: translateY(-2px);
}

.product-list {
    display: flex; /* Change to flex for horizontal stacking */
    flex-direction: row; /* Stack products horizontally */
    flex-wrap: wrap; /* Wrap to next row */
    gap: 25px; /* Space between items */
    flex-grow: 1; /* Allow product list to grow */
    align-items: flex-start; /* Prevent vertical stretching */
}

.product-card {
    display: flex;
    flex-direction: column; /* Stack content vertically */
    width: calc(50% - 12.5px); /* Two cards per row */
    height: auto; /* Auto height for natural sizing */
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px; /* More rounded corners */
    padding: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.07);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden; /* Ensures image corners are respected */
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.product-image-placeholder {
    width: 100% !important; /* Full width of card */
    height: 100% !important; /* Fill container height */
    max-height: 200px !important; /* Maximum height to prevent overflow */
    object-fit: cover !important; /* Cover to fill space, cropping if needed */
    border-radius: 10px; /* Rounded corners for image */
    margin-bottom: 15px;
    background-color: #e9ecef; /* Placeholder background */
    display: block; /* Ensure proper display */
}

.product-details {
    flex-grow: 1;
    text-align: left;
    margin-bottom: 10px;
}

.product-details h3 {
    margin: 0 0 5px 0;
    color: #2c3e50;
    font-size: 22px;
    font-weight: 600;
}

.product-details p { /* Styling for farmer name */
    margin: 0 0 10px 0;
    color: #6c757d;
    font-size: 15px;
}

.product-price {
    font-weight: bold;
    color: #007bff; /* Blue for price */
    font-size: 20px;
    margin-bottom: 10px;
}

.product-condition {
    font-size: 15px;
    color: #555;
    margin-bottom: 10px;
}

.condition-label {
    font-weight: 600;
    color: #444;
}

.product-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    margin-top: auto; /* Pushes status to the bottom */
}

.status-label {
    color: #777;
}

.status-value {
    font-weight: 600;
}

.status-value.expired {
    color: #dc3545; /* Red for expired */
}

.status-value.active {
    color: #28a745; /* Green for active */
}

/* Product Image Container for consistent sizing */
.product-image-container {
    width: 100%;
    height: auto;
    max-height: 200px;
    aspect-ratio: 4/3;
    overflow: hidden; /* Ensure image doesn't overflow */
    border-radius: 10px;
    margin-bottom: 15px;
    background-color: #e9ecef;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Override any conflicting image styles from other CSS files */
.product-image,
.product-image-container img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 10px;
}

/* Product Poster (From: Farmer Name) */
.product-poster {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6c757d;
    font-size: 15px;
    margin-bottom: 10px;
}

.product-poster .fas {
    color: #4CAF50; /* Green icon */
}

/* Product Footer for status and actions */
.product-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    margin-top: auto;
}

.product-actions {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-top: 10px;
}

.product-actions .btn {
    flex: 1; /* Distribute buttons evenly */
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 20px; /* More rounded buttons */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-info {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
    border-color: #117a8b;
}

.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

/* Detail item icons */
.detail-item .detail-icon {
    margin-right: 8px;
    color: #007bff; /* Blue for detail icons */
}

/* No listings found message */
.text-center {
    width: 100%; /* Full width in flex container */
    padding: 40px;
    background-color: #f8f9fa;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

.text-center h4 {
    color: #343a40;
    font-size: 24px;
    margin-bottom: 15px;
}

.text-center p {
    color: #6c757d;
    font-size: 17px;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .main-content {
        flex-direction: column;
        margin: 20px auto;
        max-width: 95%;
        min-height: unset; /* Reset min-height for smaller screens */
    }

    .profile-section {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 20px;
    }

    .profile-card {
        max-width: 100%;
        padding: 20px;
    }

    .dashboard-section {
        padding: 20px;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding-bottom: 10px;
    }

    .products-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
    }

    .products-header h2 {
        font-size: 22px;
    }

    .add-product-button {
        width: 100%;
    }


}

@media (max-width: 768px) {
    .main-content {
        margin: 15px auto;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    .profile-section {
        padding: 15px;
    }

    .profile-card {
        padding: 15px;
    }

    .profile-header h2 {
        font-size: 24px;
    }

    .edit-button {
        padding: 9px 18px;
        font-size: 14px;
    }

    .dashboard-section {
        padding: 15px;
    }

    .dashboard-header h1 {
        font-size: 26px;
    }

    .products-header h2 {
        font-size: 20px;
    }

    .add-product-button {
        padding: 9px 18px;
        font-size: 14px;
    }



    .product-card {
        padding: 12px;
    }

    .product-details h3 {
        font-size: 18px;
    }

    .product-price {
        font-size: 16px;
    }

    .product-condition, .product-status {
        font-size: 12px;
    }
}

@media (max-width: 576px) {
    .main-content {
        margin: 10px auto;
        border-radius: 0;
        box-shadow: none;
    }

    .profile-section, .dashboard-section {
        padding: 10px;
    }

    .profile-header h2 {
        font-size: 20px;
    }

    .edit-button, .add-product-button {
        padding: 8px 15px;
        font-size: 13px;
    }

    .dashboard-header h1 {
        font-size: 22px;
    }

    .products-header h2 {
        font-size: 18px;
    }



    .product-card {
        padding: 10px;
    }

    .product-details h3 {
        font-size: 16px;
    }

    .product-price {
        font-size: 15px;
    }

    .detail-item input[type="text"] {
        font-size: 14px;
        padding: 8px 10px;
    }

    #mapid {
        height: 200px;
    }
}

/* Modal Responsive Adjustments */
.modal-content {
    width: 90%;
    max-width: 500px;
    margin: 10% auto;
    padding: 20px;
}

@media (max-width: 576px) {
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 15px;
    }

    .modal-content h2 {
        font-size: 20px;
    }

    .form-group label {
        font-size: 14px;
    }

    .form-group input,
    .form-group select {
        padding: 8px;
        font-size: 14px;
    }

    .btn-primary {
        padding: 10px 15px;
        font-size: 14px;
    }
}
