/* ========================================================= */
/* 1. CONTAINER AND 3D SETUP */
/* ========================================================= */
.flip-card-container {
    perspective: 1000px; 
    width: 100%; 
    max-width: 600px; 
    aspect-ratio: 1 / 1.5; /* Adjusted for a slightly taller portrait aspect ratio */
    margin: 20px auto; 
}

/* Main card wrapper (the element that rotates) */
.flip-card {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s; 
    transform-style: preserve-3d; 
}

/* 2. HOVER EFFECT (The Flip) */
.flip-card-container:hover .flip-card {
    transform: rotateY(180deg);
}

/* ========================================================= */
/* 3. FRONT AND BACK STYLING (Common) */
/* ========================================================= */
.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden; 
    backface-visibility: hidden;
    
    border-radius: 15px;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
    
    /* Ensures content inside (like the image) respects the border-radius */
    overflow: hidden; 
}




/* Styling for the Front Side (Default View) */
.flip-card-front {
    background-color: #ffffff; 
    color: #212529;
    /* NEW: Use flexbox to stack image and body vertically */
    display: flex; 
    flex-direction: column;
}

/* Styling for the Back Side */
.flip-card-back {
    background-color: #007bff; 
    color: white; 
    transform: rotateY(180deg); 
    display: flex; 
    flex-direction: column; 
    justify-content: center;
    align-items: center;
    padding: 10px;
}

/* ========================================================= */
/* 4. IMAGE AND TEXT ALIGNMENT */
/* ========================================================= */

/* Control the image size and fit */
.flip-card-front .card-img-top {
    height: 500px; /* Slightly less height for the image */
    width: 100%; 
    object-fit: cover; 
    object-position: top; /* Prioritize the top of the image (face) */
    border-bottom: 1px solid #eee;

    /* Ensure image also respects the top border-radius */
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

/* Styling for content within the front card body */
.flip-card-front .card-body {
    padding: 15px 10px 10px; /* Top, horizontal, bottom */
    text-align: center;
    flex-grow: 1; /* Allows the card-body to take up remaining vertical space */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Distribute content vertically */
    
    /* Ensure this element also has its bottom border radius */
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
}

.flip-card-front .card-body .card-title {
    margin-bottom: 5px; /* Smaller margin below title */
}

.flip-card-front .card-body .card-text {
    margin-bottom: 15px; /* Standard margin below text */
}

.flip-card-front .card-body .btn {
    margin-top: auto; /* Push button to the bottom if content is short */
}


/* Styling for content within the back card */
.flip-card-back .back-content {
    padding: 20px;
    text-align: center; 
    width: 100%; 
}