/* General Body and Container Styling */
body {
    font-family: 'Tajawal', sans-serif;
    background-color: #f0f2f5; /* Soft background color */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top for better content flow */
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

.icshd-math-wrapper {
    max-width: 600px;
    width: 100%;
    margin: 20px auto; /* Center with vertical margin */
}

.icshd-math-container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); /* Enhanced shadow */
    display: flex;
    flex-direction: column;
    gap: 15px; /* Spacing between elements */
}

/* Welcome Screen Styling */
.welcome-screen {
    text-align: center;
    padding: 40px;
    background-color: #f8f9fa;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.welcome-title {
    color: #007bff;
    margin-bottom: 20px;
    font-size: 2em;
}

.welcome-text {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* Question Display */
.question-display {
    font-size: 1.8em;
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
    color: #333;
    padding: 15px;
    background-color: #e9f7ff; /* Light blue background for question */
    border-radius: 10px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

/* Countdown Timer */
.countdown-timer {
    font-size: 1.4em; /* Larger font for timer */
    margin-bottom: 20px; /* More space below timer */
    text-align: center;
    font-weight: bold;
    color: #d9534f; /* Red color for urgency */
    padding: 10px;
    background-color: #ffebeb; /* Light red background */
    border-radius: 8px;
    border: 1px solid #d9534f;
}


/* Section Labels */
.section-label {
    font-weight: bold;
    color: #4a4a4a;
    margin-bottom: 5px;
    display: block; /* Ensure it takes full width */
    font-size: 1.1em;
}

/* Button Group Styling */
.button-group {
    display: flex;
    flex-wrap: wrap; /* Allow buttons to wrap to next line */
    gap: 10px; /* Space between buttons */
    margin-bottom: 15px;
}

.math-button {
    background-color: #e0e0e0; /* Light grey for inactive buttons */
    color: #333;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s ease; /* Smooth transitions */
    flex-grow: 1; /* Allow buttons to grow and fill space */
    min-width: 120px; /* Minimum width for buttons */
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Subtle shadow */
}

.math-button:hover {
    background-color: #d0d0d0; /* Slightly darker on hover */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.math-button.active {
    background-color: #007bff; /* Primary blue for active button */
    color: white;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3); /* Blue shadow for active */
    transform: translateY(-2px); /* Slight lift effect */
}

/* Styled Input Fields */
.styled-input {
    padding: 12px;
    margin: 5px 0;
    border-radius: 8px;
    border: 1px solid #ccc;
    width: calc(100% - 24px); /* Account for padding */
    font-size: 1em;
    box-sizing: border-box; /* Include padding and border in element's total width and height */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.styled-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    outline: none;
}

/* Action Buttons (Next, Finish Training, Restart) */
.action-button {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    margin-top: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.action-button.large-button { /* For the initial "Start Training" button */
    font-size: 1.2em;
    padding: 15px 30px;
}

.primary-button {
    background-color: #28a745; /* Green for "Next" */
    color: white;
}

.primary-button:hover {
    background-color: #218838; /* Darker green on hover */
    box-shadow: 0 6px 15px rgba(40, 167, 69, 0.3);
}

.secondary-button {
    background-color: #007bff; /* Blue for "Finish Training" */
    color: white;
    margin-left: 10px; /* Space from primary button */
}

.secondary-button:hover {
    background-color: #0056b3; /* Darker blue on hover */
    box-shadow: 0 6px 15px rgba(0, 123, 255, 0.3);
}

.tertiary-button {
    background-color: #6c757d; /* Grey for "Restart Training" */
    color: white;
    margin-top: 20px; /* Space from summary text */
}

.tertiary-button:hover {
    background-color: #5a6268; /* Darker grey on hover */
    box-shadow: 0 6px 15px rgba(108, 117, 125, 0.3);
}

/* Summary Section Styling */
.summary-section {
    margin-top: 20px;
    padding: 25px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    background-color: #e9f7ff; /* Light blue background for summary */
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.summary-title {
    color: #0056b3; /* Darker blue for title */
    font-size: 1.6em;
    margin-bottom: 15px;
}

.summary-text {
    font-size: 1.3em;
    color: #333;
    line-height: 1.6;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .icshd-math-container {
        padding: 20px;
        margin: 10px auto;
    }

    .math-button, .action-button {
        font-size: 0.9em;
        padding: 10px 15px;
        min-width: unset; /* Remove min-width on smaller screens */
        flex-basis: auto; /* Allow flexible sizing */
    }

    .button-group {
        flex-direction: row; /* Keep row direction */
        justify-content: center; /* Center buttons */
    }

    .action-button {
        width: 100%; /* Full width for action buttons */
        margin-left: 0; /* Remove left margin for stacking */
        margin-top: 10px; /* Add top margin for spacing */
    }
}
