/*
 Theme Name:     MasterStudy Child Theme - Modernized & Collapsible
 Theme URI:      http://example.com/masterstudy-child/
 Description:    Modernized styles for study notes with collapsible sections.
 Author:         Roman Pathak (Updated by AI)
 Author URI:     http://example.com
 Template:       masterstudy
 Version:        1.3.0
 License:        GNU General Public License v2 or later
 License URI:    http://www.gnu.org/licenses/gpl-2.0.html
 Tags:           lms, education, masterstudy
 Text Domain:    masterstudy-child
*/

/* --- Import Inter font --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- Base Styling --- */
/* Apply styles directly to .custom-lesson-notes and potentially scoped versions if needed */

/* --- Main Notes Container --- */
body .stm-lms-course__content .custom-lesson-notes,
body #stm-lms-lessons .custom-lesson-notes,
body .stm_lms_lesson_content .custom-lesson-notes,
.custom-lesson-notes {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !important;
    line-height: 1.75 !important; /* Slightly increased line height */
    color: #495057 !important; /* Darker gray for better contrast */
    padding: 30px !important; /* Increased padding */
    margin-top: 30px !important;
    margin-bottom: 30px !important;
    background-color: #ffffff !important; /* White background */
    border-radius: 12px !important; /* Slightly larger radius */
    /* Softer, layered shadow */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06) !important;
    max-width: 100% !important; /* Let containing element control max-width if needed */
    margin-left: auto;
    margin-right: auto;
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    border: 1px solid #e9ecef; /* Subtle border */
}

/* Limit width on larger screens - Adjust selector if needed for theme integration */
@media (min-width: 992px) {
     .custom-lesson-notes {
        /* Consider if your theme already limits width; adjust if necessary */
        max-width: 960px !important;
        padding: 40px !important; /* More padding on larger screens */
     }
}

/* --- Headings --- */
.custom-lesson-notes h1,
.custom-lesson-notes h2,
.custom-lesson-notes h3,
.custom-lesson-notes h4,
.custom-lesson-notes h5,
.custom-lesson-notes h6 {
    font-weight: 700 !important;
    margin-top: 2.2em !important; /* Consistent top margin */
    margin-bottom: 1.1em !important; /* Consistent bottom margin */
    line-height: 1.4 !important; /* Adjusted line height */
    color: #343a40 !important; /* Darker heading color */
    font-family: 'Inter', sans-serif !important;
}

.custom-lesson-notes h1 {
    font-size: 2.3em !important; /* Slightly adjusted size */
    color: #27496d !important; /* Deeper blue */
    text-align: center !important;
    padding-bottom: 15px !important;
    /* More subtle border */
    border-bottom: 3px solid #a5d8ff !important;
    margin-bottom: 1.8em !important;
    margin-top: 1em !important; /* Less margin top for H1 */
}

.custom-lesson-notes h2 {
    font-size: 1.7em !important; /* Adjusted size */
    color: #145da0 !important; /* Refined blue */
    padding-bottom: 8px !important;
    /* Lighter border */
    border-bottom: 1px solid #dee2e6 !important;
    margin-top: 2.8em !important;
    margin-bottom: 0 !important; /* Remove bottom margin as content is now wrapped */
    position: relative; /* For icon positioning */
    padding-right: 30px; /* Make space for icon */
}

/* --- Collapsible Section Trigger (H2) --- */
.custom-lesson-notes h2.collapsible-trigger {
    cursor: pointer;
    transition: color 0.2s ease;
}
.custom-lesson-notes h2.collapsible-trigger:hover {
    color: #0b5ed7 !important; /* Slightly brighter blue on hover */
}

