/* Outer Wrapper */
.material-grouped-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 1.5em 0;
    padding: 0;
}

/* -------------------------------------- */
/* GUTENBERG EDITOR FIXES                 */
/* -------------------------------------- */
.material-grouped-list .block-editor-inner-blocks > .block-editor-block-list__layout {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.material-grouped-list .block-editor-block-list__block {
    margin: 0 !important;
}

/* -------------------------------------- */
/* BLOCK STYLES (THEMES)                  */
/* -------------------------------------- */
/* Base Variables */
.material-grouped-list {
    --theme-bg: #f3edf7;
    --theme-text: #1c1b1f;
}

.material-grouped-list.is-style-soft-blue {
    --theme-bg: #e8f0fe;
    --theme-text: #174ea6;
}

.material-grouped-list.is-style-soft-green {
    --theme-bg: #e6f4ea;
    --theme-text: #137333;
}

/* -------------------------------------- */
/* LIST ITEM STYLING (THE MAGIC LOGIC)    */
/* -------------------------------------- */
.material-list-item {
    /* Prioritizes Custom Picker Color, Fallbacks to Theme Style */
    background-color: var(--custom-bg, var(--theme-bg)) !important;
    color: var(--custom-text, var(--theme-text)) !important;
    
    padding: 16px 24px;
    font-size: 16px;
    line-height: 1.6;
    transition: background-color 0.2s ease, color 0.2s ease;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

/* -------------------------------------- */
/* DYNAMIC CURVES (FRONTEND)              */
/* -------------------------------------- */
.material-grouped-list > .material-list-item { border-radius: 4px; }
.material-grouped-list > .material-list-item:first-child { border-radius: 24px 24px 4px 4px; }
.material-grouped-list > .material-list-item:last-child { border-radius: 4px 4px 24px 24px; }
.material-grouped-list > .material-list-item:only-child { border-radius: 24px; }

/* -------------------------------------- */
/* DYNAMIC CURVES (EDITOR)                */
/* -------------------------------------- */
.block-editor-block-list__block[data-type="bullet-list/item"] .material-list-item {
    border-radius: 4px;
}
.block-editor-block-list__block[data-type="bullet-list/item"]:first-child .material-list-item {
    border-radius: 24px 24px 4px 4px;
}
.block-editor-block-list__block[data-type="bullet-list/item"]:last-child .material-list-item {
    border-radius: 4px 4px 24px 24px;
}
.block-editor-block-list__block[data-type="bullet-list/item"]:first-child:last-child .material-list-item {
    border-radius: 24px;
}

/* -------------------------------------- */
/* DARK MODE FALLBACKS                    */
/* -------------------------------------- */
@media (prefers-color-scheme: dark) {
    .material-grouped-list {
        --theme-bg: #2b2930;
        --theme-text: #e6e0e9;
    }
    .material-grouped-list.is-style-soft-blue {
        --theme-bg: #0f2557; 
        --theme-text: #d2e3fc;
    }
    .material-grouped-list.is-style-soft-green {
        --theme-bg: #0d3b1f;
        --theme-text: #ceead6;
    }
}
