.personality-card-container .col-12 {
    margin-bottom: 2rem;
}

/* When the container is NOT expanded, hide cards from the 5th one onwards */
.personality-card-container:not(.is-expanded) > .col-12:nth-child(n+5) {
    display: none;
}

/* New wrapper for positioning the fade overlay */
.listings-cards-container {
    position: relative;
}

/* New fade overlay style */
.fade-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 250px; /* Increased height to cover more of the last card */
    background: linear-gradient(to top, white 30%, rgba(255, 255, 255, 0));
    pointer-events: none; /* Allows clicking through the overlay */
    transition: opacity 0.3s ease;
    opacity: 1;
}

.listings-cards-container.is-expanded .fade-overlay {
    opacity: 0;
}

/* This positions the 'View More' button over the fade */
#viewMoreContainer {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5; /* Ensure button is on top of the fade effect */
}

/* This styles the 'See Less' button container for when it appears */
#seeLessContainer {
    text-align: center;
    margin: 2rem 0;
}

.btn-view-more {
    background-color: transparent;
    color: #000; /* Black text color */
    padding: 0.75rem 2rem;
    border-radius: 0.25rem; /* Smooth square corners */
    text-transform: uppercase;
    font-weight: 600;
    border: none;
    transition: all 0.3s ease;
}

.btn-view-more:hover {
    background-color: #F5A623; /* Orange fill on hover */
    color: #000; /* Black text color on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.hidden {
    display: none;
}

/* Pagination Styles */
.pagination .page-item .page-link {
    color: #000; /* Black text */
    border: 1px solid #ddd;
    margin: 0 2px;
    border-radius: 0.25rem;
}
.pagination .page-item.active .page-link {
    background-color: #F5A623; /* Orange background */
    border-color: #F5A623; /* Orange border */
    color: #000; /* Black text */
}
.pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: #e9ecef;
}

.personality-card {
    position: relative;
    border: 1px solid #eee;
    border-radius: 0.5rem;
    overflow: hidden;
    height: 350px; /* Fixed height for desktop */
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: row; /* Explicitly set direction to override Bootstrap */
    align-items: stretch; /* Ensure panes stretch to full height */
    color: #333; /* Changed text color to dark grey */
    background-color: #fff; /* Set card background to white */
    transition: all 0.3s ease;
}

.personality-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.15);
}

.personality-card:has(.expanded) {
    height: auto;
}

.personality-image-pane {
    width: 35%; /* Swapped width */
    flex-shrink: 0;
    position: relative;
    /* Removed background properties */
}

.personality-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.personality-content-pane {
    width: 65%; /* Swapped width */
    flex-shrink: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: #C3B091; /* Natural Warm Khaki */
    color: #333; /* Dark text for contrast */
}

/* The .personality-content-overlay class has been removed as it is no longer in use */

.personality-text-content {
    position: relative;
    /* z-index: 2; no longer needed */
    height: 100%;
    display: flex;
    flex-direction: column;
}

.personality-name {
    font-weight: 700;
    font-size: 1.55rem; /* Increased font size */
    margin-bottom: 0.25rem;
}

.personality-speciality {
    font-weight: 500;
    font-size: 1.05rem; /* Increased font size */
    margin-bottom: 1rem;
    opacity: 0.9;
    /* color: #f0f0f0; Lighter text color for speciality - REMOVED */
}

.personality-bio {
    font-size: 0.9rem; /* Increased font size */
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: max-height 0.5s ease-out;
    max-height: 4.5em; /* Approx 3 lines */
}

.competencies-title {
    font-size: 0.95rem; /* Increased font size */
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.competencies-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem; /* Increased font size */
    /* Truncation properties removed for desktop default */
}

.competency-item {
    background-color: #DCD0B9; /* Lighter khaki background for tags */
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    color: #333; /* Dark text for tags */
}

.personality-profile-link {
    color: #fff; /* White color for the link */
    text-decoration: underline;
    font-weight: 600;
    margin-top: auto;
    padding-top: 1rem;
    display: inline-block;
}

.personality-bio.expanded {
    max-height: 500px; /* Large enough for full content */
}

/* Fade-out effect for truncated text - Desktop: Bio only */
.personality-bio:not(.expanded)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1.5rem;
    background: linear-gradient(to bottom, rgba(195, 176, 145, 0), rgba(195, 176, 145, 1) 80%);
    pointer-events: none; /* To allow clicking through the gradient */
}

.verified-badge {
    position: absolute;
    top: 1rem;
    right: 1rem; /* Positioned to the top right */
    z-index: 3;
    color: #fff;
    background-color: rgba(0,0,0,0.4);
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    font-size: 0.8rem;
}

.personality-social-buttons {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.75rem;
    z-index: 3;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    background-color: transparent;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3); /* Add a subtle shadow for visibility */
}

.social-btn:hover {
    background-color: #fff;
    color: #333;
}

.social-btn i {
    font-size: 1rem;
}

/* Responsive styles for mobile */
@media (max-width: 768px) {
    .personality-card {
        height: auto;
    }

    /* Add truncation to competencies list on mobile */
    .competencies-list {
        position: relative;
        overflow: hidden;
        cursor: pointer;
        transition: max-height 0.5s ease-out;
        max-height: 50px;
    }

    .competencies-list.expanded {
        max-height: 500px;
    }

    /* Add fade-out to competencies list on mobile */
    .competencies-list:not(.expanded)::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 1.5rem;
        background: linear-gradient(to bottom, rgba(195, 176, 145, 0), rgba(195, 176, 145, 1) 80%);
        pointer-events: none;
    }

    /* Make competencies simple underlined text */
    .competency-item {
        background-color: transparent;
        padding: 0;
        border-radius: 0;
        text-decoration: underline;
    }

    /* Hide competencies heading */
    .competencies-title {
        display: none;
    }

    /* Position social media icons to overlay both panes */
    .personality-social-buttons {
        left: -43%; /* Calculated to be center of the card */
        transform: translateX(-50%);
    }

    .personality-content-pane {
        padding-bottom: 3.5rem; /* Add padding to lift link above buttons */
    }
}