/* Global Styles & Animated Background */
body {
    font-family: 'Inter', sans-serif;
    color: #fff;
    margin: 0;
    padding: 1rem;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #111827; /* Fallback for browsers that don't support the gradient */
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradient 12s ease infinite; /* Fast the animation */
    z-index: -1;
    filter: blur(60px);
    transform: scale(1.1);
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Card Styling */
.card {
    background-color: rgba(31, 41, 55, 0.5); /* Semi-transparent dark gray */
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1.5rem; /* 24px */
    padding: 2rem; /* 32px */
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    color: #f9fafb; /* Light gray text */
}

/* Change text colors within the card for better readability */
.card h1, .card h2, .card h3 {
    color: #fff;
}
.card p, .card label {
    color: #d1d5db; /* Lighter gray for paragraphs */
}

/* Button Styles */
#home-btn{
    color: #d1d5db;
}
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem; /* 12px */
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease-in-out;
    border: none;
    cursor: pointer;
    color: #d1d5db;
}

.btn-primary {
    background-color: #4f46e5; /* Indigo */
    color: white;
}
.btn-primary:hover {
    background-color: #4338ca;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Chapter Button Styles */
.chapter-btn {
    display: flex; /* Use flex to align checkmark and text */
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    font-weight: 600;
}
.chapter-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.chapter-btn.completed {
    background-color: rgba(16, 185, 129, 0.2); 
    border-color: rgba(16, 185, 129, 0.5);
    color: #6ee7b7; /* Brighter green text for high contrast */
}
.chapter-btn.completed:hover {
    background-color: rgba(16, 185, 129, 0.3);
    border-color: rgba(16, 185, 129, 0.7);
}

/* Quiz Option Styles (iOS List Style) */
.option-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: none; /* Remove individual borders */
    border-bottom: 1px solid rgba(255, 255, 255, 0.15); /* Separator line */
    transition: all 0.2s ease;
    font-weight: 600;
    border-radius: 0; /* Remove individual corner rounding */
}
.option-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

/* Add rounded corners to the first and last buttons in the list */
#options-container .option-btn:first-child {
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
}
#options-container .option-btn:last-child {
    border-bottom: none; /* Remove last separator line */
    border-bottom-left-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
}

.option-btn.correct {
    background-color: rgba(16, 185, 129, 0.3);
    border-color: rgba(16, 185, 129, 0.7);
    color: #fff;
}
.option-btn.incorrect {
    background-color: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.6);
    color: #fff;
}
.option-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Form Input Styles */
input[type="text"],
textarea {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    width: 100%;
}
input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.5);
}

/* Progress Bar */
#progress-bar {
    background-color: #4f46e5;
}
.w-full.bg-gray-200 {
    background-color: rgba(0, 0, 0, 0.3);
}

/* Code block styling */
pre {
    background-color: rgba(0, 0, 0, 0.5);
    padding: 1rem;
    border-radius: 0.5rem;
    color: #d1d5db;
}

/* Modal Styling */
#confirm-modal .card {
    background-color: #1f2937;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Misc Tweaks */
.hidden {
    display: none;
}

/* Custom Radio Button Styles */
input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 0;
    font: inherit;
    color: currentColor;
    width: 1.15em;
    height: 1.15em;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translateY(-0.075em);
    display: grid;
    place-content: center;
}

input[type="radio"]::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    border-radius: 50%;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em #4f46e5;
}

input[type="radio"]:checked::before {
    transform: scale(1);
}

input[type="radio"]:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* Modal Styling */
#confirm-modal {
    /* This blurs the main app content behind the overlay */
    backdrop-filter: blur(10px);
    /* This provides the dark overlay color, overriding Tailwind */
    background-color: rgba(17, 24, 39, 0.5);
}

#confirm-modal > div {
    /* Apply the main glassmorphism style to the modal card itself */
    /* This will override the bg-white class from the HTML */
    background-color: rgba(31, 41, 55, 0.7); /* Slightly more opaque for focus */
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1.5rem; /* 24px */
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Ensure text inside the modal is correctly colored */
#confirm-modal h3 {
    color: #fff;
}
#confirm-modal p {
    color: #d1d5db;
}

/* Add rounded corners to the first and last chapter buttons */
#chapter-list-container .chapter-btn:first-child {
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
}

#chapter-list-container .chapter-btn:last-child {
    border-bottom: none; /* Remove last separator line */
    border-bottom-left-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
}

/* Update chapter button to separate content */
.chapter-btn {
    display: flex;                  /* Turns the button into a flex container */
    justify-content: space-between; /* Pushes the two spans to opposite ends */
    align-items: center;            /* Vertically aligns them in the middle */
}

/* Add some subtle styling to the question count span */
.chapter-btn .text-sm {
    opacity: 0.7;
    font-weight: 500;
}

.p-3{
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.1);
}

.p-3:first-child {
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
}

.p-3:last-child {
    border-bottom-left-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
}