/* ============================================
   Module Header Enhancements - BioRemPP v1.0
   ============================================
   

   - Color coding system
   - Hover effects
   - Smooth animations
   - Improved typography
   - Responsive design
   ============================================ */

/* ========================================
   1. Module Header Card Styling
   ======================================== */

.module-header-card {
    transition: box-shadow 0.3s ease, transform 0.2s ease;
    border-radius: 0.5rem;
}

.module-header-card:hover {
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.12) !important;
    transform: translateY(-2px);
}

/* Module header with color-coded top border */
.module-header-card.border-top {
    border-top-width: 4px !important;
}

/* ========================================
   2. Collapsible Button Styling
   ======================================== */

.module-header-card .btn-link {
    font-size: 1rem;
    font-weight: 500;
    color: #495057;
    transition: color 0.2s ease;
}

.module-header-card .btn-link:hover {
    color: #007bff;
    text-decoration: none;
}

.module-header-card .btn-link:focus {
    box-shadow: none;
    outline: none;
}

/* Chevron icon rotation animation */
.module-header-card .fa-chevron-down {
    transition: transform 0.3s ease;
}

.module-header-card .btn-link[aria-expanded="false"] .fa-chevron-down {
    transform: rotate(-90deg);
}

/* ========================================
   3. Badge Styling
   ======================================== */

.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 0.375rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.badge:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Module number badge */
.badge.bg-primary,
.badge.bg-success,
.badge.bg-info,
.badge.bg-warning,
.badge.bg-danger,
.badge.bg-secondary {
    animation: fadeInBadge 0.5s ease-in;
}

@keyframes fadeInBadge {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   4. Accordion Styling
   ======================================== */

.accordion-button {
    font-weight: 500;
    padding: 1rem 1.25rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.accordion-button:not(.collapsed) {
    background-color: rgba(0, 123, 255, 0.08);
    color: #0056b3;
    box-shadow: none;
}

.accordion-button:focus {
    box-shadow: none;
    border-color: rgba(0, 0, 0, 0.125);
}

.accordion-button:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

/* Accordion item border */
.accordion-item {
    border: 1px solid rgba(0, 0, 0, 0.125);
    margin-bottom: 0.5rem;
    border-radius: 0.375rem !important;
    overflow: visible;
    transition: box-shadow 0.2s ease;
}

.accordion-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ========================================
   4.1. Dropdown Fix: Prevent Clipping
   ======================================== */

/* IMPORTANT: Ensure accordion body doesn't clip dropdowns.
   The 'overflow: visible' property allows dropdown menus to extend
   beyond their container boundaries, preventing them from being cut off.
   This fix addresses the issue where dropdown menus were hidden due to
   'overflow: hidden' on parent containers. */

.accordion-body {
    overflow: visible !important;
}

/* ========================================
   4.2. Dropdown Menu Positioning
   ======================================== */

/* Ensure dropdown menus appear above other content with proper z-index.
   This prevents dropdowns from appearing behind other UI elements. */

.Select-menu-outer,
.Select-menu {
    z-index: 1050 !important;
}

/* ========================================
   4.3. Dash Dropdown Specific Fixes
   ======================================== */

/* Ensure dropdown menus have adequate max-height for scrolling */
.Select-menu-outer {
    max-height: 300px !important;
}

/* ========================================
   4.4. Flush Accordion (no borders)
   ======================================== */

.accordion-flush .accordion-item {
    border-left: 0;
    border-right: 0;
    border-radius: 0 !important;
}

.accordion-flush .accordion-item:first-child {
    border-top: 0;
}

.accordion-flush .accordion-item:last-child {
    border-bottom: 0;
}

/* ========================================
   5. Icon Styling
   ======================================== */

.fas,
.far,
.fab {
    transition: transform 0.2s ease, color 0.2s ease;
}

/* Icon hover effect */
.card-header .fas:hover,
.card-header .far:hover {
    transform: scale(1.1);
}

/* Color-specific icon styling */
.text-primary {
    color: #007bff !important;
}

.text-success {
    color: #28a745 !important;
}

.text-info {
    color: #17a2b8 !important;
}

.text-warning {
    color: #ffc107 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-secondary {
    color: #6c757d !important;
}

/* ========================================
   6. Typography Improvements
   ======================================== */

.module-overview-header h4 {
    font-weight: 600;
    line-height: 1.4;
    color: #212529;
}

.module-overview-header .text-muted {
    color: #6c757d !important;
    line-height: 1.6;
}

.module-overview-header .small {
    font-size: 0.925rem;
    line-height: 1.6;
}

/* Card header typography */
.card-header {
    font-weight: 500;
    padding: 0.75rem 1.25rem;
}

/* ========================================
   7. Responsive Design
   ======================================== */

/* Mobile devices (< 768px) */
@media (max-width: 767.98px) {
    .module-header-card h4 {
        font-size: 1.25rem;
        line-height: 1.3;
    }

    .module-header-card .badge {
        font-size: 0.75rem;
        padding: 0.25em 0.5em;
    }

    .accordion-button {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    .card-header {
        padding: 0.625rem 1rem;
        font-size: 0.95rem;
    }

    /* Stack badges vertically on mobile */
    .module-header-card .badge.ms-2 {
        margin-left: 0 !important;
        margin-top: 0.5rem;
        display: block;
        width: fit-content;
    }
}

/* Tablet devices (768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .module-header-card h4 {
        font-size: 1.5rem;
    }

    .accordion-button {
        font-size: 0.975rem;
    }
}

/* Desktop devices (≥ 992px) */
@media (min-width: 992px) {
    .module-header-card h4 {
        font-size: 1.75rem;
    }
}

/* ========================================
   8. Smooth Transitions
   ======================================== */

.collapse {
    transition: height 0.35s ease;
}

.collapsing {
    transition: height 0.35s ease;
}

/* ========================================
   9. Card Shadow Variations
   ======================================== */

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.shadow {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* ========================================
   10. Accessibility Improvements
   ======================================== */

/* Focus states */
.btn-link:focus,
.accordion-button:focus,
.badge:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .module-header-card {
        border: 2px solid currentColor;
    }

    .accordion-item {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   11. Print Styles
   ======================================== */

@media print {
    .module-header-card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }

    .accordion-button {
        display: none;
    }

    .collapse {
        display: block !important;
        height: auto !important;
    }

    .badge {
        border: 1px solid currentColor;
    }
}