/* Custom styles for the flashcard flip effect */
body {
    /* Reduced padding-top to lift content higher */
    padding-top: 1rem; /* Minimal padding at the top */
    padding-bottom: 4rem; /* Keep some padding for general layout at the bottom */
}
.flashcard-container {
    perspective: 1000px; /* Required for 3D transform */
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1; /* Allows it to take available vertical space */
    padding: 0.5rem;
}

.flashcard {
    /* Increased height for a much taller card */
    width: 95%; /* Card takes 95% of its container width */
    max-width: 800px; /* Larger max-width */
    height: 70vh; /* Even taller viewport height for better responsiveness */
    max-height: 700px; /* Even taller max-height */

    position: relative; /* Make flashcard the positioning context for absolute buttons */
    transform-style: preserve-3d;
    /* Added opacity to transition for pop-in effect */
    transition: transform 0.7s cubic-bezier(0.4, 0.0, 0.2, 1), box-shadow 0.3s ease-in-out, opacity 0.3s ease-out;
    border-radius: 1.5rem;
    /* Enhanced shadow for floating effect */
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3); /* Deeper and wider shadow */
    background-color: transparent; /* Ensure background is transparent for flip effect */
    cursor: pointer; /* Indicate it's clickable */

    /* CSS variables for rotation and scale */
    --rotateY: 0deg;
    --scale: 1;
    transform: rotateY(var(--rotateY)) scale(var(--scale)); /* Use both variables */
}

/* Floating effect on hover */
.flashcard:hover {
    transform: rotateY(var(--rotateY)) translateY(-8px) scale(calc(var(--scale) * 1.02)); /* Apply scale factor to current scale */
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.5); /* More pronounced shadow on hover */
}

.flashcard.flipped {
    --rotateY: 180deg; /* Change the rotation variable when flipped */
}

.flashcard-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: flex-start; /* Align content to the top */
    padding: 3rem; /* Adjusted padding for larger card */
    padding-bottom: 6rem; /* Add padding at the bottom to make space for floating buttons */
    text-align: right; /* Align text to the right for RTL */
    border-radius: 1.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 1.8rem; /* Larger text for larger card */
    line-height: 1.7;
    overflow-y: auto; /* Enable scrolling for long answers */
    border: 2px solid; /* Add a border for definition */
}

/* Adjust font size and padding for smaller screens */
@media (max-width: 640px) {
    .flashcard {
        height: 60vh; /* Adjust for smaller screens */
        max-height: 500px; /* Cap height on small screens */
    }
    .flashcard-face {
        font-size: 1.5rem; /* Adjusted text on mobile */
        padding: 2rem; /* Adjusted padding on mobile */
        padding-bottom: 5rem; /* Adjust padding for mobile to avoid button overlap */
    }
}

.flashcard-front {
    background-color: #ffffff; /* Pure white background */
    color: #374151; /* Dark gray text */
    border-color: #e5e7eb; /* Light gray border */
}

.flashcard-back {
    background-color: #e0f2fe; /* Very light blue background */
    color: #1e40af; /* Darker blue text */
    transform: rotateY(180deg);
    border-color: #bfdbfe; /* Light blue border */
}

/* Ensure Inter font is loaded */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');