 body {
      margin: 0;
      font-family: 'Inter', sans-serif;
      display: flex;
      flex-direction: column;
      height: 100vh;
      transition: background 0.3s, color 0.3s;
    }

    /* Toolbar */
    #toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: #e9ecef;
      padding: 5px 10px;
      border-bottom: 1px solid #ccc;
      user-select: none;
    }
    body.dark #toolbar {
      background: #222;
      color: #eee;
      border-bottom: 1px solid #444;
    }

    .toolbar-left,
    .toolbar-right {
      display: flex;
      align-items: center;
      gap: 8px;
      position: relative;
    }

    .tool-btn {
      background: none;
      border: none;
      cursor: pointer;
      font-size: 15px;
      padding: 5px 6px;
      border-radius: 4px;
      color: #444;
      transition: background 0.2s, color 0.3s;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    body.dark .tool-btn { color: #eee; }
    .tool-btn:hover { background: #ddd; }
    body.dark .tool-btn:hover { background: #444; }
    .tool-btn i { font-size: 22px; }
    .wrap-label { font-size: 15px; }

    /* Dropdown umum */
    .dropdown {
      position: absolute;
      top: 100%;
      left: 0;
      margin-top: 4px;
      background: #fff;
      border: 1px solid #ccc;
      border-radius: 6px;
      display: none;
      flex-direction: column;
      z-index: 1000;
      min-width: 170px;
      box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    }
    body.dark .dropdown { background: #333; border: 1px solid #555; }
    .dropdown button {
      padding: 8px 12px;
      background: none;
      border: none;
      text-align: left;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 14px;
      color: inherit;
    }
    .dropdown button:hover { background: #eee; }
    body.dark .dropdown button:hover { background: #555; }

    /* Warna dropdown */
    .dropdown .html i { color: #e34c26; }
    .dropdown .css i { color: #264de4; }
    .dropdown .js i { color: #f7df1e; }
    .dropdown .whatsapp i { color: #25d366; }
    .dropdown .telegram i { color: #0088cc; }
    .dropdown .facebook i { color: #1877f2; }
    .dropdown .twitter i { color: #1da1f2; }
    .dropdown .linkedin i { color: #0a66c2; }
    .dropdown .print i { color: #444; }

    #runBtn, #getBtn {
      background: #16a34a;
      border: none;
      color: white;
      padding: 6px 12px;
      font-size: 14px;
      border-radius: 4px;
      cursor: pointer;
      font-weight: 600;
    }
    #runBtn:hover, #getBtn:hover { background: #15803d; }

    /* Layout */
    #container {
      display: flex;
      flex: 1;
      overflow: hidden;
      position: relative;
    }

    .editor-pane {
      flex-basis: 50%;
      height: 100%;
      display: flex;
      flex-direction: column;
      min-width: 150px;
      transition: flex-basis 0.1s ease;
    }
    .CodeMirror {
      flex: 1;
      height: 100%;
      font-size: 14px;
      font-family: Consolas, 'Courier New', monospace;
    }
    #preview {
      flex: 1;
      height: 100%;
      border-left: 2px solid #ddd;
    }
    body.dark #preview { border-left: 2px solid #444; }

    /* Control buttons */
    #resizeControls {
      position: absolute;
      bottom: 5px;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(0,0,0,0.05);
      border-radius: 6px;
      padding: 2px 6px;
      display: flex;
      gap: 6px;
      z-index: 10;
    }
    #resizeControls button {
      background: #fff;
      border: 1px solid #ccc;
      border-radius: 4px;
      padding: 4px 6px;
      cursor: pointer;
      font-size: 14px;
    }
    #resizeControls button:hover { background: #eee; }
    body.dark #resizeControls button { background: #333; color: #eee; border: 1px solid #555; }
    body.dark #resizeControls button:hover { background: #555; }

    /* Footer */
    footer {
      background: #e9ecef;
      text-align: center;
      padding: 8px;
      font-size: 13px;
      border-top: 1px solid #ccc;
    }
    body.dark footer {
      background: #222;
      color: #eee;
      border-top: 1px solid #444;
    }

    /* Overlay Popup */
#mobilePreviewOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.iphone-frame { /* bila sudah ada, boleh abaikan */
  position: relative;
  width: 380px;
  height: 800px;
  overflow: hidden;
  border-radius: 40px;
}


.iphone-screen { width:100%; height:100%; border:0; display:block; }

.close-preview {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #fff;
  border: none;
  padding: 10px 13px;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  z-index: 10000;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* =========================
   Responsive Layout Upgrade
   ========================= */

/* Tablet dan laptop kecil */
@media (max-width: 992px) {
  #container {
    flex-direction: column;
  }

  .editor-pane {
    width: 100%;
    height: 45vh; /* editor 45% layar */
    flex-basis: auto;
  }

  #preview {
    width: 100%;
    height: 55vh; /* preview 55% layar */
    border-left: none;
    border-top: 2px solid #ddd;
  }
  body.dark #preview { border-top: 2px solid #444; }

  #resizeControls {
    display: none; /* kontrol resize disembunyikan di mobile */
  }
}

/* Smartphone */
@media (max-width: 576px) {
  #toolbar {
    flex-wrap: wrap;
    padding: 8px;
    gap: 6px;
    backdrop-filter: blur(10px);
    background: rgba(233, 236, 239, 0.85);
  }
  body.dark #toolbar {
    background: rgba(34, 34, 34, 0.85);
  }

  .wrap-label {
    display: none;
  }

  .dropdown {    
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: -35px;
    background: #fff;
    border: 1px solid #ffffff;
    border-radius: 6px;
    display: none;
    flex-direction: row;
    z-index: 1000;
    min-width: 170px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  }

  .toolbar-left,
  .toolbar-right {
    flex-wrap: wrap;
    gap: 2px;
    width: 100%;
    justify-content:flex-start;
  }

    #resetBtn {
    font-size: 0 !important;
    padding: 8px;
    width: auto;
  }

  .tool-btn {
    padding: 8px;
    font-size: 13px;
    border-radius: 5px;
    background: rgba(255,255,255,0.6);
  }
  body.dark .tool-btn {
    background: rgba(50,50,50,0.6);
  }

  .tool-btn i {
    font-size: 20px;
  }

  #sizeInfo {
    display: none; /* biar toolbar tidak kepanjangan */
  }

  #getBtn {
    flex: 1;
    font-size: 14px;
    padding: 6px 8px;
    border-radius: 20px;
  }

  footer {
    font-size: 11px;
    padding: 6px;
  }
}

/* Tambahan efek keren */
.tool-btn:hover {
  transform: scale(1.01);
  transition: all 0.1s ease;
}

/* Hide Share button on mobile */
@media (max-width: 576px) {
  #shareBtn {
    display: none !important;
  }
}