/* --- Toggle Icon --- */
.custom-lesson-notes .toggle-icon {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em; /* Adjust icon size */
    font-weight: bold;
    color: #adb5bd; /* Icon color */
    transition: transform 0.3s ease-out, color 0.2s ease;
    padding: 5px; /* Add padding for easier clicking if needed */
    line-height: 1;
    /* Ensure icon is not selectable text */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
.custom-lesson-notes h2.collapsible-trigger:hover .toggle-icon {
    color: #0b5ed7; /* Match hover color */
}
/* If using JS to change icon text, this rotation isn't strictly needed */
/* If using CSS only for icon change (e.g. background image), use this */
.custom-lesson-notes h2.collapsible-trigger.active .toggle-icon {
     /* Example rotation if using '+' and CSS transform for 'x' effect */
     /* transform: translateY(-50%) rotate(45deg); */
}

/* --- Collapsible Content --- */
.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, margin-top 0.4s ease-out; /* Smooth transition */
    margin-top: 0; /* No margin when collapsed */
    /* Optional visual indicators */
    /* border-left: 3px solid transparent; */
    /* padding-left: 15px; */
}

.collapsible-content.active {
    /* max-height will be set by JS to allow animation */
    margin-top: 1.5em; /* Add space between header and content when open */
    /* border-left-color: #a5d8ff; */ /* Optional: show indicator when open */
}
/* Reset top margin for first element inside active content */
.collapsible-content.active > *:first-child {
    margin-top: 0 !important;
}


.custom-lesson-notes h3 {
    font-size: 1.35em !important;
    color: #0c70a0 !important;
    font-weight: 600 !important;
    margin-top: 2em !important; /* Keep margin for subheadings */
}

.custom-lesson-notes h4 {
    font-size: 1.15em !important;
    color: #1e88e5 !important;
    font-weight: 600 !important;
}

.custom-lesson-notes h5 {
    font-size: 1.05em !important;
    color: #495057 !important;
    font-weight: 600 !important;
}

.custom-lesson-notes h6 {
    font-size: 1em !important;
    color: #6c757d !important;
    font-style: italic !important;
    font-weight: 500 !important;
}

/* --- Text Elements --- */
.custom-lesson-notes p,
.custom-lesson-notes li {
    font-size: 1em !important; /* Standardized base font size */
    color: #495057 !important;
    margin-bottom: 1.2em !important; /* Slightly more space after paragraphs */
    font-family: 'Inter', sans-serif !important;
}
 /* Reduce margin for list items */
 .custom-lesson-notes li {
     margin-bottom: 0.6em !important;
 }

.custom-lesson-notes strong {
    font-weight: 600 !important; /* Slightly less bold */
    color: #343a40 !important;
}

.custom-lesson-notes em {
    font-style: italic !important;
    color: #5a6268 !important; /* Slightly muted italic */
}

/* --- Links --- */
.custom-lesson-notes a {
    color: #1a73e8 !important; /* Google blue */
    text-decoration: none !important;
    border-bottom: 1px solid #8ab4f8 !important; /* Lighter underline */
    transition: color 0.2s ease, border-color 0.2s ease !important;
}

.custom-lesson-notes a:hover {
    color: #174ea6 !important; /* Darker Google blue */
    border-bottom-color: #174ea6 !important;
}

