/* Add some smooth transitions for a more professional feel */
body, .bg-gray-100, .bg-gray-800, .bg-white, .bg-gray-700, .bg-gray-200, button, input, span, div {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
}

/* Style for the details/summary accordion to prevent default marker */
details > summary {
    list-style: none;
}
details > summary::-webkit-details-marker {
    display: none;
}

/* --- AI Import Modal Styles --- */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-panel {
    background-color: white;
    border-radius: 0.75rem;
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-panel {
    transform: scale(1);
}

.dark .modal-panel {
    background-color: #1f2937; /* dark:bg-gray-800 */
}

/* Custom styles for the file input */
#ai-image-input::file-selector-button {
    background-color: #4f46e5; /* bg-indigo-600 */
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

#ai-image-input::file-selector-button:hover {
    background-color: #4338ca; /* hover:bg-indigo-700 */
}

/* --- Quill Dark Mode Overrides --- */
.dark .ql-editor {
    color: #e5e7eb; /* gray-200 */
}

.dark .ql-snow .ql-stroke {
    stroke: #d1d5db; /* gray-300 */
}

.dark .ql-snow .ql-picker-label {
    color: #d1d5db; /* gray-300 */
}

.dark .ql-snow .ql-picker-options {
    background-color: #374151; /* gray-700 */
}

/* --- Quill General Styles --- */
#notes-editor-toolbar {
    border-top-left-radius: 0.375rem; /* rounded-md */
    border-top-right-radius: 0.375rem; /* rounded-md */
}

#notes-editor {
    border-bottom-left-radius: 0.375rem; /* rounded-md */
    border-bottom-right-radius: 0.375rem; /* rounded-md */
}

.ql-snow {
    border-radius: 0.375rem; /* rounded-md */
}

/* Remove the default top border from the editor itself, as the toolbar provides it */
.ql-toolbar {
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
}
.ql-container {
    border-bottom-left-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

/* --- Animation Enhancements --- */

/*
  We are using a combination of CSS transitions and keyframe animations
  to make the UI feel more alive and responsive.
*/

/*
  1. Base transitions for elements that will be animated on state change (e.g., hover, check).
     This provides a fallback for simple state changes.
*/
.exam-card-display, .task-container, details > summary {
    transition: all 0.3s ease-in-out;
}

/*
  2. Keyframe animations for enter/exit effects.
     These are more complex than simple transitions and are triggered by adding/removing classes.
*/
@keyframes slide-in-fade {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fade-out-shrink {
    from {
        opacity: 1;
        transform: scale(1);
        max-height: 200px; /* Approximate height */
    }
    to {
        opacity: 0;
        transform: scale(0.95);
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-top: 0;
        margin-bottom: 0;
        border-width: 0;
    }
}

/*
  3. Helper classes to trigger these animations with JavaScript.
*/
.animate-enter {
    animation: slide-in-fade 0.4s ease-out forwards;
}

.animate-exit {
    animation: fade-out-shrink 0.3s ease-out forwards;
    overflow: hidden;
}


/*
  4. Specific styling for task completion for a satisfying check-off effect.
*/
.task-container .task-text {
    transition: all 0.3s ease;
}

.task-container input:checked + .task-text {
    /* TailwindCSS: text-gray-500 */
    color: #6b7280;
    /* TailwindCSS: line-through */
    text-decoration: line-through;
    /* Give it a slight shrink to make it feel "done" */
    transform: scale(0.98);
}

.dark .task-container input:checked + .task-text {
    /* TailwindCSS: dark:text-gray-500 */
    color: #6b7280;
}

/*
  5. Smooth open/close for the details element (learning goals).
     This animates the content inside the accordion as it appears.
*/
details[open] > summary ~ * {
    animation: slide-in-fade 0.4s ease-out;
}
