/* ML-Legal numbered lists styling - works in both editor and frontend */
/* Handles multiBlock format where content is wrapped in <p> tags */
/* Only applies to lists with .ml-legal or .ml-legal-simple classes */

/* ========================================= */
/* ML-Legal-Simple: Starts from 1. 2. 3.    */
/* ========================================= */

/* Level 1: 1. 2. 3. */
.ck-content ol.ml-legal-simple,
.ck-editor__editable ol.ml-legal-simple,
ol.ml-legal-simple.ml-legal-simple.ml-legal-simple {
  counter-reset: level1;
  list-style: none;
  padding-left: 0;
  margin-left: 2em;
}

.ck-content ol.ml-legal-simple > li,
.ck-editor__editable ol.ml-legal-simple > li,
ol.ml-legal-simple.ml-legal-simple.ml-legal-simple > li {
  counter-increment: level1;
  position: relative;
  margin: 0.2em 0;
  list-style: none;
}

.ck-content ol.ml-legal-simple > li::before,
.ck-editor__editable ol.ml-legal-simple > li::before,
ol.ml-legal-simple.ml-legal-simple.ml-legal-simple > li::before {
  content: counter(level1) ". ";
  position: absolute;
  left: -2em;
  width: 1.8em;
  text-align: right;
  font-weight: normal;
}

.ck-content ol.ml-legal-simple > li > p,
.ck-editor__editable ol.ml-legal-simple > li > p,
ol.ml-legal-simple.ml-legal-simple.ml-legal-simple > li > p {
  margin: 0;
  padding: 0;
}

/* Level 2: 1.1, 1.2, 1.3 */
.ck-content ol.ml-legal-simple ol,
ol.ml-legal-simple.ml-legal-simple ol {
  counter-reset: level2;
  list-style: none;
  padding-left: 0;
  margin-left: 2em;
  margin-top: 0.2em;
}

.ck-content ol.ml-legal-simple ol > li,
ol.ml-legal-simple.ml-legal-simple ol > li {
  counter-increment: level2;
  position: relative;
  list-style: none;
}

.ck-content ol.ml-legal-simple ol > li::before,
ol.ml-legal-simple.ml-legal-simple ol > li::before {
  content: counter(level1) "." counter(level2) " ";
  position: absolute;
  left: -2.5em;
  width: 2.3em;
  text-align: right;
  font-weight: normal;
}

.ck-content ol.ml-legal-simple ol > li > p,
ol.ml-legal-simple.ml-legal-simple ol > li > p {
  margin: 0;
  padding: 0;
}

/* Level 3: 1.1.1, 1.1.2, 1.1.3 */
.ck-content ol.ml-legal-simple ol ol,
ol.ml-legal-simple.ml-legal-simple ol ol {
  counter-reset: level3;
  padding-left: 0;
  margin-left: 2em;
  margin-top: 0.2em;
}

.ck-content ol.ml-legal-simple ol ol > li,
ol.ml-legal-simple.ml-legal-simple ol ol > li {
  counter-increment: level3;
  position: relative;
  list-style: none;
}

.ck-content ol.ml-legal-simple ol ol > li::before,
ol.ml-legal-simple.ml-legal-simple ol ol > li::before {
  content: counter(level1) "." counter(level2) "." counter(level3) " ";
  position: absolute;
  left: -3em;
  width: 2.8em;
  text-align: right;
  font-weight: normal;
}

.ck-content ol.ml-legal-simple ol ol > li > p,
ol.ml-legal-simple.ml-legal-simple ol ol > li > p {
  margin: 0;
  padding: 0;
}

/* Level 4: 1.1.1.1 */
.ck-content ol.ml-legal-simple ol ol ol,
ol.ml-legal-simple.ml-legal-simple ol ol ol {
  counter-reset: level4;
  padding-left: 0;
  margin-left: 2em;
  margin-top: 0.2em;
}

.ck-content ol.ml-legal-simple ol ol ol > li,
ol.ml-legal-simple.ml-legal-simple ol ol ol > li {
  counter-increment: level4;
  position: relative;
  list-style: none;
}

.ck-content ol.ml-legal-simple ol ol ol > li::before,
ol.ml-legal-simple.ml-legal-simple ol ol ol > li::before {
  content: counter(level1) "." counter(level2) "." counter(level3) "." counter(level4) " ";
  position: absolute;
  left: -3.5em;
  width: 3.3em;
  text-align: right;
  font-weight: normal;
}

.ck-content ol.ml-legal-simple ol ol ol > li > p,
ol.ml-legal-simple.ml-legal-simple ol ol ol > li > p {
  margin: 0;
  padding: 0;
}

/* Level 5: 1.1.1.1.1 */
.ck-content ol.ml-legal-simple ol ol ol ol,
ol.ml-legal-simple.ml-legal-simple ol ol ol ol {
  counter-reset: level5;
  padding-left: 0;
  margin-left: 2em;
  margin-top: 0.2em;
}