/* --- Join Button --- */
.custom-lesson-notes .join-button {
    display: inline-block !important;
    background-color: #1a73e8 !important;
    color: white !important;
    padding: 10px 22px !important; /* Adjusted padding */
    border-radius: 6px !important; /* Slightly rounded */
    text-decoration: none !important;
    border-bottom: none !important; /* Remove underline from button */
    transition: background-color 0.2s ease, box-shadow 0.2s ease !important;
    font-weight: 500 !important;
    margin-top: 10px !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.custom-lesson-notes .join-button:hover {
    background-color: #174ea6 !important;
    color: white !important; /* Ensure text color stays white on hover */
    border-bottom: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* --- Lists --- */
.custom-lesson-notes ul,
.custom-lesson-notes ol {
    margin-bottom: 1.5em !important;
    padding-left: 25px !important; /* Slightly reduced indent */
    list-style-position: outside !important;
}

.custom-lesson-notes ul ul,
.custom-lesson-notes ol ol,
.custom-lesson-notes ul ol,
.custom-lesson-notes ol ul {
    margin-top: 0.5em !important;
    margin-bottom: 1em !important;
    padding-left: 30px !important; /* Adjusted nested indent */
}

/* List markers */
.custom-lesson-notes ul li::marker { color: #adb5bd; }
.custom-lesson-notes ol li::marker { color: #495057; font-weight: 500; }
.custom-lesson-notes ul ul li::marker { color: #ced4da; }
.custom-lesson-notes ol ol li::marker { color: #6c757d; }

/* --- Tables --- */
.custom-lesson-notes table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    margin: 35px 0 !important; /* Increased margin */
    border: 1px solid #dee2e6 !important; /* Lighter border */
    border-radius: 8px !important; /* Consistent radius */
    overflow: hidden !important; /* Needed for border-radius on table */
    box-shadow: 0 2px 4px rgba(0,0,0,0.04) !important; /* Softer shadow */
}

.custom-lesson-notes table thead {
    background-color: #f8f9fa !important; /* Light gray header */
    color: #495057 !important; /* Dark text for header */
}

.custom-lesson-notes table th {
    text-align: left !important;
    padding: 14px 18px !important; /* Adjusted padding */
    font-weight: 600 !important;
    border-bottom: 2px solid #dee2e6 !important; /* Header bottom border */
    font-family: 'Inter', sans-serif !important;
    color: #343a40 !important; /* Ensure header text color */
    text-transform: capitalize; /* Capitalize headers */
}

.custom-lesson-notes table td {
    text-align: left !important;
    padding: 14px 18px !important; /* Match header padding */
    border-bottom: 1px solid #e9ecef !important; /* Lighter row separator */
    transition: background-color 0.2s ease !important;
    vertical-align: top;
}

 /* Lists inside table cells */
 .custom-lesson-notes table td ul,
 .custom-lesson-notes table td ol {
    margin-top: 0.4em !important;
    margin-bottom: 0.4em !important;
    padding-left: 18px !important;
 }
 .custom-lesson-notes table td li {
    margin-bottom: 0.3em !important;
    font-size: 0.95em !important; /* Slightly smaller list text in tables */
 }

.custom-lesson-notes table tr:last-child td {
    border-bottom: none !important;
}

.custom-lesson-notes table tr:nth-child(even) {
    background-color: transparent !important; /* Remove zebra striping */
}

.custom-lesson-notes table tr:hover td {
    background-color: #f1f3f5 !important; /* Subtle hover */
}

/* Responsive table */
@media (max-width: 768px) {
    .custom-lesson-notes table {
        box-shadow: none !important;
        border: none !important;
    }
     .custom-lesson-notes table thead { display: none !important; }
     .custom-lesson-notes table tbody,
     .custom-lesson-notes table tr,
     .custom-lesson-notes table td { display: block !important; }

     .custom-lesson-notes table tr {
         border: 1px solid #dee2e6 !important;
         border-radius: 8px !important;
         margin-bottom: 18px !important;
         box-shadow: 0 2px 4px rgba(0,0,0,0.04) !important;
     }
     .custom-lesson-notes table td {
         text-align: right !important;
         padding-left: 45% !important; /* Adjust space for label */
         position: relative;
         border-bottom: 1px solid #e9ecef !important;
         white-space: normal !important;
         min-height: 30px; /* Ensure cell has some height */
     }
      .custom-lesson-notes table td:first-child {
         border-top-left-radius: 7px; /* Match parent radius */
         border-top-right-radius: 7px;
      }
     .custom-lesson-notes table td:last-child {
         border-bottom: none !important;
         border-bottom-left-radius: 7px; /* Match parent radius */
         border-bottom-right-radius: 7px;
     }
     /* Style for the data-label pseudo-element */
     .custom-lesson-notes table td::before {
         content: attr(data-label); /* Use data-label attribute content */
         position: absolute;
         left: 18px; /* Match td padding */
         width: calc(45% - 28px); /* Adjust label width */
         padding-right: 10px;
         font-weight: 600;
         text-align: left !important;
         font-family: 'Inter', sans-serif !important;
         color: #343a40;
         font-size: 0.9em; /* Smaller label */
         text-transform: capitalize;
     }
}

/* --- Text Boxes (Info, Red Flags, Key Takeaways, etc.) --- */
.custom-lesson-notes .text-box,
.custom-lesson-notes .red-flags,
.custom-lesson-notes .key-takeaways,
.custom-lesson-notes .join-community,
.custom-lesson-notes .clinical-case {
    padding: 20px 25px 20px 60px !important; /* Adjusted padding */
    margin: 35px 0 !important; /* Keep consistent margin */
    border-radius: 8px !important; /* Consistent radius */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important; /* Subtle shadow */
    position: relative !important;
    border-width: 1px !important; /* Use border instead of just left */
    border-style: solid !important;
}

/* Icons for boxes */
.custom-lesson-notes .text-box::before,
.custom-lesson-notes .red-flags::before,
.custom-lesson-notes .key-takeaways::before,
.custom-lesson-notes .join-community::before,
.custom-lesson-notes .clinical-case::before {
    content: "" !important;
    position: absolute !important;
    left: 20px !important; /* Position icon */
    top: 20px !important; /* Align icon with first line of heading */
    width: 22px !important; /* Icon size */
    height: 22px !important;
    background-repeat: no-repeat !important;
    background-position: center center !important;
    background-size: contain !important;
    opacity: 0.9;
}

/* Info Box */
.custom-lesson-notes .text-box {
    border-color: #a5d8ff !important; /* Light blue border */
    background-color: #f0f8ff !important; /* Very light blue background */
}
.custom-lesson-notes .text-box::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%231971c2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E") !important; /* Refined blue icon */
}

/* Red Flags Box */
.custom-lesson-notes .red-flags {
    border-color: #ffc9c9 !important; /* Light red border */
    background-color: #fff5f5 !important; /* Very light red background */
}
.custom-lesson-notes .red-flags::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23c92a2a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E") !important; /* Refined red icon */
}

/* Key Takeaways Box */
.custom-lesson-notes .key-takeaways {
    border-color: #96f2d7 !important; /* Light green border */
    background-color: #e6fcf5 !important; /* Very light green background */
}
.custom-lesson-notes .key-takeaways::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23087f5b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E") !important; /* Refined green icon */
}

/* Join Community Box */
.custom-lesson-notes .join-community {
     border-color: #a5d8ff !important; /* Match info box */
     background-color: #f0f8ff !important;
}
.custom-lesson-notes .join-community::before {
     background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%231971c2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E") !important; /* Refined blue icon */
}

/* Clinical Case Box */
.custom-lesson-notes .clinical-case {
    border-color: #d0bfff !important; /* Light purple border */
    background-color: #f3f0ff !important; /* Very light purple background */
}
.custom-lesson-notes .clinical-case::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%237048e8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'/%3E%3Crect width='8' height='4' x='8' y='2' rx='1' ry='1'/%3E%3Cpath d='M12 11h4'/%3E%3Cpath d='M12 16h4'/%3E%3Cpath d='M8 11h.01'/%3E%3Cpath d='M8 16h.01'/%3E%3C/svg%3E") !important; /* Refined purple icon */
}

/* Headings inside boxes */
.custom-lesson-notes .text-box h3, .custom-lesson-notes .red-flags h3, .custom-lesson-notes .key-takeaways h3, .custom-lesson-notes .join-community h3, .custom-lesson-notes .clinical-case h3 {
    border-bottom: none !important;
    margin-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 15px !important; /* Space below heading */
    font-size: 1.2em !important; /* Slightly smaller box heading */
    font-weight: 600 !important;
    font-family: 'Inter', sans-serif !important;
}

/* Match heading color to box theme */
.custom-lesson-notes .text-box h3 { color: #1971c2 !important; }
.custom-lesson-notes .red-flags h3 { color: #c92a2a !important; }
.custom-lesson-notes .key-takeaways h3 { color: #087f5b !important; }
.custom-lesson-notes .join-community h3 { color: #1971c2 !important; }
.custom-lesson-notes .clinical-case h3 { color: #7048e8 !important; }

/* Lists inside boxes */
.custom-lesson-notes .text-box ul, .custom-lesson-notes .text-box ol,
.custom-lesson-notes .red-flags ul, .custom-lesson-notes .red-flags ol,
.custom-lesson-notes .key-takeaways ul, .custom-lesson-notes .key-takeaways ol,
.custom-lesson-notes .join-community ul, .custom-lesson-notes .join-community ol,
.custom-lesson-notes .clinical-case ul, .custom-lesson-notes .clinical-case ol {
    margin-bottom: 0 !important;
    padding-left: 18px !important; /* Less indent inside boxes */
}
.custom-lesson-notes .text-box li,
.custom-lesson-notes .red-flags li,
.custom-lesson-notes .key-takeaways li,
.custom-lesson-notes .join-community li,
.custom-lesson-notes .clinical-case li {
    margin-bottom: 0.6em !important; /* Space between list items */
    font-size: 0.98em; /* Slightly smaller text in boxes */
}

/* Remove bottom margin from last element inside boxes */
.custom-lesson-notes .text-box > *:last-child,
.custom-lesson-notes .red-flags > *:last-child,
.custom-lesson-notes .key-takeaways > *:last-child,
.custom-lesson-notes .join-community > *:last-child,
.custom-lesson-notes .clinical-case > *:last-child {
    margin-bottom: 0 !important;
}

/* --- Code Blocks --- */
.custom-lesson-notes code { /* Inline code */
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace !important;
    background-color: #f1f3f5 !important; /* Lighter gray */
    border: 1px solid #e9ecef !important;
    border-radius: 4px !important;
    padding: 2px 6px !important; /* Adjusted padding */
    font-size: 0.9em !important;
    color: #d6336c !important; /* Pinkish color for code */
}

.custom-lesson-notes pre { /* Code block */
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace !important;
    background-color: #f8f9fa !important; /* Slightly different background for block */
    border: 1px solid #e9ecef !important;
    border-radius: 6px !important;
    padding: 16px !important;
    margin: 25px 0 !important;
    overflow-x: auto !important;
    line-height: 1.6 !important;
    font-size: 0.9em !important;
}

.custom-lesson-notes pre code {
    padding: 0 !important;
    border: none !important;
    background-color: transparent !important;
    color: #495057 !important; /* Standard text color inside pre */
    font-size: 1em !important; /* Inherit pre font size */
}

/* --- Blockquotes --- */
.custom-lesson-notes blockquote {
    border-left: 4px solid #1a73e8 !important; /* Thinner, different color border */
    padding: 15px 25px !important; /* Adjusted padding */
    margin: 30px 0 !important;
    background-color: #f1f3f5 !important; /* Light gray background */
    color: #495057 !important;
    font-style: normal !important; /* Remove default italic */
    border-radius: 0 6px 6px 0 !important;
}
 .custom-lesson-notes blockquote p {
     font-size: 1.05em !important;
     font-style: italic; /* Italicize the paragraph inside */
     color: #5a6268;
 }
.custom-lesson-notes blockquote p:last-child {
    margin-bottom: 0 !important;
}

/* --- Definition Lists (If Used) --- */
.custom-lesson-notes dl {
    margin: 20px 0 !important;
}
.custom-lesson-notes dt {
    font-weight: 700 !important;
    color: #343a40 !important;
    margin-top: 15px !important;
}
.custom-lesson-notes dd {
    margin-left: 25px !important;
    margin-bottom: 10px !important;
}


/* --- Evidence Level Styling --- */
.custom-lesson-notes .evidence-level {
    display: inline-block !important;
    padding: 2px 7px !important; /* Adjusted padding */
    border-radius: 12px !important; /* Pill shape */
    font-weight: 600 !important;
    font-size: 0.75em !important; /* Smaller text */
    margin-left: 6px !important;
    vertical-align: middle !important;
    color: white !important;
    line-height: 1.4; /* Adjust line height */
    text-transform: uppercase; /* Uppercase text */
    letter-spacing: 0.5px; /* Add letter spacing */
}

.custom-lesson-notes .evidence-a { background-color: #2f9e44 !important; } /* Darker Green */
.custom-lesson-notes .evidence-b { background-color: #f08c00 !important; } /* Darker Orange */
.custom-lesson-notes .evidence-c { background-color: #d9480f !important; } /* Darker Red */

/* --- Images and Figures --- */
.custom-lesson-notes img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 8px !important; /* Consistent radius */
    margin: 25px 0 !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.07) !important; /* Slightly stronger shadow for images */
    border: 1px solid #e9ecef; /* Subtle border */
}
.custom-lesson-notes figure { margin: 30px 0 !important; text-align: center !important; }
.custom-lesson-notes figcaption {
    font-style: normal !important; /* Remove italic */
    color: #6c757d !important; /* Gray caption */
    font-size: 0.9em !important;
    margin-top: 10px !important;
}

/* --- Dividers --- */
.custom-lesson-notes hr {
    border: none !important;
    height: 1px !important; /* Thinner divider */
    background-color: #dee2e6 !important; /* Lighter gray */
    margin: 40px 0 !important; /* More space around divider */
}

/* --- Reference Section --- */
.custom-lesson-notes .reference-section {
     margin-top: 3em !important;
     padding-top: 1.5em !important;
     border-top: 1px solid #dee2e6 !important;
}
.custom-lesson-notes .reference-list li {
     margin-bottom: 0.8em !important;
     font-size: 0.9em !important; /* Smaller font for references */
     color: #6c757d;
}
 .custom-lesson-notes .reference-list li::marker {
     color: #adb5bd;
     font-size: 0.9em;
 }

/* --- Print Styles --- */
@media print {
    /* Simplified print styles */
    body { font-size: 10pt !important; background-color: #fff !important; }
    .custom-lesson-notes { font-size: 10pt !important; color: #000 !important; background-color: #fff !important; padding: 0 !important; box-shadow: none !important; border: none !important; max-width: 100% !important; margin: 0 !important; }
    .collapsible-content { max-height: none !important; overflow: visible !important; margin-top: 1em !important; } /* Ensure content is visible */
    .toggle-icon { display: none !important; } /* Hide toggle icon */
    .custom-lesson-notes h2 { padding-right: 0 !important; } /* Remove padding for icon */
    .custom-lesson-notes .text-box, .custom-lesson-notes .red-flags, .custom-lesson-notes .key-takeaways, .custom-lesson-notes .clinical-case, .custom-lesson-notes .join-community { border: 1px solid #bbb !important; border-left-width: 4px !important; box-shadow: none !important; page-break-inside: avoid !important; background-color: #f5f5f5 !important; padding: 10px 10px 10px 25px !important; }
    .custom-lesson-notes .text-box::before, .custom-lesson-notes .red-flags::before, .custom-lesson-notes .key-takeaways::before, .custom-lesson-notes .clinical-case::before, .custom-lesson-notes .join-community::before { display: none !important; }
    .custom-lesson-notes table { border-collapse: collapse !important; box-shadow: none !important; border: 1px solid #bbb !important; font-size: 8pt !important; page-break-inside: avoid !important; }
    .custom-lesson-notes th, .custom-lesson-notes td { border: 1px solid #bbb !important; padding: 4px 6px !important; }
    .custom-lesson-notes th { background-color: #eee !important; color: #000 !important; }
    .custom-lesson-notes tr:nth-child(even) { background-color: #fff !important; }
    .custom-lesson-notes a { color: #000 !important; text-decoration: underline !important; border-bottom: none !important; }
    .custom-lesson-notes a[href^="http"]:after { content: " (" attr(href) ")"; font-size: 90%; }
    .custom-lesson-notes a[href^="#"]:after { content: ""; }
    .custom-lesson-notes .join-button { display: none !important; }
    .custom-lesson-notes h1, .custom-lesson-notes h2, .custom-lesson-notes h3, .custom-lesson-notes h4, .custom-lesson-notes h5, .custom-lesson-notes h6 { color: #000 !important; page-break-after: avoid !important; page-break-inside: avoid !important; border-bottom: none !important; }
    .custom-lesson-notes h1 { font-size: 16pt !important; text-align: left !important; }
    .custom-lesson-notes h2 { font-size: 13pt !important; }
    .custom-lesson-notes h3 { font-size: 11pt !important; }
    .custom-lesson-notes .evidence-level { border: 1px solid #ccc !important; background-color: #eee !important; color: #000 !important; padding: 1px 4px !important; }
    .custom-lesson-notes img { max-width: 75% !important; page-break-inside: avoid !important; box-shadow: none !important; border: 1px solid #ccc !important; }
    .custom-lesson-notes hr { display: none !important; }
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .custom-lesson-notes { padding: 20px !important; margin-top: 20px !important; margin-bottom: 20px !important; }
    .custom-lesson-notes h1 { font-size: 1.9em !important; }
    .custom-lesson-notes h2 { font-size: 1.5em !important; }
    .custom-lesson-notes h3 { font-size: 1.25em !important; }
    .custom-lesson-notes p, .custom-lesson-notes li { font-size: 0.98em !important; }
    .custom-lesson-notes .text-box, .custom-lesson-notes .red-flags, .custom-lesson-notes .key-takeaways, .custom-lesson-notes .clinical-case, .custom-lesson-notes .join-community { padding: 18px 20px 18px 50px !important; margin: 25px 0 !important; }
    .custom-lesson-notes .text-box::before, .custom-lesson-notes .red-flags::before, .custom-lesson-notes .key-takeaways::before, .custom-lesson-notes .clinical-case::before, .custom-lesson-notes .join-community::before { left: 15px !important; top: 18px !important; width: 20px !important; height: 20px !important; }
    .custom-lesson-notes .text-box h3, .custom-lesson-notes .red-flags h3, .custom-lesson-notes .key-takeaways h3, .custom-lesson-notes .clinical-case h3, .custom-lesson-notes .join-community h3 { font-size: 1.15em !important; }
}

@media (max-width: 480px) {
     .custom-lesson-notes h1 { font-size: 1.7em !important; }
     .custom-lesson-notes h2 { font-size: 1.35em !important; padding-right: 25px; /* Adjust space for icon */ }
     .custom-lesson-notes .toggle-icon { font-size: 1.1em; }
     .custom-lesson-notes h3 { font-size: 1.15em !important; }
     .custom-lesson-notes ul, .custom-lesson-notes ol { padding-left: 20px !important; }
     .custom-lesson-notes ul ul, .custom-lesson-notes ol ol { padding-left: 25px !important; }
     /* Stack table cells on very small screens */
     .custom-lesson-notes table td { padding-left: 15px !important; text-align: left !important; }
     .custom-lesson-notes table td::before { position: static; display: block; font-weight: 600; margin-bottom: 5px; text-align: left !important; width: auto; }
     .custom-lesson-notes .text-box, .custom-lesson-notes .red-flags, .custom-lesson-notes .key-takeaways, .custom-lesson-notes .clinical-case, .custom-lesson-notes .join-community { padding: 15px 15px 15px 45px !important; }
     .custom-lesson-notes .text-box::before, .custom-lesson-notes .red-flags::before, .custom-lesson-notes .key-takeaways::before, .custom-lesson-notes .clinical-case::before, .custom-lesson-notes .join-community::before { left: 12px !important; top: 15px !important; }
}

/* --- End of Custom Lesson Notes CSS --- */
