/* Reset default margins and paddings for all elements */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Body styling */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f0f0; /* Light gray background */
}

/* Container that holds all the cards */
.card-container {
    display: flex;
    flex-wrap: wrap; /* Allows cards to wrap to the next line on smaller screens */
    justify-content: center; /* Centers the cards horizontally */
    padding: 50px 0; /* Vertical padding */
}

/* Outer container for each flip card */
.flip-card {
    background-color: transparent;
    width: 300px;
    height: 400px;
    margin: 20px; /* Space around each card */
    perspective: 1000px; /* Defines the 3D perspective */
}

/* Inner container that will be flipped */
.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s; /* Smooth flipping transition */
    transform-style: preserve-3d; /* Enables 3D transformations */
}

/* Flip effect on hover */
.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

/* Front and back sides of the card */
.flip-card-front, 
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden; /* Hides the backside when not facing the viewer */
    border-radius: 15px;
    overflow: hidden; /* Clips content that overflows the element's box */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Adds a subtle shadow */
}

/* Front side styling */
.flip-card-front {
    background-color: #fff; /* White background */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Image on the front side */
.flip-card-front img {
    width: 100%;
    height: 80%; /* Takes up 80% of the card's height */
    object-fit: cover; /* Scales the image to cover the container */
}

/* Title on the front side */
.flip-card-front h2 {
    padding: 15px;
    font-size: 1.5em;
    color: #333; /* Dark gray color */
}

/* Back side styling */
.flip-card-back {
    background-color: #2c3e50; /* Dark blue background */
    color: white; /* White text */
    transform: rotateY(180deg); /* Flips the backside content */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Centers content vertically */
    text-align: center;
    padding: 20px;
}

/* Title on the back side */
.flip-card-back h2 {
    margin-bottom: 15px;
    font-size: 1.5em;
}

/* Description text on the back side */
.flip-card-back p {
    font-size: 1em;
    margin-bottom: 20px;
}

/* Button on the back side */
.flip-card-back button {
    padding: 10px 25px;
    background-color: #e74c3c; /* Red color */
    color: white;
    border: none;
    border-radius: 50px; /* Rounded corners */
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s; /* Smooth transition on hover */
}

/* Hover effect for the button */
.flip-card-back button:hover {
    background-color: #c0392b; /* Darker red */
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    .card-container {
        flex-direction: column; /* Stacks cards vertically */
        align-items: center;
    }

    .flip-card {
        width: 80%; /* Makes cards wider on small screens */
        margin: 15px 0;
    }
}
