/* RESET STYLES & HELPER CLASSES */
:root {
    --level-1: #2563eb;
    --level-2: #3b82f6;
    --level-3: #60a5fa;
    --level-4: #93c5fd;
    --black: #1f2937;
    --text-white: #f9fafb;
  }
  
  * {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
  }
  
  ol {
    list-style: none;
  }
  
  body {
    margin: 50px 0 100px;
    text-align: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f3f4f6;
  }
  
  .container {
    max-width: 1200px;
    padding: 0 20px;
    margin: 0 auto;
  }
  
  .rectangle {
    position: relative;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    color: var(--text-white);
    transition: transform 0.3s ease;
  }
  
  .rectangle:hover {
    transform: translateY(-3px);
  }
  
  /* LEVEL-1 STYLES */
  .level-1 {
    width: 60%;
    margin: 0 auto 40px;
    background: var(--level-1);
    font-size: 1.5rem;
  }
  
  .level-1::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 25px;
    background: var(--black);
  }
  
  /* LEVEL-2 STYLES */
  .level-2-wrapper {
    display: block;
    width: 90%;
    margin-left: 0;
    position: relative;
  }
  
  .level-2-wrapper::before {
    content: "";
    position: absolute;
    top: -20px;
    left: 25%;
    width: 50%;
    height: 3px;
    background: var(--black);
  }
  
  .level-2-wrapper > li::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 25px;
    background: var(--black);
  }
  
  .level-2 {
    width: 80%;
    margin: 0 auto 30px;
    background: var(--level-2);
    font-size: 1.25rem;
  }
  
  /* LEVEL-3 STYLES */
  .level-3-wrapper {
    display: block;
    width: 90%;
    margin-left: 0;
    position: relative;
  }
  
  .level-3-wrapper::before {
    content: "";
    position: absolute;
    top: -20px;
    left: calc(25% - 5px);
    width: calc(50% + 10px);
    height: 3px;
    background: var(--black);
  }
  
  .level-3-wrapper > li::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -100%);
    width: 3px;
    height: 25px;
    background: var(--black);
  }
  
  .level-3 {
    margin-bottom: 20px;
    background: var(--level-3);
  }
  
  /* LEVEL-4 STYLES */
  .level-4-wrapper {
    display: block;
    width: 90%;
    margin-left: 0;
    position: relative;
  }
  
  .level-4-wrapper::before {
    content: "";
    position: absolute;
    top: -20px;
    left: -20px;
    width: 3px;
    height: calc(100% + 20px);
    background: var(--black);
  }
  
  .level-4-wrapper li + li {
    margin-top: 15px;
  }
  
  .level-4 {
    font-weight: normal;
    background: var(--level-4);
  }
  
  /* Responsive Styles */
  @media screen and (max-width: 1024px) {
    .container {
      padding: 0 8px;
    }
    .level-1, .level-2 {
      width: 98%;
      font-size: 1.1rem;
      padding: 12px 6px;
    }
    .rectangle {
      font-size: 1rem;
      padding: 12px 8px;
    }
  }
  
  @media screen and (max-width: 768px) {
    .rectangle {
      padding: 10px 4px;
      font-size: 0.95rem;
    }
    .level-1, .level-2 {
      width: 100%;
      font-size: 1rem;
      margin-bottom: 12px;
    }
    .level-2-wrapper, .level-3-wrapper {
      width: 100%;
      margin-left: 0;
    }
    .level-3-wrapper {
      grid-column-gap: 0;
    }
    .level-4-wrapper {
      width: 100%;
      margin-left: 0;
    }
    .rectangle img {
      width: 36px !important;
      height: 36px !important;
      margin-right: 8px !important;
    }
  }
  
  @media screen and (max-width: 480px) {
    .container {
      padding: 0 2px;
    }
    .rectangle {
      font-size: 0.85rem;
      padding: 8px 2px;
    }
    .level-1, .level-2 {
      font-size: 0.95rem;
      padding: 8px 2px;
    }
    .rectangle img {
      width: 28px !important;
      height: 28px !important;
      margin-right: 5px !important;
    }
  }
  
  /* FOOTER STYLES */
  .page-footer {
    position: fixed;
    right: 0;
    bottom: 20px;
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.9);
  }
  .page-footer span {
    margin-right: 8px;
    color: #888;
  }
  .page-footer a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
  }
  
  /* --- Garis penghubung parent-child yang benar-benar nyambung --- */
  ol > li {
    position: relative;
  }
  
  /* Garis vertikal dari parent ke horizontal anak */
  ol > li:has(ol)::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    width: 0;
    height: 32px; /* Panjang garis vertikal, sesuaikan dengan gap antar kotak */
    border-left: 3px solid #1f2937;
    transform: translateX(-50%);
    z-index: 1;
  }
  
  ol > li:not(:has(ol))::after {
    display: none;
  }
  
  /* Garis horizontal antar anak */
  .level-2-wrapper, .level-3-wrapper, .level-4-wrapper {
    position: relative;
    margin-top: 32px;
    display: flex;
    justify-content: center;
    gap: 32px;
  }
  
  .level-2-wrapper::before,
  .level-3-wrapper::before,
  .level-4-wrapper::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0;
    border-top: 3px solid #1f2937;
    z-index: 1;
  }
  
  /* Responsive: garis tetap proporsional */
  @media screen and (max-width: 768px) {
    .level-2-wrapper, .level-3-wrapper, .level-4-wrapper {
      flex-direction: column;
      gap: 16px;
      margin-top: 20px;
    }
    .level-2-wrapper::before,
    .level-3-wrapper::before,
    .level-4-wrapper::before {
      left: 0;
      right: 0;
      width: 100%;
    }
    ol > li:has(ol)::after {
      height: 20px;
    }
  }
  
  /* Hapus garis lama yang bentrok */
  .level-1::before,
  .level-2::before,
  .level-3::before,
  .level-4::before {
    display: none !important;
  }
  
  /* Indentasi bertingkat untuk struktur organisasi */
  .indent-2 {
    margin-left: 48px;
  }
  .indent-3 {
    margin-left: 96px;
  }
  .indent-4 {
    margin-left: 144px;
  }
  
  @media screen and (max-width: 768px) {
    .indent-2 { margin-left: 20px; }
    .indent-3 { margin-left: 36px; }
    .indent-4 { margin-left: 52px; }
  }
  