.ck-content ol.ml-legal-simple ol ol ol ol > li,
ol.ml-legal-simple.ml-legal-simple ol ol ol ol > li {
  counter-increment: level5;
  position: relative;
  list-style: none;
}

.ck-content ol.ml-legal-simple ol ol ol ol > li::before,
ol.ml-legal-simple.ml-legal-simple ol ol ol ol > li::before {
  content: counter(level1) "." counter(level2) "." counter(level3) "." counter(level4) "." counter(level5) " ";
  position: absolute;
  left: -4em;
  width: 3.8em;
  text-align: right;
  font-weight: normal;
}

.ck-content ol.ml-legal-simple ol ol ol ol > li > p,
ol.ml-legal-simple.ml-legal-simple ol ol ol ol > li > p {
  margin: 0;
  padding: 0;
}

/* Level 6: 1.1.1.1.1.1 */
.ck-content ol.ml-legal-simple ol ol ol ol ol,
ol.ml-legal-simple.ml-legal-simple ol ol ol ol ol {
  counter-reset: level6;
  padding-left: 0;
  margin-left: 2em;
  margin-top: 0.2em;
}

.ck-content ol.ml-legal-simple ol ol ol ol ol > li,
ol.ml-legal-simple.ml-legal-simple ol ol ol ol ol > li {
  counter-increment: level6;
  position: relative;
  list-style: none;
}

.ck-content ol.ml-legal-simple ol ol ol ol ol > li::before,
ol.ml-legal-simple.ml-legal-simple ol ol ol ol ol > li::before {
  content: counter(level1) "." counter(level2) "." counter(level3) "." counter(level4) "." counter(level5) "." counter(level6) " ";
  position: absolute;
  left: -4.5em;
  width: 4.3em;
  text-align: right;
  font-weight: normal;
}

.ck-content ol.ml-legal-simple ol ol ol ol ol > li > p,
ol.ml-legal-simple.ml-legal-simple ol ol ol ol ol > li > p {
  margin: 0;
  padding: 0;
}

/* ========================================= */
/* ML-Legal: Starts from 1.1, 1.2, 1.3      */
/* ========================================= */

/* Level 1: 1.1, 1.2, 1.3 (starts from 1.1 instead of 1.) */
.ck-content ol.ml-legal,
ol.ml-legal.ml-legal {
  counter-reset: level1 0 level2;
  list-style: none;
  padding-left: 0;
  margin-left: calc(var(--ml-width-1, 2.3em) + 0.2em);
  --ml-first-digit: "1";
}

.ck-content ol.ml-legal > li,
ol.ml-legal.ml-legal > li {
  counter-increment: level2;
  position: relative;
  margin: 0.2em 0;
  list-style: none;
}

.ck-content ol.ml-legal > li::before,
ol.ml-legal.ml-legal > li::before {
  content: var(--ml-first-digit) "." counter(level2) " ";
  position: absolute;
  left: calc(-1 * var(--ml-width-1, 2.3em) - 0.2em);
  width: var(--ml-width-1, 2.3em);
  text-align: right;
  font-weight: normal;
}

/* Remove default margins from paragraphs inside list items */
.ck-content ol.ml-legal > li > p,
ol.ml-legal.ml-legal > li > p {
  margin: 0;
  padding: 0;
}

/* Level 2: 1.1.1, 1.1.2, 1.1.3 */
.ck-content ol.ml-legal ol,
ol.ml-legal.ml-legal ol {
  counter-reset: level3;
  list-style: none;
  padding-left: 0;
  margin-left: 1.5em;
  margin-top: 0.2em;
}

.ck-content ol.ml-legal ol > li,
ol.ml-legal.ml-legal ol > li {
  counter-increment: level3;
  position: relative;
  list-style: none;
}

.ck-content ol.ml-legal ol > li::before,
ol.ml-legal.ml-legal ol > li::before {
  content: var(--ml-first-digit, "1") "." counter(level2) "." counter(level3) " ";
  position: absolute;
  left: calc(-1 * var(--ml-width-2, 2.8em) - 0.2em);
  width: var(--ml-width-2, 2.8em);
  text-align: right;
  font-weight: normal;
}

.ck-content ol.ml-legal ol > li > p,
ol.ml-legal.ml-legal ol > li > p {
  margin: 0;
  padding: 0;
}

/* Level 3: 1.1.1.1, 1.1.1.2, 1.1.1.3 */
.ck-content ol.ml-legal ol ol,
ol.ml-legal.ml-legal ol ol {
  counter-reset: level4;
  padding-left: 0;
  margin-left: 1.5em;
  margin-top: 0.2em;
}

