/* Basic body and container styling for centering and background */
body {
    font-family: 'Inter', sans-serif; /* Using Inter font as per guidelines */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align content to the top */
    min-height: 100vh; /* Minimum height to fill the viewport */
    background-color: #f0f2f5; /* Light grey background */
    margin: 0; /* Remove default body margin */
    padding: 20px; /* Padding around the main content */
    box-sizing: border-box; /* Include padding in element's total width and height */
}

.container {
    background-color: #ffffff; /* White background for the main container */
    padding: 30px;
    border-radius: 12px; /* Rounded corners for the container */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15); /* Soft shadow for depth */
    width: 95%; /* Responsive width */
    max-width: 1000px; /* Maximum width for larger screens */
    text-align: center;
    margin-top: 20px; /* Space from the top of the viewport */
}

/* Heading styles */
h1, h2 {
    color: #2c3e50; /* Darker blue-grey for headings */
    margin-bottom: 20px;
}

/* Input section styling */
.input-section {
    margin-bottom: 30px;
    padding: 25px;
    background-color: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.input-section p {
    color: #555;
    margin-bottom: 15px;
    line-height: 1.15;
}

/* New Flexbox container for the columns */
.input-content {
    display: flex;
    flex-wrap: wrap; /* Allow columns to wrap on smaller screens */
    gap: 30px; /* Space between columns */
    margin-bottom: 20px; /* Space before the generate button */
}

.times-tables-column {
    flex: 1; /* Takes up 1 part of the available space (1/3) */
    min-width: 200px; /* Ensure it doesn't get too small */
}

.options-column {
    flex: 3; /* Takes up 2 parts of the available space (2/3) */
    min-width: 300px; /* Ensure it doesn't get too small (needs more room for radio buttons) */
    display: flex; /* Make options-column content a flex container */
    flex-direction: column; /* Stack its children vertically */
    justify-content: space-between; /* Distribute space vertically */
    gap: 20px; /* Space between operation and deck size selection groups */
}

.selection-group {
    margin-bottom: 0; /* Reset margin-bottom as gap handles spacing now */
    text-align: left;
}

.selection-group p {
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.checkbox-group, .radio-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start; /* Align checkboxes to the left */
    margin-bottom: 0; /* Reset margin-bottom */
}

.checkbox-group label, .radio-buttons label {
    background-color: #e9ecef;
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #ced4da;
    display: flex;
    align-items: center;
    font-size: 0.95em;
    color: #495057;
}

.checkbox-group input[type="checkbox"], .radio-buttons input[type="radio"] {
    margin-right: 8px;
    accent-color: #3498db;
}

.checkbox-group label:hover, .radio-buttons label:hover {
    background-color: #dde1e5;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.checkbox-group input[type="checkbox"]:checked + *,
.radio-buttons input[type="radio"]:checked + * {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
    box-shadow: 0 2px 5px rgba(52, 152, 219, 0.4);
}

.note {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
    text-align: center;
}

/* Button styling */
#generateDeckBtn, #nextCardsBtn {
    background-color: #28a745;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-top: 0px;
}

#generateDeckBtn:hover, #nextCardsBtn:hover {
    background-color: #218838;
    transform: translateY(-2px);
}

#generateDeckBtn:active, #nextCardsBtn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#nextCardsBtn {
    background-color: #007bff;
    margin-top: 20px;
}

#nextCardsBtn:hover {
    background-color: #0056b3;
}


/* Card display section */
.card-display-section {
    margin-top: 40px;
}

.card-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    min-height: 300px;
}

.card {
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 15px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    /* Updated Card Dimensions */
    width: 300px; /* Increased from 250px */
    height: 330px; /* Increased from 275px to maintain aspect ratio */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.card p {
    font-weight: bold;
    text-align: center;
    padding: 5px;
    box-sizing: border-box;
    white-space: nowrap;
    position: absolute;
    opacity: 0;
    transform: translateY(-20px);
    transition: transform 0.5s ease-out, opacity 0.5s ease-out;
    color: #333;
}

#nextCardsBtn {
    background-color: #007bff;
    margin-top: 20px;
    display: block; /* Ensure it behaves as a block element */
    margin-left: auto; /* Center horizontally */
    margin-right: auto; /* Center horizontally */
    width: fit-content; /* Make the button only as wide as its content */
    /* Or a fixed width if you prefer, e.g., width: 200px; */
}

#nextCardsBtn:hover {
    background-color: #0056b3;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        width: 100%;
    }

    /* Stack columns vertically on smaller screens */
    .input-content {
        flex-direction: column;
        gap: 20px;
    }

    .times-tables-column,
    .options-column {
        flex: none;
        width: 100%;
        min-width: unset;
    }

    .checkbox-group, .radio-buttons {
        justify-content: center;
    }

    .card {
        min-width: 250px; /* Increased from 200px for mobile */
        max-width: 100%;
        aspect-ratio: 1 / 1.1;
        height: auto;
    }

    .card p {
        font-size: 16px; /* Still good for smaller screens */
    }

    #generateDeckBtn, #nextCardsBtn {
        padding: 10px 20px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8em;
    }
    .checkbox-group label, .radio-buttons label {
        font-size: 0.9em;
        padding: 6px 12px;
    }
}