/* public/css/services.css */

/*
 This file contains custom CSS rules that are not easily
 achieved with Tailwind utility classes alone.
 It is designed to complement the Tailwind-based HTML structure.
*/

/* ----------------------------------
 * Collapsible Section
 * ---------------------------------- */
.collapsible-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, opacity 0.5s ease-in-out;
    opacity: 0;
}

.collapsible-details.expanded {
    max-height: 2000px; /* Use a large value to allow for expansion */
    opacity: 1;
}

.toggle-btn {
    cursor: pointer;
    user-select: none;
}

/* ----------------------------------
 * View Toggling Styles
 * ---------------------------------- */

/* Base style for vendor cards */
.vendor-card {
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

/* Fix: Correct Grid View for the parent container */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem; /* Space between grid items */
    align-items: stretch;
}

/* Fix: Correct List View for the parent container */
.list-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* Space between list items */
}

/* Fix: Ensure cards in the list view are responsive and use flexbox */
.list-layout .vendor-card {
    display: flex;
    flex-direction: column; /* Default for smaller screens */
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* New class to manage the main content area in list view */
.list-main-content {
    flex-grow: 1;
}

/* New class to manage the "Read more" button container in list view */
.list-toggle-container {
    display: flex;
    align-self: flex-end; /* Align to the bottom right in row layout */
}

/* Updated styling to ensure list view content stretches to full width */
.list-view-active .vendor-details-section {
    flex-grow: 1; /* Allows the details section to take up available space */
}

/* On medium screens and up, switch to a row layout for the list view */
@media (min-width: 768px) {
    .list-layout .vendor-card {
        flex-direction: row; /* Change to a row for larger screens */
        justify-content: space-between;
        align-items: flex-start;
        padding: 1.5rem;
        gap: 1.5rem; /* Space between the card's content sections */
    }

    /* Make the collapsible toggle button visible again in list view */
    .list-layout .toggle-btn {
        display: block;
    }
    
    .list-layout .vendor-card .list-main-content {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
    }

    .list-layout .vendor-card .list-toggle-container {
        display: flex;
        flex-direction: column;
        align-items: flex-end; /* Align to the right */
        text-align: right; /* Text alignment for smaller elements */
        margin-left: 1rem;
        flex-shrink: 0; /* Prevents it from shrinking too much */
    }
}