.ck-content ol.ml-legal ol ol > li,
ol.ml-legal.ml-legal ol ol > li {
  counter-increment: level4;
  position: relative;
  list-style: none;
}

.ck-content ol.ml-legal ol ol > li::before,
ol.ml-legal.ml-legal ol ol > li::before {
  content: var(--ml-first-digit, "1") "." counter(level2) "." counter(level3) "." counter(level4) " ";
  position: absolute;
  left: calc(-1 * var(--ml-width-3, 4.3em) - 0.2em);
  width: var(--ml-width-3, 4.3em);
  text-align: right;
  font-weight: normal;
}

.ck-content ol.ml-legal ol ol > li > p,
ol.ml-legal.ml-legal ol ol > li > p {
  margin: 0;
  padding: 0;
}

/* Level 4: 1.1.1.1.1 */
.ck-content ol.ml-legal ol ol ol,
ol.ml-legal.ml-legal ol ol ol {
  counter-reset: level5;
  padding-left: 0;
  margin-left: 1.5em;
  margin-top: 0.2em;
}

.ck-content ol.ml-legal ol ol ol > li,
ol.ml-legal.ml-legal ol ol ol > li {
  counter-increment: level5;
  position: relative;
  list-style: none;
}

.ck-content ol.ml-legal ol ol ol > li::before,
ol.ml-legal.ml-legal ol ol ol > li::before {
  content: var(--ml-first-digit, "1") "." counter(level2) "." counter(level3) "." counter(level4) "." counter(level5) " ";
  position: absolute;
  left: calc(-1 * var(--ml-width-4, 5.3em) - 0.2em);
  width: var(--ml-width-4, 5.3em);
  text-align: right;
  font-weight: normal;
}

.ck-content ol.ml-legal ol ol ol > li > p,
ol.ml-legal.ml-legal ol ol ol > li > p {
  margin: 0;
  padding: 0;
}

/* Level 5: 1.1.1.1.1.1 */
.ck-content ol.ml-legal ol ol ol ol,
ol.ml-legal.ml-legal ol ol ol ol {
  counter-reset: level6;
  padding-left: 0;
  margin-left: 1.5em;
  margin-top: 0.2em;
}

.ck-content ol.ml-legal ol ol ol ol > li,
ol.ml-legal.ml-legal ol ol ol ol > li {
  counter-increment: level6;
  position: relative;
  list-style: none;
}

.ck-content ol.ml-legal ol ol ol ol > li::before,
ol.ml-legal.ml-legal ol ol ol ol > li::before {
  content: var(--ml-first-digit, "1") "." counter(level2) "." counter(level3) "." counter(level4) "." counter(level5) "." counter(level6) " ";
  position: absolute;
  left: calc(-1 * var(--ml-width-5, 6.3em) - 0.2em);
  width: var(--ml-width-5, 6.3em);
  text-align: right;
  font-weight: normal;
}

.ck-content ol.ml-legal ol ol ol ol > li > p,
ol.ml-legal.ml-legal ol ol ol ol > li > p {
  margin: 0;
  padding: 0;
}

/* Level 6: 1.1.1.1.1.1.1 */
.ck-content ol.ml-legal ol ol ol ol ol,
ol.ml-legal.ml-legal ol ol ol ol ol {
  counter-reset: level7;
  padding-left: 0;
  margin-left: 1.5em;
  margin-top: 0.2em;
}

.ck-content ol.ml-legal ol ol ol ol ol > li,
ol.ml-legal.ml-legal ol ol ol ol ol > li {
  counter-increment: level7;
  position: relative;
  list-style: none;
}

.ck-content ol.ml-legal ol ol ol ol ol > li::before,
ol.ml-legal.ml-legal ol ol ol ol ol > li::before {
  content: var(--ml-first-digit, "1") "." counter(level2) "." counter(level3) "." counter(level4) "." counter(level5) "." counter(level6) "." counter(level7) " ";
  position: absolute;
  left: calc(-1 * var(--ml-width-6, 7.3em) - 0.2em);
  width: var(--ml-width-6, 7.3em);
  text-align: right;
  font-weight: normal;
}

.ck-content ol.ml-legal ol ol ol ol ol > li > p,
ol.ml-legal.ml-legal ol ol ol ol ol > li > p {
  margin: 0;
  padding: 0;
}

/* Ensure proper indentation for nested lists */
.ck-content ol ul,
.ck-content ul ol {
  margin-left: 2em;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

/* Bullets under numbered lists */
.ck-content ol ul {
  list-style-type: disc;
  padding-left: 1.5em;
}

/* Numbers under bullet lists */
.ck-content ul ol {
  list-style-type: decimal;
  padding-left: 1.5em;
}

/* Nested bullet variations */
.ck-content ul ul {
  list-style-type: circle;
  margin-left: 2em;
}

.ck-content ul ul ul {
  list-style-type: square;
}
