/**
 * Module Common Styles
 * Shared CSS for all module pages to ensure consistent behavior
 */

/* Prevent auto-scroll when accordion opens */
.accordion-item {
    scroll-margin-top: 100px; /* Account for fixed header */
}

/* Smooth accordion animations without triggering scroll */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    /* Remove any scroll-related animations */
    scroll-behavior: auto;
}

.accordion-item.active .accordion-content {
    max-height: none; /* Allow natural height expansion */
    /* Prevent scroll jumps during animation */
    overflow: visible;
}

/* Ensure accordion headers stay in viewport */
.accordion-header {
    scroll-margin-top: 120px;
    position: relative;
}

/* Module navigation styling */
.module-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--light-cream);
    flex-shrink: 0; /* Prevent navigation from being compressed */
}

.module-navigation .btn {
    white-space: nowrap; /* Prevent button text wrapping */
}

/* Smooth focus management */
.accordion-header:focus {
    outline: 2px solid var(--royal-gold);
    outline-offset: 2px;
}

/* Prevent layout shifts during accordion transitions */
.accordion {
    contain: layout;
}

.accordion-item {
    contain: layout style;
}

/* Ensure proper stacking context */
.content-wrapper {
    position: relative;
    z-index: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .module-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .module-navigation .btn {
        width: 100%;
        justify-content: center;
    }
}