/* Flashcard Pop-up Container */
.flashcard-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: 90%;
    max-width: 550px; /* Slightly wider */
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); /* Elegant gradient background */
    border-radius: 1.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3); /* Deeper, more pronounced shadow */
    padding: 2.5rem; /* Increased padding */
    box-sizing: border-box;
    color: #333;
    animation: fadeIn 0.4s ease-in-out;
    border: 1px solid rgba(255, 255, 255, 0.6); /* Subtle white border for a clean look */
    backdrop-filter: blur(5px); /* Add a subtle blur effect */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* The flashcard itself */
.flashcard {
    width: 100%;
    height: 320px; /* Taller flashcard */
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    cursor: pointer;
}

.flashcard.is-flipped {
    transform: rotateY(180deg);
}

.flashcard-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    box-sizing: border-box;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1); /* Soft shadow on faces */
}

.flashcard-front {
    background-color: #ffffff;
    font-size: 1.6rem;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1.4;
}

.flashcard-back {
    background-color: #e3f2fd; /* A calming light blue */
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.flashcard-back .answer-text {
    font-size: 1.3rem;
    line-height: 1.6;
    color: #34495e;
}

/* Updated controls for a more beautiful layout */
.flashcard-controls {
    display: flex;
    justify-content: center;
    gap: 2rem; /* Increased gap between buttons */
    margin-top: 3rem; /* More space above buttons */
}

.flashcard-controls button {
    padding: 1rem 2.5rem; /* Larger buttons */
    border: none;
    border-radius: 2.5rem; /* More rounded, pill-shaped buttons */
    background: linear-gradient(45deg, #5e72e4 0%, #8ec5fc 100%); /* A fresh, vibrant gradient */
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

.flashcard-controls button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.flashcard-controls button:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Close button style */
.flashcard-controls .close-btn {
    background: linear-gradient(45deg, #ff6b6b 0%, #ee5253 100%); /* A vibrant red gradient */
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
}

.flashcard-controls .close-btn:hover {
    background: linear-gradient(45deg, #e55039 0%, #c0392b 100%);
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}

/* --- Mobile-Specific Styles --- */
@media (max-width: 600px) {
    .flashcard-popup {
        padding: 1.5rem;
    }

    .flashcard {
        height: 280px;
    }

    .flashcard-front {
        font-size: 1.4rem;
    }

    .flashcard-back .answer-text {
        font-size: 1.1rem;
    }

    .flashcard-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .flashcard-controls button {
        padding: 1rem;
    }
}